-
-
Notifications
You must be signed in to change notification settings - Fork 115
Updating @example sections for several EntityTag Mechanism's and Tags. #2813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 4 commits
cb12e5d
cf1832d
45e1bea
d57e85b
56037f5
d980299
3c4a3d4
246d113
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1257,7 +1257,12 @@ public static void register() { | |
| // @returns ElementTag | ||
| // @deprecated Use 'EntityTag.type' on MC 1.20+. | ||
| // @description | ||
| // Returns the entities type. NOTE: For NPC's it will say "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). | ||
| // @example | ||
| // # Describes the type of entity at the players cursor in the world. | ||
| // # For use in-game: /ex narrate <player.target.entity_type> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we do not need every example doc to tell you about the |
||
| // - narrate <player.target.entity_type> | ||
| // --> | ||
| tagProcessor.registerTag(ElementTag.class, "entity_type", (attribute, object) -> { | ||
| if (NMSHandler.getVersion().isAtMost(NMSVersion.v1_19)) { | ||
|
|
@@ -1293,6 +1298,12 @@ public static void register() { | |
| // @group data | ||
| // @description | ||
| // Returns the type of the entity. | ||
| // @example | ||
| // # Checks if the entity that a player is looking at is also a player. | ||
| // # - if <player.target.type> == Player: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a bad script, for multiple reasons. The if/else is silly, the target tag is used without a fallback |
||
| // # - narrate True | ||
| // # - else: | ||
| // # - narrate False | ||
| // --> | ||
| tagProcessor.registerTag(ElementTag.class, "type", (attribute, object) -> { | ||
| return new ElementTag(object.getEntityType().getLowercaseName(), true); | ||
|
|
@@ -1400,6 +1411,13 @@ public static void register() { | |
| // Returns the name of the entity. | ||
| // This can be a player name, an NPC name, a custom_name, or the entity type. | ||
| // Works with offline players. | ||
| // @example | ||
| // # Checks if the player's name is "mcmonkey". | ||
| // # For use in game: /ex narrate <player.name.matches[mcmonkey]> | ||
| // - if <player.name> == mcmonkey: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is actively violating one of the basic points in the Denizen beginner's guide |
||
| // - narrate True | ||
| // - else: | ||
| // - narrate False | ||
| // --> | ||
| registerSpawnedOnlyTag(ElementTag.class, "name", (attribute, object) -> { | ||
| return new ElementTag(object.getName(), true); | ||
|
|
@@ -1563,6 +1581,10 @@ else if (object.getLivingEntity() instanceof Steerable) { | |
| // @group location | ||
| // @description | ||
| // Returns the location of the entity's eyes. | ||
| // @example | ||
| // # Narrates the linked player's eye location. | ||
| // # /ex narrate <player.eye_location> | ||
| // - narrate <player.eye_location> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just narrating tags is not a very good example usage |
||
| // --> | ||
| registerSpawnedOnlyTag(LocationTag.class, "eye_location", (attribute, object) -> { | ||
| return new LocationTag(object.getEyeLocation()); | ||
|
|
@@ -1677,6 +1699,10 @@ else if (object.getLivingEntity() instanceof Steerable) { | |
| // @description | ||
| // Returns the movement velocity of the entity. | ||
| // Note: Does not accurately calculate player clientside movement velocity. | ||
| // @example | ||
| // # Narrates the linked player's server side velocity. | ||
| // # To run this in-game: /ex narrate <player.velocity> | ||
| // - narrate <player.velocity> | ||
| // --> | ||
| registerSpawnedOnlyTag(LocationTag.class, "velocity", (attribute, object) -> { | ||
| return new LocationTag(object.getBukkitEntity().getVelocity().toLocation(object.getBukkitEntity().getWorld())); | ||
|
|
@@ -1688,6 +1714,10 @@ else if (object.getLivingEntity() instanceof Steerable) { | |
| // @group location | ||
| // @description | ||
| // Returns the world the entity is in. Works with offline players. | ||
| // @example | ||
| // # Narrates the world's name that the Entity is in. | ||
| // # To run this in-game: /ex narrate <player.world.name> | ||
| // - narrate <player.world.name> | ||
| // --> | ||
| registerSpawnedOnlyTag(WorldTag.class, "world", (attribute, object) -> { | ||
| return new WorldTag(object.getBukkitEntity().getWorld()); | ||
|
|
@@ -2339,7 +2369,10 @@ 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). | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lowercase |
||
| // @example | ||
| // # Narrate's if the player is glowing. (True / False) | ||
| // - narrate <player.glowing> | ||
| // --> | ||
| registerSpawnedOnlyTag(ElementTag.class, "glowing", (attribute, object) -> { | ||
| return new ElementTag(object.getBukkitEntity().isGlowing()); | ||
|
|
@@ -3892,6 +3925,10 @@ public void adjust(Mechanism mechanism) { | |
| // Sets the entity's movement velocity vector. | ||
| // @tags | ||
| // <EntityTag.velocity> | ||
| // @example | ||
| // # Launches the player upwards by adjusting their velocity. | ||
| // # For use in game: /ex adjust <player> velocity:<location[0,1,0]> | ||
| // - adjust <player> velocity:<location[0,1,0]> | ||
| // --> | ||
| if (mechanism.matches("velocity") && mechanism.requireObject(LocationTag.class)) { | ||
| setVelocity(mechanism.valueAsType(LocationTag.class).toVector()); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not well written