Repository navigation
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
Open
Skullfurious
wants to merge
8
commits into
DenizenScript:dev
Choose a base branch
from
Skullfurious:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cb12e5d
Add @example to EntityTag.velocity
Skullfurious cf1832d
Add @example to EntityTag.world
Skullfurious 45e1bea
Add @example to EntityTag.glowing
Skullfurious d57e85b
Add @example to several tags and mechanisms.
Skullfurious 56037f5
Adjust examples based on feedback.
Skullfurious d980299
Removed imports
Skullfurious 3c4a3d4
Requested Changes submitted
Skullfurious 246d113
Typo
Skullfurious File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1257,6 +1257,7 @@ public static void register() { | |
| // @returns ElementTag | ||
| // @deprecated Use 'EntityTag.type' on MC 1.20+. | ||
| // @description | ||
| // Returns the entities type. | ||
| // 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) -> { | ||
|
|
@@ -1563,6 +1564,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> speed:2 | ||
|
Contributor
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. These examples all reference players, which would be fine in the PlayerTag file, but these are for EntityTags. |
||
| // --> | ||
| registerSpawnedOnlyTag(LocationTag.class, "eye_location", (attribute, object) -> { | ||
| return new LocationTag(object.getEyeLocation()); | ||
|
|
@@ -1676,7 +1680,14 @@ else if (object.getLivingEntity() instanceof Steerable) { | |
| // @mechanism EntityTag.velocity | ||
| // @description | ||
| // Returns the movement velocity of the entity. | ||
| // Will return a constant negative velocity when standing on a solid block. | ||
| // Note: Does not accurately calculate player clientside movement velocity. | ||
| // @example | ||
| // # Checks if the player is moving upwards. | ||
| // - if <player.velocity.y> > 0: | ||
| // - narrate "The player is moving upwards!" | ||
| // - else: | ||
| // - narrate "The player is not moving upwards!" | ||
| // --> | ||
| registerSpawnedOnlyTag(LocationTag.class, "velocity", (attribute, object) -> { | ||
| return new LocationTag(object.getBukkitEntity().getVelocity().toLocation(object.getBukkitEntity().getWorld())); | ||
|
|
@@ -1688,6 +1699,9 @@ else if (object.getLivingEntity() instanceof Steerable) { | |
| // @group location | ||
| // @description | ||
| // Returns the world the entity is in. Works with offline players. | ||
| // @example | ||
| // # Narrates the name of the world that the linked player is in. | ||
| // - narrate <player.world.name> | ||
| // --> | ||
| registerSpawnedOnlyTag(WorldTag.class, "world", (attribute, object) -> { | ||
| return new WorldTag(object.getBukkitEntity().getWorld()); | ||
|
|
@@ -2339,7 +2353,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()); | ||
|
|
@@ -3892,6 +3906,9 @@ public void adjust(Mechanism mechanism) { | |
| // Sets the entity's movement velocity vector. | ||
| // @tags | ||
| // <EntityTag.velocity> | ||
| // @example | ||
| // # Launches the player upwards. | ||
| // - adjust <player> velocity:0,1,0 | ||
| // --> | ||
| if (mechanism.matches("velocity") && mechanism.requireObject(LocationTag.class)) { | ||
| setVelocity(mechanism.valueAsType(LocationTag.class).toVector()); | ||
|
|
@@ -4655,3 +4672,4 @@ public boolean advancedMatches(String text, TagContext context) { | |
| return false; | ||
| } | ||
| } | ||
|
|
||
|
Contributor
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. Spare newline |
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Deprecated tags don't include the description of what they do intentionally.