i am an idiot 2: electric boogaloo

This commit is contained in:
Leijurv 2018-09-09 13:19:48 -07:00
parent d29a37664c
commit d8ca6cad4e
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 8 additions and 6 deletions

View File

@ -52,15 +52,14 @@ public interface MovementHelper extends ActionCosts, Helper {
int x = pos.getX(); int x = pos.getX();
int y = pos.getY(); int y = pos.getY();
int z = pos.getZ(); 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 return b == Blocks.ICE // ice becomes water, and water can mess up the path
|| b instanceof BlockSilverfish // obvious reasons || b instanceof BlockSilverfish // obvious reasons
// call BlockStateInterface.get directly with x,y,z. no need to make 5 new BlockPos for no reason // 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, y + 1, z).getBlock() 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).getBlock() instanceof BlockLiquid
|| BlockStateInterface.get(x - 1, y, z) instanceof BlockLiquid || BlockStateInterface.get(x - 1, y, z).getBlock() instanceof BlockLiquid
|| BlockStateInterface.get(x, y, z + 1) instanceof BlockLiquid || BlockStateInterface.get(x, y, z + 1).getBlock() instanceof BlockLiquid
|| BlockStateInterface.get(x, y, z - 1) instanceof BlockLiquid; || BlockStateInterface.get(x, y, z - 1).getBlock() instanceof BlockLiquid;
} }
/** /**

View File

@ -314,6 +314,9 @@ public class ExampleBaritoneControl extends Behavior {
if (msg.toLowerCase().equals("costs")) { if (msg.toLowerCase().equals("costs")) {
Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext()); Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext());
List<Movement> moves = new ArrayList<>(Arrays.asList(movements)); List<Movement> moves = new ArrayList<>(Arrays.asList(movements));
while (moves.contains(null)) {
moves.remove(null);
}
moves.sort(Comparator.comparingDouble(movement -> movement.getCost(new CalculationContext()))); moves.sort(Comparator.comparingDouble(movement -> movement.getCost(new CalculationContext())));
for (Movement move : moves) { for (Movement move : moves) {
String[] parts = move.getClass().toString().split("\\."); String[] parts = move.getClass().toString().split("\\.");