epic performance
This commit is contained in:
parent
b69acadca6
commit
a8ef421757
@ -48,14 +48,18 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
|
|
||||||
static boolean avoidBreaking(BlockPos pos, IBlockState state) {
|
static boolean avoidBreaking(BlockPos pos, IBlockState state) {
|
||||||
Block b = state.getBlock();
|
Block b = state.getBlock();
|
||||||
Block below = BlockStateInterface.get(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock();
|
int x = pos.getX();
|
||||||
return Blocks.ICE.equals(b) // ice becomes water, and water can mess up the path
|
int y = pos.getY();
|
||||||
|
int z = pos.getZ();
|
||||||
|
Block below = BlockStateInterface.get(x, y - 1, z).getBlock();
|
||||||
|
return b == Blocks.ICE // ice becomes water, and water can mess up the path
|
||||||
|| b instanceof BlockSilverfish // obvious reasons
|
|| b instanceof BlockSilverfish // obvious reasons
|
||||||
|| BlockStateInterface.isLiquid(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()))//don't break anything touching liquid on any side
|
// call BlockStateInterface.get directly with x,y,z. no need to make 5 new BlockPos for no reason
|
||||||
|| BlockStateInterface.isLiquid(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()))
|
|| BlockStateInterface.get(x, y + 1, z) instanceof BlockLiquid//don't break anything touching liquid on any side
|
||||||
|| BlockStateInterface.isLiquid(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()))
|
|| BlockStateInterface.get(x + 1, y, z) instanceof BlockLiquid
|
||||||
|| BlockStateInterface.isLiquid(new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1))
|
|| BlockStateInterface.get(x - 1, y, z) instanceof BlockLiquid
|
||||||
|| BlockStateInterface.isLiquid(new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1));
|
|| BlockStateInterface.get(x, y, z + 1) instanceof BlockLiquid
|
||||||
|
|| BlockStateInterface.get(x, y, z - 1) instanceof BlockLiquid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user