Skip to content

Navigation Menu

Sign in
Sign up

Updating @example sections for several EntityTag Mechanism's and Tags. - #2813

Open
Skullfurious wants to merge 8 commits into
DenizenScript:dev from
Skullfurious:dev
Open

Updating @example sections for several EntityTag Mechanism's and Tags. #2813
Skullfurious wants to merge 8 commits into
DenizenScript:dev from
Skullfurious:dev

Conversation

@Skullfurious

@Skullfurious Skullfurious commented Feb 2, 2026

Copy link
Copy Markdown

This PR adds some missing @example sections to various Mechanisms and Tags.

Tags:

  • EntityTag.velocity
  • EntityTag.world
  • EntityTag.glowing
  • EntityTag.entity_type
  • EntityTag.type
  • EntityTag.name
  • EntityTag.eye_location

Mechanisms:

  • EntityTag Mechanism: velocity

CLAassistant commented Feb 2, 2026
edited
Loading

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

// @returns ElementTag
// @deprecated Use 'EntityTag.type' on MC 1.20+.
// @description
// Returns the entities type. NOTE: For NPC's it will say "PLAYER".

@mcmonkey4eva mcmonkey4eva Feb 2, 2026

Copy link
Copy Markdown
Member

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

// 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>

@mcmonkey4eva mcmonkey4eva Feb 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not need every example doc to tell you about the /ex command

// 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:

@mcmonkey4eva mcmonkey4eva Feb 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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

// @example
// # Checks if the player's name is "mcmonkey".
// # For use in game: /ex narrate <player.name.matches[mcmonkey]>
// - if <player.name> == mcmonkey:

@mcmonkey4eva mcmonkey4eva Feb 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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

// @example
// # Narrates the linked player's eye location.
// # /ex narrate <player.eye_location>
// - narrate <player.eye_location>

@mcmonkey4eva mcmonkey4eva Feb 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just narrating tags is not a very good example usage

Entity.world and velocity had examples that weren't very useable in their generated form.

Copy link
Copy Markdown
Author

Thanks for the feedback, I opened a thread on the discord.

// @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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if I'd put that in the meta, that's more of an implementation detail Mojang could change whenever they feel like

// 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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe label this as "going upwards"/"moving upwards" or something like that, this might be a bit misleading as it's not an actual jumping check.

// - narrate "The player is not jumping!"
// @example
// # Makes the player jump:
// - adjust <player> velocity:<location[0,1,0]>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this an example on the velocity tag? If anything it should be on the mechanism - also that constructor shouldn't be required.

@Skullfurious Skullfurious Feb 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were a few other tags that had examples using the adjust command as well. I believe in this case the generated example was not very usable since it was

- teleport <player> <player.velocity>

If you have a better example I could definitely change it. I was under the impression just using narrate was not a good example script as well.

Would something like this be better?

- if <player.velocity.y.is_more_than[0]>:
 - narrate "Player is ascending!"

@Skullfurious Skullfurious Feb 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize you could just pass in the raw values of value:0,1,0 haha I thought you had to pass a location tag explicitly.

// 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you test examples in-game to verify they work as expected, I.e. in this case I believe this will error because LocationTag.facing requires a parameter & returns a boolean.
Although you can just remove that entire destination arg here I believe? Keep the example as simple as possible.

@Skullfurious Skullfurious Feb 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean, I had debug off. I'll avoid doing that in the future. Thanks for catching that.

// @description
// Returns the world the entity is in. Works with offline players.
// @example
// # Narrates the world name that the linked player is in.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...the name of the world that...

// @group attributes
// @description
// Returns whether this entity is glowing.
// Returns whether this entity is glowing (Has an outline around them).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lowercase H here I believe

// Note: Does not accurately calculate player clientside movement velocity.
// @example
// # Checks if the player is jumping:
// - if <player.velocity.y.is_more_than[0]>:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Skullfurious Skullfurious Feb 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, just seen this after my previous comment. I was going down the list replying.

I'll fix that now but I was curious if there was a reason why it's a bad idea?

@mcmonkey4eva mcmonkey4eva Feb 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tag only exists to allow operators outside of the if command. The if command already can do - if <player.velocity.y> > 0: as the syntax

@mcmonkey4eva mcmonkey4eva Feb 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is also bad regardless, // Note: Does not accurately calculate player clientside movement velocity. player should not be used as an example on the velocity tag

@Skullfurious Skullfurious Feb 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does seem to track the vertical movement correctly just not the X and Y after my testing. Do you think I should use context.entity instead of player?

Comment on lines +1260 to +1261
// Returns the entities type.
// Note: For NPC's this will return the value "Player".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is deprecated, is there any reason you're adding back the meta?

@Skullfurious Skullfurious Feb 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly because I ran into an issue with EntityTag.type also throwing a deprecated error on NPC's and figured I would just document the behaviour since EntityTag.entity_type behaves differently than EntityTag.type (which says NPC).

I will remove it in the next commit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcmonkey4eva mcmonkey4eva mcmonkey4eva left review comments
@tal5 tal5 Awaiting requested review from tal5

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /