Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mcmonkey4eva/Denizen
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 18, 2017
2 parents 2fead73 + 46b7f60 commit 4d51c8a
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dEntity.java
Expand Up @@ -2757,6 +2757,48 @@ public void adjust(Mechanism mechanism) {
}
}

// <--[mechanism]
// @object dEntity
// @name release_left_shoulder
// @input None
// @description
// Releases the player's left shoulder entity.
// Only applies to player-typed entities.
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1) && getLivingEntity() instanceof HumanEntity
&& mechanism.matches("release_left_shoulder")) {
Entity bukkitEnt = ((HumanEntity) getLivingEntity()).getShoulderEntityLeft();
if (bukkitEnt != null) {
dEntity ent = new dEntity(bukkitEnt);
String escript = ent.getEntityScript();
ent = dEntity.valueOf("e@" + (escript != null && escript.length() > 0 ? escript : ent.getEntityType().getLowercaseName())
+ PropertyParser.getPropertiesString(ent));
ent.spawnAt(getEyeLocation());
((HumanEntity) getLivingEntity()).setShoulderEntityLeft(null);
}
}

// <--[mechanism]
// @object dEntity
// @name release_right_shoulder
// @input None
// @description
// Releases the player's right shoulder entity.
// Only applies to player-typed entities.
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1) && getLivingEntity() instanceof HumanEntity
&& mechanism.matches("release_right_shoulder")) {
Entity bukkitEnt = ((HumanEntity) getLivingEntity()).getShoulderEntityRight();
if (bukkitEnt != null) {
dEntity ent = new dEntity(bukkitEnt);
String escript = ent.getEntityScript();
ent = dEntity.valueOf("e@" + (escript != null && escript.length() > 0 ? escript : ent.getEntityType().getLowercaseName())
+ PropertyParser.getPropertiesString(ent));
ent.spawnAt(getEyeLocation());
((HumanEntity) getLivingEntity()).setShoulderEntityRight(null);
}
}

// <--[mechanism]
// @object dEntity
// @name left_shoulder
Expand All @@ -2772,7 +2814,7 @@ public void adjust(Mechanism mechanism) {
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1) && getLivingEntity() instanceof HumanEntity
&& mechanism.matches("left_shoulder")) {
if (!value.asString().isEmpty()) {
if (mechanism.hasValue()) {
if (mechanism.requireObject(dEntity.class)) {
((HumanEntity) getLivingEntity()).setShoulderEntityLeft(value.asType(dEntity.class).getBukkitEntity());
}
Expand All @@ -2796,7 +2838,7 @@ public void adjust(Mechanism mechanism) {
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1) && getLivingEntity() instanceof HumanEntity
&& mechanism.matches("right_shoulder")) {
if (!value.asString().isEmpty()) {
if (mechanism.hasValue()) {
if (mechanism.requireObject(dEntity.class)) {
((HumanEntity) getLivingEntity()).setShoulderEntityRight(value.asType(dEntity.class).getBukkitEntity());
}
Expand Down

0 comments on commit 4d51c8a

Please sign in to comment.