Skip to content

Commit

Permalink
fix getName on unspawned entitytag instances
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 11, 2022
1 parent 6414972 commit 9b95a2a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Expand Up @@ -683,7 +683,7 @@ public String getName() {
if (entity instanceof Player) {
return entity.getName();
}
String customName = entity.getCustomName();
String customName = entity == null ? null : entity.getCustomName();
if (customName != null) {
return customName;
}
Expand Down
Expand Up @@ -65,7 +65,12 @@ public static void registerTags() {
if (val.startsWith("e@") || val.startsWith("n@")) {
EntityTag gotten = object.asType(EntityTag.class, attribute.context);
if (gotten != null) {
output.append(gotten.getName());
if (gotten.isValid()) {
output.append(gotten.getName());
}
else {
output.append(gotten.getEntityType().getName());
}
handled = true;
}
}
Expand Down
Expand Up @@ -242,6 +242,7 @@ public void adjust(Mechanism mechanism) {
// @description
// Sets the item's enchantments as a map of EnchantmentTags or enchantment names to level.
// For example: - inventory adjust slot:hand enchantments:sharpness=1
// Does not remove existing enchantments, for that use <@link mechanism ItemTag.remove_enchantments>
// @tags
// <ItemTag.enchantment_map>
// -->
Expand Down

0 comments on commit 9b95a2a

Please sign in to comment.