Skip to content
Open
Changes from 4 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,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".
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>
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

// - narrate <player.target.entity_type>
// -->
tagProcessor.registerTag(ElementTag.class, "entity_type", (attribute, object) -> {
if (NMSHandler.getVersion().isAtMost(NMSVersion.v1_19)) {
Expand Down Expand Up @@ -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:
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

// # - narrate True
// # - else:
// # - narrate False
// -->
tagProcessor.registerTag(ElementTag.class, "type", (attribute, object) -> {
return new ElementTag(object.getEntityType().getLowercaseName(), true);
Expand Down Expand Up @@ -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:
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

// - narrate True
// - else:
// - narrate False
// -->
registerSpawnedOnlyTag(ElementTag.class, "name", (attribute, object) -> {
return new ElementTag(object.getName(), true);
Expand Down Expand Up @@ -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>
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

// -->
registerSpawnedOnlyTag(LocationTag.class, "eye_location", (attribute, object) -> {
return new LocationTag(object.getEyeLocation());
Expand Down Expand Up @@ -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()));
Expand All @@ -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());
Expand Down Expand Up @@ -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).
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

// @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());
Expand Down Expand Up @@ -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());
Expand Down