Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,8 @@ public static void register() {
// @returns ElementTag
// @deprecated Use 'EntityTag.type' on MC 1.20+.
// @description
// Returns the entities type.
// Note: For NPC's this will return the value "Player".
// Deprecated in favor of <@link tag EntityTag.type> on MC 1.20+, which returns entity type names as specified by Mojang (scripts using this may need an update when switching).
// -->
tagProcessor.registerTag(ElementTag.class, "entity_type", (attribute, object) -> {
Expand Down Expand Up @@ -1563,6 +1565,9 @@ else if (object.getLivingEntity() instanceof Steerable) {
// @group location
// @description
// Returns the location of the entity's eyes.
// @example
// # Shoots a snowball from the direct center of the players screen.
// - shoot snowball origin:<player.eye_location> destination:<player.location.facing> speed:1
// -->
registerSpawnedOnlyTag(LocationTag.class, "eye_location", (attribute, object) -> {
return new LocationTag(object.getEyeLocation());
Expand Down Expand Up @@ -1676,7 +1681,17 @@ else if (object.getLivingEntity() instanceof Steerable) {
// @mechanism EntityTag.velocity
// @description
// Returns the movement velocity of the entity.
// There is a constant negative velocity of '-0.08' when standing on a block.
// Note: Does not accurately calculate player clientside movement velocity.
// @example
// # Checks if the player is jumping:
// - if <player.velocity.y.is_more_than[0]>:
// - narrate "The player is jumping!"
// - else:
// - narrate "The player is not jumping!"
// @example
// # Makes the player jump:
// - adjust <player> velocity:<location[0,1,0]>
// -->
registerSpawnedOnlyTag(LocationTag.class, "velocity", (attribute, object) -> {
return new LocationTag(object.getBukkitEntity().getVelocity().toLocation(object.getBukkitEntity().getWorld()));
Expand All @@ -1688,6 +1703,9 @@ else if (object.getLivingEntity() instanceof Steerable) {
// @group location
// @description
// Returns the world the entity is in. Works with offline players.
// @example
// # Narrates the world name that the linked player is in.
// - narrate <player.world.name>
// -->
registerSpawnedOnlyTag(WorldTag.class, "world", (attribute, object) -> {
return new WorldTag(object.getBukkitEntity().getWorld());
Expand Down Expand Up @@ -2339,7 +2357,7 @@ else if (object.getBukkitEntity() instanceof Hanging hanging) {
// @mechanism EntityTag.glowing
// @group attributes
// @description
// Returns whether this entity is glowing.
// Returns whether this entity is glowing (Has an outline around them).
// -->
registerSpawnedOnlyTag(ElementTag.class, "glowing", (attribute, object) -> {
return new ElementTag(object.getBukkitEntity().isGlowing());
Expand Down Expand Up @@ -3892,6 +3910,9 @@ public void adjust(Mechanism mechanism) {
// Sets the entity's movement velocity vector.
// @tags
// <EntityTag.velocity>
// @example
// # Launches the player upwards by adjusting their velocity.
// - adjust <player> velocity:<location[0,1,0]>
// -->
if (mechanism.matches("velocity") && mechanism.requireObject(LocationTag.class)) {
setVelocity(mechanism.valueAsType(LocationTag.class).toVector());
Expand Down