Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 08:02:50 +02:00
Delegate to blocktype for obtaining a BlockState's material
Dieser Commit ist enthalten in:
Ursprung
ac73478827
Commit
5e1289494e
@ -26,10 +26,8 @@ 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;
|
||||||
@ -58,7 +56,6 @@ 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;
|
||||||
|
|
||||||
@ -75,7 +72,6 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
|||||||
* @deprecated Magic Numbers
|
* @deprecated Magic Numbers
|
||||||
* @return BlockState
|
* @return BlockState
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static BlockState getFromInternalId(int combinedId) throws InputParseException {
|
public static BlockState getFromInternalId(int combinedId) throws InputParseException {
|
||||||
return BlockTypes.getFromStateId(combinedId).withStateId(combinedId);
|
return BlockTypes.getFromStateId(combinedId).withStateId(combinedId);
|
||||||
@ -366,16 +362,7 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockMaterial getMaterial() {
|
public BlockMaterial getMaterial() {
|
||||||
if (this.material == null) {
|
return blockType.getMaterial();
|
||||||
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
|
||||||
@ -408,11 +395,7 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAir() {
|
public boolean isAir() {
|
||||||
try {
|
return blockType.getMaterial().isAir();
|
||||||
return material.isAir();
|
|
||||||
} catch (NullPointerException ignored) {
|
|
||||||
return getMaterial().isAir();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren