Skip to content

Commit

Permalink
EntityTag.standing_on
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Apr 17, 2021
1 parent c192692 commit a14d852
Showing 1 changed file with 16 additions and 7 deletions.
Expand Up @@ -1453,20 +1453,29 @@ else if (mtr.angle == BlockFace.EAST) {
return new LocationTag(object.getTargetBlockSafe(set, range));
}

// <--[tag]
// @attribute <EntityTag.location.standing_on>
// @returns LocationTag
// @group location
// @description
// Returns the location of what the entity is standing on.
// -->
if (attribute.startsWith("standing_on", 2)) {
Deprecations.entityStandingOn.warn(attribute.context);
attribute.fulfill(1);
return new LocationTag(object.entity.getLocation().clone().add(0, -0.5f, 0));
}
return new LocationTag(object.entity.getLocation());
});

// <--[tag]
// @attribute <EntityTag.standing_on>
// @returns LocationTag
// @group location
// @description
// Returns the location of the block the entity is standing on top of (if on the ground, returns null if in the air).
// -->
registerSpawnedOnlyTag("standing_on", (attribute, object) -> {
if (!object.getBukkitEntity().isOnGround()) {
return null;
}
Location loc = object.getBukkitEntity().getLocation().clone().subtract(0, 0.05f, 0);
return new LocationTag(loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
});

// <--[tag]
// @attribute <EntityTag.body_yaw>
// @returns ElementTag(Decimal)
Expand Down

0 comments on commit a14d852

Please sign in to comment.