diff --git a/build.gradle b/build.gradle index d31ea10e..996a8e0f 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ */ group 'baritone' -version '1.1.5' +version '1.1.6' buildscript { repositories { diff --git a/scripts/proguard.pro b/scripts/proguard.pro index df6ad43a..e4189f7f 100644 --- a/scripts/proguard.pro +++ b/scripts/proguard.pro @@ -14,6 +14,7 @@ # lwjgl is weird -dontwarn org.lwjgl.opengl.GL14 +-dontwarn org.lwjgl.opengl.GL11 -keep class baritone.api.** { *; } # this is the keep api @@ -21,9 +22,6 @@ -keep class baritone.BaritoneProvider -keep class baritone.api.IBaritoneProvider -# hack --keep class baritone.utils.ExampleBaritoneControl { *; } # have to include this string to remove this keep in the standalone build: # this is the keep api - # setting names are reflected from field names, so keep field names -keepclassmembers class baritone.api.Settings { public ; diff --git a/src/api/java/baritone/api/IBaritone.java b/src/api/java/baritone/api/IBaritone.java index a2f414e7..538dd0c7 100644 --- a/src/api/java/baritone/api/IBaritone.java +++ b/src/api/java/baritone/api/IBaritone.java @@ -79,4 +79,11 @@ public interface IBaritone { IPlayerContext getPlayerContext(); IEventBus getGameEventHandler(); + + /** + * Call as soon as Minecraft is ready. + *

+ * Or whenever your overeager utility client wants. + */ + void init(); } diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 4e1cc9cd..2878e4d6 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -500,18 +500,18 @@ public final class Settings { *

* SOLID is rendered as stone in the overworld, netherrack in the nether, and end stone in the end */ - public Setting renderCachedChunks = new Setting<>(false); + public final Setting renderCachedChunks = new Setting<>(false); /** * 0.0f = not visible, fully transparent * 1.0f = fully opaque */ - public Setting cachedChunksOpacity = new Setting<>(0.5f); + public final Setting cachedChunksOpacity = new Setting<>(0.5f); /** * If true, Baritone will not allow you to left or right click while pathing */ - public Setting suppressClicks = new Setting<>(false); + public final Setting suppressClicks = new Setting<>(false); /** * Whether or not to use the "#" command prefix diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index b3b7b9ae..159abaf1 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -91,6 +91,7 @@ public class Baritone implements IBaritone { this.gameEventHandler = new GameEventHandler(this); } + @Override public synchronized void init() { if (initialized) { return; diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java index 8b115e90..b01f7c38 100644 --- a/src/main/java/baritone/behavior/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -103,7 +103,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior { @Override public void onPlayerRotationMove(RotationMoveEvent event) { - if (this.target != null && !this.force) { + if (this.target != null) { event.setYaw(this.target.getYaw()); diff --git a/src/main/java/baritone/cache/CachedWorld.java b/src/main/java/baritone/cache/CachedWorld.java index b604ce48..db85339d 100644 --- a/src/main/java/baritone/cache/CachedWorld.java +++ b/src/main/java/baritone/cache/CachedWorld.java @@ -45,7 +45,7 @@ public final class CachedWorld implements ICachedWorld, Helper { /** * The maximum number of regions in any direction from (0,0) */ - private static final int REGION_MAX = 58594; + private static final int REGION_MAX = 30_000_000 / 512 + 1; /** * A map of all of the cached regions. diff --git a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java index 3a86c158..0d0d0506 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java @@ -180,14 +180,21 @@ public class MovementAscend extends Movement { return state; } - if (headBonkClear()) { - return state.setInput(Input.JUMP, true); - } - int xAxis = Math.abs(src.getX() - dest.getX()); // either 0 or 1 int zAxis = Math.abs(src.getZ() - dest.getZ()); // either 0 or 1 double flatDistToNext = xAxis * Math.abs((dest.getX() + 0.5D) - ctx.player().posX) + zAxis * Math.abs((dest.getZ() + 0.5D) - ctx.player().posZ); double sideDist = zAxis * Math.abs((dest.getX() + 0.5D) - ctx.player().posX) + xAxis * Math.abs((dest.getZ() + 0.5D) - ctx.player().posZ); + + double lateralMotion = xAxis * ctx.player().motionZ + zAxis * ctx.player().motionX; + if (Math.abs(lateralMotion) > 0.1) { + return state; + } + + if (headBonkClear()) { + return state.setInput(Input.JUMP, true); + } + + // System.out.println(flatDistToNext + " " + sideDist); if (flatDistToNext > 1.2 || sideDist > 0.2) { return state; diff --git a/src/main/java/baritone/pathing/movement/movements/MovementFall.java b/src/main/java/baritone/pathing/movement/movements/MovementFall.java index b0674887..93f60f5d 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementFall.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementFall.java @@ -78,7 +78,7 @@ public class MovementFall extends Movement { } BlockPos playerFeet = ctx.playerFeet(); - Rotation toDest = RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest),ctx.playerRotations()); + Rotation toDest = RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest), ctx.playerRotations()); Rotation targetRotation = null; Block destBlock = ctx.world().getBlockState(dest).getBlock(); boolean isWater = destBlock == Blocks.WATER || destBlock == Blocks.FLOWING_WATER; @@ -141,7 +141,7 @@ public class MovementFall extends Movement { } if (targetRotation == null) { Vec3d destCenterOffset = new Vec3d(destCenter.x + 0.125 * avoid.getX(), destCenter.y, destCenter.z + 0.125 * avoid.getZ()); - state.setTarget(new MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), destCenterOffset,ctx.playerRotations()), false)); + state.setTarget(new MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), destCenterOffset, ctx.playerRotations()), false)); } return state; } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java index bb94fa30..2ce03d69 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java @@ -160,7 +160,7 @@ public class MovementPillar extends Movement { IBlockState fromDown = BlockStateInterface.get(ctx, src); if (MovementHelper.isWater(fromDown.getBlock()) && MovementHelper.isWater(ctx, dest)) { // stay centered while swimming up a water column - state.setTarget(new MovementState.MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest),ctx.playerRotations()), false)); + state.setTarget(new MovementState.MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest), ctx.playerRotations()), false)); Vec3d destCenter = VecUtils.getBlockPosCenter(dest); if (Math.abs(ctx.player().posX - destCenter.x) > 0.2 || Math.abs(ctx.player().posZ - destCenter.z) > 0.2) { state.setInput(Input.MOVE_FORWARD, true); diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index fa47ce21..30a2a26e 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -179,7 +179,7 @@ public class MovementTraverse extends Movement { float pitchToBreak = state.getTarget().getRotation().get().getPitch(); state.setTarget(new MovementState.MovementTarget(new Rotation(yawToDest, pitchToBreak), true)); - return state.setInput(Input.MOVE_FORWARD, true); + return state.setInput(Input.MOVE_FORWARD, true).setInput(Input.SPRINT, true); } //sneak may have been set to true in the PREPPING state while mining an adjacent block diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 1a221af3..d4897eec 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -479,6 +479,9 @@ public class PathExecutor implements IPathExecutor, Helper { if (dir.getY() < -3) { return null; } + if (!movement.toBreakCached.isEmpty()) { + return null; // it's breaking + } Vec3i flatDir = new Vec3i(dir.getX(), 0, dir.getZ()); int i; outer: @@ -538,6 +541,12 @@ public class PathExecutor implements IPathExecutor, Helper { if (!MovementHelper.canWalkOn(ctx, current.getDest().down())) { return false; } + if (!MovementHelper.canWalkOn(ctx, next.getDest().down())) { + return false; + } + if (!next.toBreakCached.isEmpty()) { + return false; // it's breaking + } for (int x = 0; x < 2; x++) { for (int y = 0; y < 3; y++) { BlockPos chk = current.getSrc().up(y); diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index e9dbb726..ccca14ba 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -78,7 +78,8 @@ public class ExampleBaritoneControl extends Behavior implements Helper { "sethome - Sets \"home\"\n" + "home - Paths towards \"home\" \n" + "costs - (debug) all movement costs from current location\n" + - "damn - Daniel "; + "damn - Daniel\n" + + "Go to https://github.com/cabaletta/baritone/blob/master/USAGE.md for more information"; private static final String COMMAND_PREFIX = "#"; diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index 9f07efdf..06e298be 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -57,8 +57,6 @@ public final class PathRenderer implements Helper { private PathRenderer() {} public static void render(RenderEvent event, PathingBehavior behavior) { - // System.out.println("Render passing"); - // System.out.println(event.getPartialTicks()); float partialTicks = event.getPartialTicks(); Goal goal = behavior.getGoal(); @@ -80,7 +78,7 @@ public final class PathRenderer implements Helper { } if (goal != null && Baritone.settings().renderGoal.value) { - drawLitDankGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.get()); + drawDankLitGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.get()); } if (!Baritone.settings().renderPath.get()) { return; @@ -261,7 +259,7 @@ public final class PathRenderer implements Helper { GlStateManager.disableBlend(); } - public static void drawLitDankGoalBox(Entity player, Goal goal, float partialTicks, Color color) { + public static void drawDankLitGoalBox(Entity player, Goal goal, float partialTicks, Color color) { double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks; double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks; double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks; @@ -297,6 +295,8 @@ public final class PathRenderer implements Helper { GoalXZ goalPos = (GoalXZ) goal; if (Baritone.settings().renderGoalXZBeacon.get()) { + glPushAttrib(GL_LIGHTING_BIT); + mc.getTextureManager().bindTexture(TileEntityBeaconRenderer.TEXTURE_BEACON_BEAM); if (Baritone.settings().renderGoalIgnoreDepth.get()) { @@ -318,6 +318,8 @@ public final class PathRenderer implements Helper { if (Baritone.settings().renderGoalIgnoreDepth.get()) { GlStateManager.enableDepth(); } + + glPopAttrib(); return; } @@ -332,7 +334,7 @@ public final class PathRenderer implements Helper { maxY = 256 - renderPosY; } else if (goal instanceof GoalComposite) { for (Goal g : ((GoalComposite) goal).goals()) { - drawLitDankGoalBox(player, g, partialTicks, color); + drawDankLitGoalBox(player, g, partialTicks, color); } return; } else { diff --git a/src/main/java/baritone/utils/PathingControlManager.java b/src/main/java/baritone/utils/PathingControlManager.java index fa9cc34f..b13d9fc6 100644 --- a/src/main/java/baritone/utils/PathingControlManager.java +++ b/src/main/java/baritone/utils/PathingControlManager.java @@ -82,6 +82,7 @@ public class PathingControlManager implements IPathingControlManager { public void preTick() { inControlLastTick = inControlThisTick; + inControlThisTick = null; PathingBehavior p = baritone.getPathingBehavior(); command = executeProcesses(); if (command == null) { diff --git a/src/main/java/baritone/utils/PlayerMovementInput.java b/src/main/java/baritone/utils/PlayerMovementInput.java index 4ffbef2b..c2e2db2a 100644 --- a/src/main/java/baritone/utils/PlayerMovementInput.java +++ b/src/main/java/baritone/utils/PlayerMovementInput.java @@ -31,7 +31,7 @@ public class PlayerMovementInput extends MovementInput { this.moveStrafe = 0.0F; this.moveForward = 0.0F; - jump = handler.isInputForcedDown(Input.JUMP); // oppa + jump = handler.isInputForcedDown(Input.JUMP); // oppa gangnam if (this.forwardKeyDown = handler.isInputForcedDown(Input.MOVE_FORWARD)) { this.moveForward++;