i am an idiot 2: electric boogaloo
This commit is contained in:
parent
d29a37664c
commit
d8ca6cad4e
@ -52,15 +52,14 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
int x = pos.getX();
|
||||
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
|
||||
// call BlockStateInterface.get directly with x,y,z. no need to make 5 new BlockPos for no reason
|
||||
|| BlockStateInterface.get(x, y + 1, z) instanceof BlockLiquid//don't break anything touching liquid on any side
|
||||
|| BlockStateInterface.get(x + 1, y, z) instanceof BlockLiquid
|
||||
|| BlockStateInterface.get(x - 1, y, z) instanceof BlockLiquid
|
||||
|| BlockStateInterface.get(x, y, z + 1) instanceof BlockLiquid
|
||||
|| BlockStateInterface.get(x, y, z - 1) instanceof BlockLiquid;
|
||||
|| BlockStateInterface.get(x, y + 1, z).getBlock() instanceof BlockLiquid//don't break anything touching liquid on any side
|
||||
|| BlockStateInterface.get(x + 1, y, z).getBlock() instanceof BlockLiquid
|
||||
|| BlockStateInterface.get(x - 1, y, z).getBlock() instanceof BlockLiquid
|
||||
|| BlockStateInterface.get(x, y, z + 1).getBlock() instanceof BlockLiquid
|
||||
|| BlockStateInterface.get(x, y, z - 1).getBlock() instanceof BlockLiquid;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -314,6 +314,9 @@ public class ExampleBaritoneControl extends Behavior {
|
||||
if (msg.toLowerCase().equals("costs")) {
|
||||
Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext());
|
||||
List<Movement> moves = new ArrayList<>(Arrays.asList(movements));
|
||||
while (moves.contains(null)) {
|
||||
moves.remove(null);
|
||||
}
|
||||
moves.sort(Comparator.comparingDouble(movement -> movement.getCost(new CalculationContext())));
|
||||
for (Movement move : moves) {
|
||||
String[] parts = move.getClass().toString().split("\\.");
|
||||
|
Loading…
Reference in New Issue
Block a user