mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Delegate to blocktype for obtaining a BlockState's material
This commit is contained in:
parent
ac73478827
commit
5e1289494e
@ -26,10 +26,8 @@ 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;
|
||||
@ -58,7 +56,6 @@ public class BlockState implements BlockStateHolder<BlockState>, 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;
|
||||
|
||||
@ -75,7 +72,6 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
||||
* @deprecated Magic Numbers
|
||||
* @return BlockState
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
public static BlockState getFromInternalId(int combinedId) throws InputParseException {
|
||||
return BlockTypes.getFromStateId(combinedId).withStateId(combinedId);
|
||||
@ -366,16 +362,7 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
||||
|
||||
@Override
|
||||
public BlockMaterial 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;
|
||||
return blockType.getMaterial();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -408,11 +395,7 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
||||
}
|
||||
|
||||
public boolean isAir() {
|
||||
try {
|
||||
return material.isAir();
|
||||
} catch (NullPointerException ignored) {
|
||||
return getMaterial().isAir();
|
||||
}
|
||||
return blockType.getMaterial().isAir();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user