From 9f3a451ef6604ddb754918a6b392d771fabe364d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 31 Jul 2021 14:18:04 +0200 Subject: [PATCH] Fixes #756 --- .../com/sk89q/worldedit/world/block/BlockType.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 9f2758224..7bbabfc35 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -63,6 +63,9 @@ public class BlockType implements Keyed, Pattern { private final BlockTypesCache.Settings settings; private final LazyReference emptyFuzzy = LazyReference.from(() -> new FuzzyBlockState(this)); + @Deprecated + private final LazyReference name = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager() + .queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getName(this)); //FAWE start private final LazyReference legacyId = LazyReference.from(() -> computeLegacy(0)); @@ -120,6 +123,7 @@ public class BlockType implements Keyed, Pattern { String id = getId(); return id.substring(id.indexOf(':') + 1); } + //FAWE end /** * Gets the name of this block, or the ID if the name cannot be found. @@ -129,7 +133,11 @@ public class BlockType implements Keyed, Pattern { */ @Deprecated public String getName() { - return getRichName().toString(); + String name = this.name.getValue(); + if (name == null || name.isEmpty()) { + return getId(); + } + return name; } /*