From af34bd4e577388cc59c401b49ee0b0ad99c87bd9 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 14 Jan 2021 13:42:37 +0000 Subject: [PATCH] the material seems to hold state data for some reason. - This requires a more complicated fix. Reverting this change for now --- .../sk89q/worldedit/world/block/BlockState.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index 2efd1c5cd..26374e495 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -26,8 +26,10 @@ import com.boydti.fawe.util.StringMan; import com.google.common.base.Function; import com.google.common.collect.Maps; import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.extent.OutputExtent; @@ -56,6 +58,7 @@ public class BlockState implements BlockStateHolder, Pattern { private final int ordinal; private final char ordinalChar; private final BlockType blockType; + private BlockMaterial material; private final BaseBlock emptyBaseBlock; private CompoundInput compoundInput = CompoundInput.NULL; @@ -362,7 +365,16 @@ public class BlockState implements BlockStateHolder, Pattern { @Override public BlockMaterial getMaterial() { - return blockType.getMaterial(); + if (this.material == null) { + if (blockType == BlockTypes.__RESERVED__) { + return this.material = blockType.getMaterial(); + } + this.material = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(this); + if (this.material.hasContainer()) { + this.compoundInput = CompoundInput.CONTAINER; + } + } + return material; } @Override