Merge pull request #743 from replaceitem/query-display-name

Made entity~'display_name' return a Formatted text
This commit is contained in:
gnembon authored and GitHub committed 2021-02-27 23:27:11 -04:00
commit aa372f5480
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -177,7 +177,7 @@ Returns `true` if en entity is standing on firm ground and falling down due to t
### `query(e, 'name'), query(e, 'display_name'), query(e, 'custom_name'), query(e, 'type')`
String of entity name
String of entity name or formatted text in the case of `display_name`
<pre>
query(e,'name') => Leatherworker
@@ -416,7 +416,7 @@ public class EntityValue extends Value
put("motion_z", (e, a) -> new NumericValue(e.getVelocity().z));
put("on_ground", (e, a) -> new NumericValue(e.isOnGround()));
put("name", (e, a) -> new StringValue(e.getName().getString()));
put("display_name", (e, a) -> new StringValue(e.getDisplayName().getString()));
put("display_name", (e, a) -> new FormattedTextValue(e.getDisplayName()));
put("command_name", (e, a) -> new StringValue(e.getEntityName()));
put("custom_name", (e, a) -> e.hasCustomName()?new StringValue(e.getCustomName().getString()):Value.NULL);
put("type", (e, a) -> new StringValue(nameFromRegistryId(Registry.ENTITY_TYPE.getId(e.getType()))));