Skip to content

Commit

Permalink
Merge pull request #89 from mergu/master
Browse files Browse the repository at this point in the history
added left/right shoulder entity tags & mecs
  • Loading branch information
mcmonkey4eva committed Jul 28, 2017
2 parents 560b59b + ebaa182 commit 2e3fcba
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2120,6 +2120,32 @@ else if (obj instanceof dEntity) {
.getAttribute(attribute.fulfill(1));
}

// <--[tag]
// @attribute <p@player.left_shoulder>
// @returns dEntity
// @description
// Returns the entity on the player's left shoulder.
// NOTE: The returned entity will not be spawned within the world,
// so most operations are invalid unless the entity is first spawned in.
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1) && attribute.startsWith("left_shoulder")) {
return new dEntity(getPlayerEntity().getShoulderEntityLeft())
.getAttribute(attribute.fulfill(1));
}

// <--[tag]
// @attribute <p@player.right_shoulder>
// @returns dEntity
// @description
// Returns the entity on the player's right shoulder.
// NOTE: The returned entity will not be spawned within the world,
// so most operations are invalid unless the entity is first spawned in.
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1) && attribute.startsWith("right_shoulder")) {
return new dEntity(getPlayerEntity().getShoulderEntityRight())
.getAttribute(attribute.fulfill(1));
}

if (Depends.chat != null) {

// <--[tag]
Expand Down Expand Up @@ -2582,6 +2608,52 @@ public void adjust(Mechanism mechanism) {
getPlayerEntity().setExhaustion(value.asFloat());
}

// <--[mechanism]
// @object dPlayer
// @name left_shoulder
// @input dEntity
// @description
// Sets the player's left shoulder entity.
// Provide no input to remove the shoulder entity.
// NOTE: This mechanism will remove the current shoulder entity from the world.
// Also note the client will currently only render parrot entities.
// @tags
// <p@player.left_shoulder>
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1) && mechanism.matches("left_shoulder")) {
if (!value.asString().isEmpty()) {
if (mechanism.requireObject(dEntity.class)) {
getPlayerEntity().setShoulderEntityLeft(value.asType(dEntity.class).getBukkitEntity());
}
}
else {
getPlayerEntity().setShoulderEntityLeft(null);
}
}

// <--[mechanism]
// @object dPlayer
// @name right_shoulder
// @input dEntity
// @description
// Sets the player's right shoulder entity.
// Provide no input to remove the shoulder entity.
// NOTE: This mechanism will remove the current shoulder entity from the world.
// Also note the client will currently only render parrot entities.
// @tags
// <p@player.right_shoulder>
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_12_R1) && mechanism.matches("right_shoulder")) {
if (!value.asString().isEmpty()) {
if (mechanism.requireObject(dEntity.class)) {
getPlayerEntity().setShoulderEntityRight(value.asType(dEntity.class).getBukkitEntity());
}
}
else {
getPlayerEntity().setShoulderEntityRight(null);
}
}

// <--[mechanism]
// @object dPlayer
// @name show_entity
Expand Down

0 comments on commit 2e3fcba

Please sign in to comment.