diff --git a/src/main/java/baritone/behavior/ElytraBehavior.java b/src/main/java/baritone/behavior/ElytraBehavior.java index e745ad53c..d4608a705 100644 --- a/src/main/java/baritone/behavior/ElytraBehavior.java +++ b/src/main/java/baritone/behavior/ElytraBehavior.java @@ -386,7 +386,7 @@ public final class ElytraBehavior extends Behavior implements Helper { continue; } long b = System.currentTimeMillis(); - System.out.println("Solved pitch in " + (b - a) + " total time " + (b - t)); + //System.out.println("Solved pitch in " + (b - a) + " total time " + (b - t)); this.pathManager.setGoingTo(i); this.aimPos = path.get(i).add(0, dy, 0); baritone.getLookBehavior().updateTarget(new Rotation(rot.getYaw(), pitch), false); @@ -648,4 +648,4 @@ public final class ElytraBehavior extends Behavior implements Helper { } return null; } -} +} \ No newline at end of file diff --git a/src/main/java/baritone/behavior/elytra/NetherPathfinderContext.java b/src/main/java/baritone/behavior/elytra/NetherPathfinderContext.java index 1c512b9c2..2d407375a 100644 --- a/src/main/java/baritone/behavior/elytra/NetherPathfinderContext.java +++ b/src/main/java/baritone/behavior/elytra/NetherPathfinderContext.java @@ -100,7 +100,7 @@ public final class NetherPathfinderContext { for (int x = 0; x < 16; x++) { IBlockState state = bsc.get(x, y1, z); if (!passable(state)) { - packed[x + (z << 4) + (y << 8)] = true; + packed[x | (z << 4) | (y << 8)] = true; } } } @@ -112,4 +112,4 @@ public final class NetherPathfinderContext { throw new RuntimeException(e); } } -} +} \ No newline at end of file diff --git a/src/main/java/baritone/command/defaults/ElytraCommand.java b/src/main/java/baritone/command/defaults/ElytraCommand.java index 47db0e33e..1c9ee7882 100644 --- a/src/main/java/baritone/command/defaults/ElytraCommand.java +++ b/src/main/java/baritone/command/defaults/ElytraCommand.java @@ -22,6 +22,9 @@ import baritone.api.IBaritone; import baritone.api.command.Command; import baritone.api.command.argument.IArgConsumer; import baritone.api.command.exception.CommandException; +import baritone.api.command.exception.CommandInvalidStateException; +import baritone.api.pathing.goals.Goal; +import baritone.api.pathing.goals.GoalBlock; import baritone.api.pathing.goals.GoalXZ; import baritone.api.process.ICustomGoalProcess; import net.minecraft.util.math.BlockPos; @@ -40,8 +43,28 @@ public class ElytraCommand extends Command { public void execute(String label, IArgConsumer args) throws CommandException { ICustomGoalProcess customGoalProcess = baritone.getCustomGoalProcess(); args.requireMax(0); - GoalXZ goal = (GoalXZ) customGoalProcess.getGoal(); - ((Baritone) baritone).getElytraBehavior().path(new BlockPos(goal.getX(), 64, goal.getZ())); + Goal iGoal = customGoalProcess.getGoal(); + if (iGoal == null) { + throw new CommandInvalidStateException("No goal has been set"); + } + final int x, y, z; + if (iGoal instanceof GoalXZ) { + GoalXZ goal = (GoalXZ) iGoal; + x = goal.getX(); + y = 64; + z = goal.getZ(); + } else if (iGoal instanceof GoalBlock) { + GoalBlock goal = (GoalBlock) iGoal; + x = goal.x; + y = goal.y; + z = goal.z; + } else { + throw new CommandInvalidStateException("The goal must be a GoalXZ or GoalBlock"); + } + if (y <= 0 || y >= 128) { + throw new CommandInvalidStateException("The y of the goal is not between 0 and 128"); + } + ((Baritone) baritone).getElytraBehavior().path(new BlockPos(x, y, z)); } @Override @@ -58,4 +81,4 @@ public class ElytraCommand extends Command { public List getLongDesc() { return Arrays.asList(); } -} +} \ No newline at end of file