the material seems to hold state data for some reason.

- This requires a more complicated fix. Reverting this change for now
This commit is contained in:
dordsor21 2021-01-14 13:42:37 +00:00
parent 54712e268a
commit af34bd4e57
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -26,8 +26,10 @@ import com.boydti.fawe.util.StringMan;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extension.input.InputParseException; 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.Extent;
import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.extent.OutputExtent; import com.sk89q.worldedit.extent.OutputExtent;
@ -56,6 +58,7 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
private final int ordinal; private final int ordinal;
private final char ordinalChar; private final char ordinalChar;
private final BlockType blockType; private final BlockType blockType;
private BlockMaterial material;
private final BaseBlock emptyBaseBlock; private final BaseBlock emptyBaseBlock;
private CompoundInput compoundInput = CompoundInput.NULL; private CompoundInput compoundInput = CompoundInput.NULL;
@ -362,7 +365,16 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
@Override @Override
public BlockMaterial getMaterial() { 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 @Override