From e6c574063e86547d07e2c27db4004668fd2e855d Mon Sep 17 00:00:00 2001 From: Brady Date: Tue, 11 Sep 2018 17:37:26 -0500 Subject: [PATCH 001/120] Prevent flying capabilities when pathing, fixes #130 --- src/main/java/baritone/behavior/impl/PathingBehavior.java | 1 + src/main/java/baritone/pathing/path/PathExecutor.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/baritone/behavior/impl/PathingBehavior.java b/src/main/java/baritone/behavior/impl/PathingBehavior.java index cd4cf357..f5c81acd 100644 --- a/src/main/java/baritone/behavior/impl/PathingBehavior.java +++ b/src/main/java/baritone/behavior/impl/PathingBehavior.java @@ -196,6 +196,7 @@ public class PathingBehavior extends Behavior { next = null; Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(AbstractNodeCostSearch::cancel); + mc.playerController.setPlayerCapabilities(mc.player); } /** diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 5a8af7db..e59d9aa7 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -236,6 +236,7 @@ public class PathExecutor implements Helper { Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); return true; } + player().capabilities.allowFlying = false; MovementState.MovementStatus movementStatus = movement.update(); if (movementStatus == UNREACHABLE || movementStatus == FAILED) { logDebug("Movement returns status " + movementStatus); From 1bf34d42e2f88d3bc8eb0924b4ff1984a83447b3 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 11 Sep 2018 15:50:46 -0700 Subject: [PATCH 002/120] added maxCostIncrease, fixes #154 --- src/main/java/baritone/Settings.java | 6 ++++++ src/main/java/baritone/pathing/path/PathExecutor.java | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index bfab655e..c2a618b9 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -144,6 +144,12 @@ public class Settings { */ public Setting cutoffAtLoadBoundary = new Setting<>(false); + /** + * If a movement's cost increases by more than this amount between calculation and execution (due to changes + * in the environment / world), cancel and recalculate + */ + public Setting maxCostIncrease = new Setting<>(10D); + /** * Stop 5 movements before anything that made the path COST_INF. * For example, if lava has spread across the path, don't walk right up to it then recalculate, it might diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index e59d9aa7..93e12e09 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -236,6 +236,13 @@ public class PathExecutor implements Helper { Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); return true; } + if (currentCost - currentMovementInitialCostEstimate > Baritone.settings().maxCostIncrease.get()) { + logDebug("Original cost " + currentMovementInitialCostEstimate + " current cost " + currentCost + ". Cancelling."); + pathPosition = path.length() + 3; + failed = true; + Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); + return true; + } player().capabilities.allowFlying = false; MovementState.MovementStatus movementStatus = movement.update(); if (movementStatus == UNREACHABLE || movementStatus == FAILED) { From acd9cecd669f1ab23d28de58e542d3949e6f846d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 11 Sep 2018 18:26:10 -0700 Subject: [PATCH 003/120] improve path safety --- .../behavior/impl/PathingBehavior.java | 10 +++++-- .../java/baritone/pathing/path/IPath.java | 29 +------------------ .../baritone/pathing/path/PathExecutor.java | 13 +++++++++ 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/src/main/java/baritone/behavior/impl/PathingBehavior.java b/src/main/java/baritone/behavior/impl/PathingBehavior.java index f5c81acd..8ce34ecc 100644 --- a/src/main/java/baritone/behavior/impl/PathingBehavior.java +++ b/src/main/java/baritone/behavior/impl/PathingBehavior.java @@ -40,7 +40,7 @@ import java.awt.*; import java.util.Collections; import java.util.Optional; -public class PathingBehavior extends Behavior { +public final class PathingBehavior extends Behavior { public static final PathingBehavior INSTANCE = new PathingBehavior(); @@ -66,7 +66,7 @@ public class PathingBehavior extends Behavior { @Override public void onTick(TickEvent event) { if (event.getType() == TickEvent.Type.OUT) { - this.cancel(); + softCancel(); // no player, so can't fix capabilities return; } if (current == null) { @@ -191,11 +191,15 @@ public class PathingBehavior extends Behavior { return Optional.ofNullable(current).map(PathExecutor::getPath); } - public void cancel() { + private void softCancel() { current = null; next = null; Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(AbstractNodeCostSearch::cancel); + } + + public void cancel() { + softCancel(); mc.playerController.setPlayerCapabilities(mc.player); } diff --git a/src/main/java/baritone/pathing/path/IPath.java b/src/main/java/baritone/pathing/path/IPath.java index 0db487d5..575aacb1 100644 --- a/src/main/java/baritone/pathing/path/IPath.java +++ b/src/main/java/baritone/pathing/path/IPath.java @@ -58,33 +58,6 @@ public interface IPath extends Helper { return positions().size(); } - /** - * What's the next step - * - * @param currentPosition the current position - * @return - */ - default Movement subsequentMovement(BlockPos currentPosition) { - List pos = positions(); - List movements = movements(); - for (int i = 0; i < pos.size(); i++) { - if (currentPosition.equals(pos.get(i))) { - return movements.get(i); - } - } - throw new UnsupportedOperationException(currentPosition + " not in path"); - } - - /** - * Determines whether or not a position is within this path. - * - * @param pos The position to check - * @return Whether or not the specified position is in this class - */ - default boolean isInPath(BlockPos pos) { - return positions().contains(pos); - } - default Tuple closestPathPos(double x, double y, double z) { double best = -1; BlockPos bestPos = null; @@ -146,7 +119,7 @@ public interface IPath extends Helper { } double factor = Baritone.settings().pathCutoffFactor.get(); int newLength = (int) (length() * factor); - //logDebug("Static cutoff " + length() + " to " + newLength); + logDebug("Static cutoff " + length() + " to " + newLength); return new CutoffPath(this, newLength); } } diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 93e12e09..ab132ca0 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -291,6 +291,19 @@ public class PathExecutor implements Helper { } Movement movement = path.movements().get(pathPosition); if (movement instanceof MovementDescend && pathPosition < path.length() - 2) { + BlockPos descendStart = movement.getSrc(); + BlockPos descendEnd = movement.getDest(); + BlockPos into = descendEnd.subtract(descendStart.down()).add(descendEnd); + if (into.getY() != descendEnd.getY()) { + throw new IllegalStateException(); // sanity check + } + for (int i = 0; i <= 2; i++) { + if (MovementHelper.avoidWalkingInto(BlockStateInterface.getBlock(into.up(i)))) { + logDebug("Sprinting would be unsafe"); + player().setSprinting(false); + return; + } + } Movement next = path.movements().get(pathPosition + 1); if (next instanceof MovementDescend) { if (next.getDirection().equals(movement.getDirection())) { From 9334cf1dd45b30c98c3d874234eb90ec40d3f230 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 11 Sep 2018 18:33:03 -0700 Subject: [PATCH 004/120] stop walking into liquids, fixes #155 --- src/main/java/baritone/cache/ChunkPacker.java | 2 +- src/main/java/baritone/pathing/movement/MovementHelper.java | 3 ++- .../baritone/pathing/movement/movements/MovementParkour.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index 7167df34..9dffe5ae 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -152,7 +152,7 @@ public final class ChunkPacker implements Helper { return PathingBlockType.WATER; } - if (MovementHelper.avoidWalkingInto(block) || block.equals(Blocks.FLOWING_WATER) || MovementHelper.isBottomSlab(state)) { + if (MovementHelper.avoidWalkingInto(block) || block == Blocks.FLOWING_WATER || MovementHelper.isBottomSlab(state)) { return PathingBlockType.AVOID; } // We used to do an AABB check here diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 6aab4bd5..3f68cba6 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -209,7 +209,8 @@ public interface MovementHelper extends ActionCosts, Helper { } static boolean avoidWalkingInto(Block block) { - return BlockStateInterface.isLava(block) + return block instanceof BlockLiquid + || block instanceof BlockDynamicLiquid || block == Blocks.MAGMA || block == Blocks.CACTUS || block == Blocks.FIRE diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 07126ca1..24f8883f 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -52,7 +52,7 @@ public class MovementParkour extends Movement { } BlockPos adjBlock = src.down().offset(dir); IBlockState adj = BlockStateInterface.get(adjBlock); - if (MovementHelper.avoidWalkingInto(adj.getBlock())) { // magma sucks + if (MovementHelper.avoidWalkingInto(adj.getBlock()) && adj.getBlock() != Blocks.WATER && adj.getBlock() != Blocks.FLOWING_WATER) { // magma sucks return null; } if (MovementHelper.canWalkOn(adjBlock, adj)) { // don't parkour if we could just traverse (for now) From 0412298555094c905837618c8ec2e2123a6fd9ba Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 11 Sep 2018 19:05:45 -0700 Subject: [PATCH 005/120] don't try to place against water, actually fixes #155 --- .../baritone/pathing/movement/movements/MovementTraverse.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index 67430d05..9ee084ae 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -115,6 +115,9 @@ public class MovementTraverse extends Movement { if (srcDown == Blocks.SOUL_SAND || (srcDown instanceof BlockSlab && !((BlockSlab) srcDown).isDouble())) { return COST_INF; // can't sneak and backplace against soul sand or half slabs =/ } + if (srcDown == Blocks.FLOWING_WATER || srcDown == Blocks.WATER) { + return COST_INF; // this is obviously impossible + } WC = WC * SNEAK_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST;//since we are placing, we are sneaking return WC + context.placeBlockCost() + getTotalHardnessOfBlocksToBreak(context); } From 3afc77bc9a1e711ef4228437e1f694c091418827 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 11 Sep 2018 19:39:47 -0700 Subject: [PATCH 006/120] fix infinite recalc when jumping over flowing water --- .../pathing/movement/movements/MovementParkour.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 24f8883f..a53a4d32 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -25,6 +25,7 @@ import baritone.pathing.movement.MovementState; import baritone.utils.BlockStateInterface; import baritone.utils.InputOverrideHandler; import baritone.utils.pathing.BetterBlockPos; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; @@ -43,6 +44,7 @@ public class MovementParkour extends Movement { } public static MovementParkour generate(BetterBlockPos src, EnumFacing dir) { + // MUST BE KEPT IN SYNC WITH calculateCost if (!Baritone.settings().allowParkour.get()) { return null; } @@ -101,10 +103,12 @@ public class MovementParkour extends Movement { @Override protected double calculateCost(CalculationContext context) { + // MUST BE KEPT IN SYNC WITH generate if (!MovementHelper.canWalkOn(dest.down())) { return COST_INF; } - if (MovementHelper.avoidWalkingInto(BlockStateInterface.get(src.down().offset(direction)).getBlock())) { + Block walkOff = BlockStateInterface.get(src.down().offset(direction)).getBlock(); + if (MovementHelper.avoidWalkingInto(walkOff) && walkOff != Blocks.WATER && walkOff != Blocks.FLOWING_WATER) { return COST_INF; } for (int i = 1; i <= 4; i++) { From 5669204b4a89159fc59164dd239ba8722372b092 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 11 Sep 2018 20:09:53 -0700 Subject: [PATCH 007/120] skynet --- .../pathing/calc/AStarPathFinder.java | 8 +- .../movement/movements/MovementParkour.java | 84 ++++++++++++++++++- 2 files changed, 85 insertions(+), 7 deletions(-) diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index 16bc1997..643df531 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -243,10 +243,10 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { new MovementDiagonal(pos, EnumFacing.SOUTH, EnumFacing.WEST), - MovementParkour.generate(pos, EnumFacing.EAST), - MovementParkour.generate(pos, EnumFacing.WEST), - MovementParkour.generate(pos, EnumFacing.NORTH), - MovementParkour.generate(pos, EnumFacing.SOUTH), + MovementParkour.generate(pos, EnumFacing.EAST, calcContext), + MovementParkour.generate(pos, EnumFacing.WEST, calcContext), + MovementParkour.generate(pos, EnumFacing.NORTH, calcContext), + MovementParkour.generate(pos, EnumFacing.SOUTH, calcContext), }; } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index a53a4d32..61056ff2 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -18,20 +18,28 @@ package baritone.pathing.movement.movements; import baritone.Baritone; +import baritone.behavior.impl.LookBehaviorUtils; import baritone.pathing.movement.CalculationContext; import baritone.pathing.movement.Movement; import baritone.pathing.movement.MovementHelper; import baritone.pathing.movement.MovementState; import baritone.utils.BlockStateInterface; import baritone.utils.InputOverrideHandler; +import baritone.utils.Utils; import baritone.utils.pathing.BetterBlockPos; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + +import java.util.Objects; public class MovementParkour extends Movement { + protected static final EnumFacing[] HORIZONTALS_BUT_ALSO_DOWN_SO_EVERY_DIRECTION_EXCEPT_UP = {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.DOWN}; + final EnumFacing direction; final int dist; @@ -43,7 +51,7 @@ public class MovementParkour extends Movement { super.override(costFromJumpDistance(dist)); } - public static MovementParkour generate(BetterBlockPos src, EnumFacing dir) { + public static MovementParkour generate(BetterBlockPos src, EnumFacing dir, CalculationContext context) { // MUST BE KEPT IN SYNC WITH calculateCost if (!Baritone.settings().allowParkour.get()) { return null; @@ -85,6 +93,27 @@ public class MovementParkour extends Movement { return new MovementParkour(src, i, dir); } } + BlockPos dest = src.offset(dir, 4); + BlockPos positionToPlace = dest.down(); + IBlockState toPlace = BlockStateInterface.get(positionToPlace); + if (!context.hasThrowaway()) { + return null; + } + if (toPlace.getBlock() != Blocks.AIR && !BlockStateInterface.isWater(toPlace.getBlock()) && !MovementHelper.isReplacable(positionToPlace, toPlace)) { + return null; + } + for (int i = 0; i < 5; i++) { + BlockPos against1 = positionToPlace.offset(HORIZONTALS_BUT_ALSO_DOWN_SO_EVERY_DIRECTION_EXCEPT_UP[i]); + if (against1.up().equals(src.offset(dir, 3))) { // we can't turn around that fast + continue; + } + if (MovementHelper.canPlaceAgainst(against1)) { + // holy jesus we gonna do it + MovementParkour ret = new MovementParkour(src, 4, dir); + ret.override(costFromJumpDistance(4) + context.placeBlockCost()); + return ret; + } + } return null; } @@ -104,8 +133,30 @@ public class MovementParkour extends Movement { @Override protected double calculateCost(CalculationContext context) { // MUST BE KEPT IN SYNC WITH generate + boolean placing = false; if (!MovementHelper.canWalkOn(dest.down())) { - return COST_INF; + if (dist != 4) { + return COST_INF; + } + BlockPos positionToPlace = dest.down(); + IBlockState toPlace = BlockStateInterface.get(positionToPlace); + if (!context.hasThrowaway()) { + return COST_INF; + } + if (toPlace.getBlock() != Blocks.AIR && !BlockStateInterface.isWater(toPlace.getBlock()) && !MovementHelper.isReplacable(positionToPlace, toPlace)) { + return COST_INF; + } + for (int i = 0; i < 5; i++) { + BlockPos against1 = positionToPlace.offset(HORIZONTALS_BUT_ALSO_DOWN_SO_EVERY_DIRECTION_EXCEPT_UP[i]); + if (against1.up().equals(src.offset(direction, 3))) { // we can't turn around that fast + continue; + } + if (MovementHelper.canPlaceAgainst(against1)) { + // holy jesus we gonna do it + placing = true; + break; + } + } } Block walkOff = BlockStateInterface.get(src.down().offset(direction)).getBlock(); if (MovementHelper.avoidWalkingInto(walkOff) && walkOff != Blocks.WATER && walkOff != Blocks.FLOWING_WATER) { @@ -119,7 +170,7 @@ public class MovementParkour extends Movement { } } if (d.equals(dest)) { - return costFromJumpDistance(i); + return costFromJumpDistance(i) + (placing ? context.placeBlockCost() : 0); } } throw new IllegalStateException("invalid jump distance?"); @@ -146,6 +197,33 @@ public class MovementParkour extends Movement { } } else if (!playerFeet().equals(src)) { if (playerFeet().equals(src.offset(direction)) || player().posY - playerFeet().getY() > 0.0001) { + + if (!MovementHelper.canWalkOn(dest.down())) { + BlockPos positionToPlace = dest.down(); + for (int i = 0; i < 5; i++) { + BlockPos against1 = positionToPlace.offset(HORIZONTALS_BUT_ALSO_DOWN_SO_EVERY_DIRECTION_EXCEPT_UP[i]); + if (against1.up().equals(src.offset(direction, 3))) { // we can't turn around that fast + continue; + } + if (MovementHelper.canPlaceAgainst(against1)) { + if (!MovementHelper.throwaway(true)) {//get ready to place a throwaway block + return state.setStatus(MovementState.MovementStatus.UNREACHABLE); + } + double faceX = (dest.getX() + against1.getX() + 1.0D) * 0.5D; + double faceY = (dest.getY() + against1.getY()) * 0.5D; + double faceZ = (dest.getZ() + against1.getZ() + 1.0D) * 0.5D; + state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), new Vec3d(faceX, faceY, faceZ), playerRotations()), true)); + EnumFacing side = Minecraft.getMinecraft().objectMouseOver.sideHit; + + LookBehaviorUtils.getSelectedBlock().ifPresent(selectedBlock -> { + if (Objects.equals(selectedBlock, against1) && selectedBlock.offset(side).equals(dest.down())) { + state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); + } + }); + } + } + } + state.setInput(InputOverrideHandler.Input.JUMP, true); } else { state.setInput(InputOverrideHandler.Input.SPRINT, false); From e82f6b8e35377120372659c3f3bf62834821eb65 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 11 Sep 2018 20:24:27 -0700 Subject: [PATCH 008/120] assumeStep --- src/main/java/baritone/Settings.java | 5 +++++ .../baritone/pathing/movement/movements/MovementAscend.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index c2a618b9..1f18219e 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -62,6 +62,11 @@ public class Settings { */ public Setting assumeWalkOnWater = new Setting<>(false); + /** + * Assume step functionality; don't jump on an Ascend. + */ + public Setting assumeStep = new Setting<>(false); + /** * Blocks that Baritone is allowed to place (as throwaway, for sneak bridging, pillaring, etc.) */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java index 9ddb7760..60591d88 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java @@ -17,6 +17,7 @@ package baritone.pathing.movement.movements; +import baritone.Baritone; import baritone.behavior.impl.LookBehaviorUtils; import baritone.pathing.movement.CalculationContext; import baritone.pathing.movement.Movement; @@ -177,6 +178,10 @@ public class MovementAscend extends Movement { } } + if (Baritone.settings().assumeStep.get()) { + return state; + } + if (headBonkClear()) { return state.setInput(InputOverrideHandler.Input.JUMP, true); } From 7f983c92f40387e698eb982015334e0fbe4690bd Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 11 Sep 2018 20:50:29 -0700 Subject: [PATCH 009/120] assumeSafeWalk --- src/main/java/baritone/Settings.java | 9 +++++++++ .../pathing/movement/movements/MovementTraverse.java | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 1f18219e..d29ec995 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -67,6 +67,15 @@ public class Settings { */ public Setting assumeStep = new Setting<>(false); + /** + * Assume safe walk functionality; don't sneak on a backplace traverse. + *

+ * Warning: if you do something janky like sneak-backplace from an ender chest, if this is true + * it won't sneak right click, it'll just right click, which means it'll open the chest instead of placing + * against it. That's why this defaults to off. + */ + public Setting assumeSafeWalk = new Setting<>(false); + /** * Blocks that Baritone is allowed to place (as throwaway, for sneak bridging, pillaring, etc.) */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index 9ee084ae..df0f3a27 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -17,6 +17,7 @@ package baritone.pathing.movement.movements; +import baritone.Baritone; import baritone.behavior.impl.LookBehaviorUtils; import baritone.pathing.movement.CalculationContext; import baritone.pathing.movement.Movement; @@ -209,7 +210,9 @@ public class MovementTraverse extends Movement { logDebug("bb pls get me some blocks. dirt or cobble"); return state.setStatus(MovementState.MovementStatus.UNREACHABLE); } - state.setInput(InputOverrideHandler.Input.SNEAK, true); + if (!Baritone.settings().assumeSafeWalk.get()) { + state.setInput(InputOverrideHandler.Input.SNEAK, true); + } Block standingOn = BlockStateInterface.get(playerFeet().down()).getBlock(); if (standingOn.equals(Blocks.SOUL_SAND) || standingOn instanceof BlockSlab) { // see issue #118 double dist = Math.max(Math.abs(dest.getX() + 0.5 - player().posX), Math.abs(dest.getZ() + 0.5 - player().posZ)); @@ -238,7 +241,9 @@ public class MovementTraverse extends Movement { return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true); } } - state.setInput(InputOverrideHandler.Input.SNEAK, true); + if (!Baritone.settings().assumeSafeWalk.get()) { + state.setInput(InputOverrideHandler.Input.SNEAK, true); + } if (whereAmI.equals(dest)) { // If we are in the block that we are trying to get to, we are sneaking over air and we need to place a block beneath us against the one we just walked off of // Out.log(from + " " + to + " " + faceX + "," + faceY + "," + faceZ + " " + whereAmI); From 39a3c1cd4ac23b3a68f1c60709cc06c6bbe0f72c Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 12 Sep 2018 07:55:40 -0700 Subject: [PATCH 010/120] oh my god --- src/main/java/baritone/pathing/movement/ActionCosts.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/ActionCosts.java b/src/main/java/baritone/pathing/movement/ActionCosts.java index 9baff727..3be99c9f 100644 --- a/src/main/java/baritone/pathing/movement/ActionCosts.java +++ b/src/main/java/baritone/pathing/movement/ActionCosts.java @@ -24,8 +24,8 @@ public interface ActionCosts extends ActionCostsButOnlyTheOnesThatMakeMickeyDieI */ double WALK_ONE_BLOCK_COST = 20 / 4.317; // 4.633 double WALK_ONE_IN_WATER_COST = 20 / 2.2; - double WALK_ONE_OVER_SOUL_SAND_COST = WALK_ONE_BLOCK_COST * 0.5; // 0.4 in BlockSoulSand but effectively about half - double SPRINT_ONE_OVER_SOUL_SAND_COST = WALK_ONE_OVER_SOUL_SAND_COST / 0.75; + double WALK_ONE_OVER_SOUL_SAND_COST = WALK_ONE_BLOCK_COST * 2; // 0.4 in BlockSoulSand but effectively about half + double SPRINT_ONE_OVER_SOUL_SAND_COST = WALK_ONE_OVER_SOUL_SAND_COST * 0.75; double LADDER_UP_ONE_COST = 20 / 2.35; double LADDER_DOWN_ONE_COST = 20 / 3.0; double SNEAK_ONE_BLOCK_COST = 20 / 1.3; From 2fd888b9eebf3e3b691e55c6603e46969677412f Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 12 Sep 2018 17:12:06 -0500 Subject: [PATCH 011/120] Replace String lists containing block names with actual block lists It just makes sense like wtf --- .../behavior/impl/FollowBehavior.java | 9 ++++-- .../baritone/behavior/impl/MineBehavior.java | 28 +++++++++++-------- src/main/java/baritone/cache/ChunkPacker.java | 3 +- .../java/baritone/cache/WorldScanner.java | 12 ++++---- .../utils/ExampleBaritoneControl.java | 5 ++-- 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/main/java/baritone/behavior/impl/FollowBehavior.java b/src/main/java/baritone/behavior/impl/FollowBehavior.java index 55ec5539..8f9a8615 100644 --- a/src/main/java/baritone/behavior/impl/FollowBehavior.java +++ b/src/main/java/baritone/behavior/impl/FollowBehavior.java @@ -29,6 +29,7 @@ import net.minecraft.util.math.BlockPos; * @author leijurv */ public class FollowBehavior extends Behavior { + public static final FollowBehavior INSTANCE = new FollowBehavior(); private FollowBehavior() { @@ -49,8 +50,12 @@ public class FollowBehavior extends Behavior { PathingBehavior.INSTANCE.path(); } - public void follow(Entity follow) { - this.following = follow; + public void follow(Entity entity) { + this.following = entity; + } + + public Entity following() { + return this.following; } public void cancel() { diff --git a/src/main/java/baritone/behavior/impl/MineBehavior.java b/src/main/java/baritone/behavior/impl/MineBehavior.java index 5b0d6a5a..9b220d01 100644 --- a/src/main/java/baritone/behavior/impl/MineBehavior.java +++ b/src/main/java/baritone/behavior/impl/MineBehavior.java @@ -27,6 +27,7 @@ import baritone.pathing.goals.Goal; import baritone.pathing.goals.GoalComposite; import baritone.pathing.goals.GoalTwoBlocks; import baritone.utils.BlockStateInterface; +import net.minecraft.block.Block; import net.minecraft.util.math.BlockPos; import net.minecraft.world.chunk.EmptyChunk; @@ -47,14 +48,14 @@ public class MineBehavior extends Behavior { private MineBehavior() { } - List mining; + private List mining; @Override public void onPathEvent(PathEvent event) { updateGoal(); } - public void updateGoal() { + private void updateGoal() { if (mining == null) { return; } @@ -68,13 +69,13 @@ public class MineBehavior extends Behavior { PathingBehavior.INSTANCE.path(); } - public static List scanFor(List mining, int max) { + public static List scanFor(List mining, int max) { List locs = new ArrayList<>(); - List uninteresting = new ArrayList<>(); + List uninteresting = new ArrayList<>(); //long b = System.currentTimeMillis(); - for (String m : mining) { - if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(ChunkPacker.stringToBlock(m))) { - locs.addAll(WorldProvider.INSTANCE.getCurrentWorld().cache.getLocationsOf(m, 1, 1)); + for (Block m : mining) { + if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(m)) { + locs.addAll(WorldProvider.INSTANCE.getCurrentWorld().cache.getLocationsOf(ChunkPacker.blockToString(m), 1, 1)); } else { uninteresting.add(m); } @@ -91,7 +92,7 @@ public class MineBehavior extends Behavior { // remove any that are within loaded chunks that aren't actually what we want locs.removeAll(locs.stream() .filter(pos -> !(MineBehavior.INSTANCE.world().getChunk(pos) instanceof EmptyChunk)) - .filter(pos -> !mining.contains(ChunkPacker.blockToString(BlockStateInterface.get(pos).getBlock()).toLowerCase())) + .filter(pos -> !mining.contains(BlockStateInterface.get(pos).getBlock())) .collect(Collectors.toList())); if (locs.size() > max) { locs = locs.subList(0, max); @@ -99,13 +100,18 @@ public class MineBehavior extends Behavior { return locs; } - public void mine(String... mining) { - this.mining = mining == null || mining.length == 0 ? null : new ArrayList<>(Arrays.asList(mining)); + public void mine(String... blocks) { + this.mining = blocks == null || blocks.length == 0 ? null : Arrays.stream(blocks).map(ChunkPacker::stringToBlock).collect(Collectors.toList()); + updateGoal(); + } + + public void mine(Block... blocks) { + this.mining = blocks == null || blocks.length == 0 ? null : Arrays.asList(blocks); updateGoal(); } public void cancel() { PathingBehavior.INSTANCE.cancel(); - mine(); + mine((String[]) null); } } diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index 9dffe5ae..5c2374ce 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -124,8 +124,7 @@ public final class ChunkPacker implements Helper { blockNames[z << 4 | x] = "air"; } } - CachedChunk cached = new CachedChunk(chunk.x, chunk.z, bitSet, blockNames, specialBlocks); - return cached; + return new CachedChunk(chunk.x, chunk.z, bitSet, blockNames, specialBlocks); } public static String blockToString(Block block) { diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index 2b1ebe23..975683d1 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -28,18 +28,16 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage; import java.util.LinkedList; import java.util.List; -import java.util.stream.Collectors; public enum WorldScanner implements Helper { INSTANCE; - public List scanLoadedChunks(List blockTypes, int max) { - List asBlocks = blockTypes.stream().map(ChunkPacker::stringToBlock).collect(Collectors.toList()); - if (asBlocks.contains(null)) { - throw new IllegalStateException("Invalid block name should have been caught earlier: " + blockTypes.toString()); + public List scanLoadedChunks(List blocks, int max) { + if (blocks.contains(null)) { + throw new IllegalStateException("Invalid block name should have been caught earlier: " + blocks.toString()); } LinkedList res = new LinkedList<>(); - if (asBlocks.isEmpty()) { + if (blocks.isEmpty()) { return res; } ChunkProviderClient chunkProvider = world().getChunkProvider(); @@ -79,7 +77,7 @@ public enum WorldScanner implements Helper { for (int z = 0; z < 16; z++) { for (int x = 0; x < 16; x++) { IBlockState state = bsc.get(x, y, z); - if (asBlocks.contains(state.getBlock())) { + if (blocks.contains(state.getBlock())) { res.add(new BlockPos(chunkX | x, yReal | y, chunkZ | z)); } } diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 6a301a6c..3abd11b5 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -246,13 +246,14 @@ public class ExampleBaritoneControl extends Behavior { Waypoint.Tag tag = Waypoint.Tag.fromString(waypointType); if (tag == null) { String mining = waypointType; + Block block = ChunkPacker.stringToBlock(mining); //logDirect("Not a valid tag. Tags are: " + Arrays.asList(Waypoint.Tag.values()).toString().toLowerCase()); event.cancel(); - if (ChunkPacker.stringToBlock(mining) == null) { + if (block == null) { logDirect("No locations for " + mining + " known, cancelling"); return; } - List locs = MineBehavior.scanFor(Arrays.asList(mining), 64); + List locs = MineBehavior.scanFor(Collections.singletonList(block), 64); if (locs.isEmpty()) { logDirect("No locations for " + mining + " known, cancelling"); return; From fb8ee44447dbd02eab59a48eb37dbdb37c862a08 Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 12 Sep 2018 17:25:01 -0500 Subject: [PATCH 012/120] Remove hacky "softCancel" thing --- .../java/baritone/behavior/impl/PathingBehavior.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/baritone/behavior/impl/PathingBehavior.java b/src/main/java/baritone/behavior/impl/PathingBehavior.java index 8ce34ecc..531741fe 100644 --- a/src/main/java/baritone/behavior/impl/PathingBehavior.java +++ b/src/main/java/baritone/behavior/impl/PathingBehavior.java @@ -66,9 +66,10 @@ public final class PathingBehavior extends Behavior { @Override public void onTick(TickEvent event) { if (event.getType() == TickEvent.Type.OUT) { - softCancel(); // no player, so can't fix capabilities + this.cancel(); return; } + mc.playerController.setPlayerCapabilities(mc.player); if (current == null) { return; } @@ -191,18 +192,13 @@ public final class PathingBehavior extends Behavior { return Optional.ofNullable(current).map(PathExecutor::getPath); } - private void softCancel() { + public void cancel() { current = null; next = null; Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(AbstractNodeCostSearch::cancel); } - public void cancel() { - softCancel(); - mc.playerController.setPlayerCapabilities(mc.player); - } - /** * Start calculating a path if we aren't already * From 0a0209d2e15c1ec69e96de27ef0383d2d9d25453 Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 12 Sep 2018 17:53:29 -0500 Subject: [PATCH 013/120] Move Behavior to api --- .../java/baritone/api}/behavior/Behavior.java | 44 ++++--------------- .../api}/utils/interfaces/Toggleable.java | 12 ++++- src/main/java/baritone/Baritone.java | 2 +- .../behavior/impl/FollowBehavior.java | 2 +- .../impl/LocationTrackingBehavior.java | 5 ++- .../baritone/behavior/impl/LookBehavior.java | 5 ++- .../behavior/impl/MemoryBehavior.java | 5 ++- .../baritone/behavior/impl/MineBehavior.java | 6 ++- .../behavior/impl/PathingBehavior.java | 5 ++- .../java/baritone/event/GameEventHandler.java | 2 +- .../utils/ExampleBaritoneControl.java | 5 ++- 11 files changed, 41 insertions(+), 52 deletions(-) rename src/{main/java/baritone => api/java/baritone/api}/behavior/Behavior.java (59%) rename src/{main/java/baritone => api/java/baritone/api}/utils/interfaces/Toggleable.java (81%) diff --git a/src/main/java/baritone/behavior/Behavior.java b/src/api/java/baritone/api/behavior/Behavior.java similarity index 59% rename from src/main/java/baritone/behavior/Behavior.java rename to src/api/java/baritone/api/behavior/Behavior.java index 5bf6c5c6..67d3c25b 100644 --- a/src/main/java/baritone/behavior/Behavior.java +++ b/src/api/java/baritone/api/behavior/Behavior.java @@ -15,19 +15,18 @@ * along with Baritone. If not, see . */ -package baritone.behavior; +package baritone.api.behavior; import baritone.api.event.listener.AbstractGameEventListener; -import baritone.utils.Helper; -import baritone.utils.interfaces.Toggleable; +import baritone.api.utils.interfaces.Toggleable; /** - * A generic bot behavior. + * A type of game event listener that can be toggled. * * @author Brady * @since 8/1/2018 6:29 PM */ -public class Behavior implements AbstractGameEventListener, Toggleable, Helper { +public class Behavior implements AbstractGameEventListener, Toggleable { /** * Whether or not this behavior is enabled @@ -51,35 +50,18 @@ public class Behavior implements AbstractGameEventListener, Toggleable, Helper { */ @Override public final boolean setEnabled(boolean enabled) { - boolean newState = getNewState(this.enabled, enabled); - if (newState == this.enabled) { + if (enabled == this.enabled) return this.enabled; - } - if (this.enabled = newState) { - onStart(); + if (this.enabled = enabled) { + this.onEnable(); } else { - onCancel(); + this.onDisable(); } return this.enabled; } - /** - * Function to determine what the new enabled state of this - * {@link Behavior} should be given the old state, and the - * proposed state. Intended to be overridden by behaviors - * that should always be active, given that the bot itself is - * active. - * - * @param oldState The old state - * @param proposedState The proposed state - * @return The new state - */ - public boolean getNewState(boolean oldState, boolean proposedState) { - return proposedState; - } - /** * @return Whether or not this {@link Behavior} is active. */ @@ -87,14 +69,4 @@ public class Behavior implements AbstractGameEventListener, Toggleable, Helper { public final boolean isEnabled() { return this.enabled; } - - /** - * Called when the state changes from disabled to enabled - */ - public void onStart() {} - - /** - * Called when the state changes from enabled to disabled - */ - public void onCancel() {} } diff --git a/src/main/java/baritone/utils/interfaces/Toggleable.java b/src/api/java/baritone/api/utils/interfaces/Toggleable.java similarity index 81% rename from src/main/java/baritone/utils/interfaces/Toggleable.java rename to src/api/java/baritone/api/utils/interfaces/Toggleable.java index ba23bd34..bf43220a 100644 --- a/src/main/java/baritone/utils/interfaces/Toggleable.java +++ b/src/api/java/baritone/api/utils/interfaces/Toggleable.java @@ -15,7 +15,7 @@ * along with Baritone. If not, see . */ -package baritone.utils.interfaces; +package baritone.api.utils.interfaces; /** * @author Brady @@ -41,4 +41,14 @@ public interface Toggleable { * @return Whether or not this {@link Toggleable} object is enabled */ boolean isEnabled(); + + /** + * Called when the state changes from disabled to enabled + */ + default void onEnable() {} + + /** + * Called when the state changes from enabled to disabled + */ + default void onDisable() {} } diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index 3c7bf24c..6c7acc5f 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -18,7 +18,7 @@ package baritone; import baritone.api.event.listener.IGameEventListener; -import baritone.behavior.Behavior; +import baritone.api.behavior.Behavior; import baritone.behavior.impl.*; import baritone.event.GameEventHandler; import baritone.utils.InputOverrideHandler; diff --git a/src/main/java/baritone/behavior/impl/FollowBehavior.java b/src/main/java/baritone/behavior/impl/FollowBehavior.java index 8f9a8615..eb67dfa0 100644 --- a/src/main/java/baritone/behavior/impl/FollowBehavior.java +++ b/src/main/java/baritone/behavior/impl/FollowBehavior.java @@ -18,7 +18,7 @@ package baritone.behavior.impl; import baritone.api.event.events.TickEvent; -import baritone.behavior.Behavior; +import baritone.api.behavior.Behavior; import baritone.pathing.goals.GoalNear; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java b/src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java index 47dfcd7c..fb7d9db8 100644 --- a/src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java +++ b/src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java @@ -17,11 +17,12 @@ package baritone.behavior.impl; -import baritone.behavior.Behavior; +import baritone.api.behavior.Behavior; import baritone.cache.Waypoint; import baritone.cache.WorldProvider; import baritone.api.event.events.BlockInteractEvent; import baritone.utils.BlockStateInterface; +import baritone.utils.Helper; import net.minecraft.block.BlockBed; /** @@ -33,7 +34,7 @@ import net.minecraft.block.BlockBed; * @author Brady * @since 8/22/2018 */ -public final class LocationTrackingBehavior extends Behavior { +public final class LocationTrackingBehavior extends Behavior implements Helper { public static final LocationTrackingBehavior INSTANCE = new LocationTrackingBehavior(); diff --git a/src/main/java/baritone/behavior/impl/LookBehavior.java b/src/main/java/baritone/behavior/impl/LookBehavior.java index 904087ab..ddf58619 100644 --- a/src/main/java/baritone/behavior/impl/LookBehavior.java +++ b/src/main/java/baritone/behavior/impl/LookBehavior.java @@ -21,10 +21,11 @@ import baritone.Baritone; import baritone.Settings; import baritone.api.event.events.PlayerUpdateEvent; import baritone.api.event.events.RotationMoveEvent; -import baritone.behavior.Behavior; +import baritone.api.behavior.Behavior; +import baritone.utils.Helper; import baritone.utils.Rotation; -public class LookBehavior extends Behavior { +public class LookBehavior extends Behavior implements Helper { public static final LookBehavior INSTANCE = new LookBehavior(); diff --git a/src/main/java/baritone/behavior/impl/MemoryBehavior.java b/src/main/java/baritone/behavior/impl/MemoryBehavior.java index 93657988..5d99c2d1 100644 --- a/src/main/java/baritone/behavior/impl/MemoryBehavior.java +++ b/src/main/java/baritone/behavior/impl/MemoryBehavior.java @@ -3,7 +3,8 @@ package baritone.behavior.impl; import baritone.api.event.events.PacketEvent; import baritone.api.event.events.PlayerUpdateEvent; import baritone.api.event.events.type.EventState; -import baritone.behavior.Behavior; +import baritone.api.behavior.Behavior; +import baritone.utils.Helper; import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; import net.minecraft.network.play.client.CPacketCloseWindow; @@ -20,7 +21,7 @@ import java.util.*; * @author Brady * @since 8/6/2018 9:47 PM */ -public class MemoryBehavior extends Behavior { +public class MemoryBehavior extends Behavior implements Helper { public static MemoryBehavior INSTANCE = new MemoryBehavior(); diff --git a/src/main/java/baritone/behavior/impl/MineBehavior.java b/src/main/java/baritone/behavior/impl/MineBehavior.java index 9b220d01..a36aa02f 100644 --- a/src/main/java/baritone/behavior/impl/MineBehavior.java +++ b/src/main/java/baritone/behavior/impl/MineBehavior.java @@ -18,7 +18,7 @@ package baritone.behavior.impl; import baritone.api.event.events.PathEvent; -import baritone.behavior.Behavior; +import baritone.api.behavior.Behavior; import baritone.cache.CachedChunk; import baritone.cache.ChunkPacker; import baritone.cache.WorldProvider; @@ -27,6 +27,7 @@ import baritone.pathing.goals.Goal; import baritone.pathing.goals.GoalComposite; import baritone.pathing.goals.GoalTwoBlocks; import baritone.utils.BlockStateInterface; +import baritone.utils.Helper; import net.minecraft.block.Block; import net.minecraft.util.math.BlockPos; import net.minecraft.world.chunk.EmptyChunk; @@ -42,7 +43,8 @@ import java.util.stream.Collectors; * * @author leijurv */ -public class MineBehavior extends Behavior { +public class MineBehavior extends Behavior implements Helper { + public static final MineBehavior INSTANCE = new MineBehavior(); private MineBehavior() { diff --git a/src/main/java/baritone/behavior/impl/PathingBehavior.java b/src/main/java/baritone/behavior/impl/PathingBehavior.java index 531741fe..d29ecd10 100644 --- a/src/main/java/baritone/behavior/impl/PathingBehavior.java +++ b/src/main/java/baritone/behavior/impl/PathingBehavior.java @@ -22,7 +22,7 @@ import baritone.api.event.events.PathEvent; import baritone.api.event.events.PlayerUpdateEvent; import baritone.api.event.events.RenderEvent; import baritone.api.event.events.TickEvent; -import baritone.behavior.Behavior; +import baritone.api.behavior.Behavior; import baritone.pathing.calc.AStarPathFinder; import baritone.pathing.calc.AbstractNodeCostSearch; import baritone.pathing.calc.IPathFinder; @@ -31,6 +31,7 @@ import baritone.pathing.movement.MovementHelper; import baritone.pathing.path.IPath; import baritone.pathing.path.PathExecutor; import baritone.utils.BlockStateInterface; +import baritone.utils.Helper; import baritone.utils.PathRenderer; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; @@ -40,7 +41,7 @@ import java.awt.*; import java.util.Collections; import java.util.Optional; -public final class PathingBehavior extends Behavior { +public final class PathingBehavior extends Behavior implements Helper { public static final PathingBehavior INSTANCE = new PathingBehavior(); diff --git a/src/main/java/baritone/event/GameEventHandler.java b/src/main/java/baritone/event/GameEventHandler.java index c681bc29..5d2c6558 100644 --- a/src/main/java/baritone/event/GameEventHandler.java +++ b/src/main/java/baritone/event/GameEventHandler.java @@ -25,7 +25,7 @@ import baritone.cache.WorldProvider; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; import baritone.utils.InputOverrideHandler; -import baritone.utils.interfaces.Toggleable; +import baritone.api.utils.interfaces.Toggleable; import net.minecraft.client.settings.KeyBinding; import net.minecraft.world.chunk.Chunk; import org.lwjgl.input.Keyboard; diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 3abd11b5..54c72ec0 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -20,7 +20,7 @@ package baritone.utils; import baritone.Baritone; import baritone.Settings; import baritone.api.event.events.ChatEvent; -import baritone.behavior.Behavior; +import baritone.api.behavior.Behavior; import baritone.behavior.impl.FollowBehavior; import baritone.behavior.impl.MineBehavior; import baritone.behavior.impl.PathingBehavior; @@ -41,7 +41,8 @@ import net.minecraft.util.math.BlockPos; import java.util.*; -public class ExampleBaritoneControl extends Behavior { +public class ExampleBaritoneControl extends Behavior implements Helper { + public static ExampleBaritoneControl INSTANCE = new ExampleBaritoneControl(); private ExampleBaritoneControl() { From ef396829f0f25ee8b662830a4495423430e50cce Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 12 Sep 2018 17:58:33 -0500 Subject: [PATCH 014/120] Collapse impl package for default behaviors --- .../launch/mixins/MixinMinecraft.java | 2 +- src/main/java/baritone/Baritone.java | 2 +- .../behavior/{impl => }/FollowBehavior.java | 6 +++--- .../{impl => }/LocationTrackingBehavior.java | 2 +- .../behavior/{impl => }/LookBehavior.java | 4 ++-- .../{impl => }/LookBehaviorUtils.java | 2 +- .../behavior/{impl => }/MemoryBehavior.java | 21 +++++++++++++++++-- .../behavior/{impl => }/MineBehavior.java | 4 ++-- .../behavior/{impl => }/PathingBehavior.java | 2 +- .../pathing/calc/AbstractNodeCostSearch.java | 2 +- .../baritone/pathing/movement/Movement.java | 4 ++-- .../pathing/movement/MovementHelper.java | 2 +- .../movement/movements/MovementAscend.java | 2 +- .../movement/movements/MovementParkour.java | 2 +- .../movement/movements/MovementTraverse.java | 2 +- .../utils/ExampleBaritoneControl.java | 6 +++--- .../java/baritone/utils/RayTraceUtils.java | 2 +- 17 files changed, 42 insertions(+), 25 deletions(-) rename src/main/java/baritone/behavior/{impl => }/FollowBehavior.java (93%) rename src/main/java/baritone/behavior/{impl => }/LocationTrackingBehavior.java (98%) rename src/main/java/baritone/behavior/{impl => }/LookBehavior.java (97%) rename src/main/java/baritone/behavior/{impl => }/LookBehaviorUtils.java (99%) rename src/main/java/baritone/behavior/{impl => }/MemoryBehavior.java (88%) rename src/main/java/baritone/behavior/{impl => }/MineBehavior.java (97%) rename src/main/java/baritone/behavior/{impl => }/PathingBehavior.java (99%) diff --git a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java index bc419516..6ea14221 100644 --- a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java +++ b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java @@ -22,7 +22,7 @@ import baritone.api.event.events.BlockInteractEvent; import baritone.api.event.events.TickEvent; import baritone.api.event.events.WorldEvent; import baritone.api.event.events.type.EventState; -import baritone.behavior.impl.PathingBehavior; +import baritone.behavior.PathingBehavior; import baritone.utils.ExampleBaritoneControl; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index 6c7acc5f..fb373c6e 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -19,7 +19,7 @@ package baritone; import baritone.api.event.listener.IGameEventListener; import baritone.api.behavior.Behavior; -import baritone.behavior.impl.*; +import baritone.behavior.*; import baritone.event.GameEventHandler; import baritone.utils.InputOverrideHandler; import net.minecraft.client.Minecraft; diff --git a/src/main/java/baritone/behavior/impl/FollowBehavior.java b/src/main/java/baritone/behavior/FollowBehavior.java similarity index 93% rename from src/main/java/baritone/behavior/impl/FollowBehavior.java rename to src/main/java/baritone/behavior/FollowBehavior.java index eb67dfa0..0a7fff6b 100644 --- a/src/main/java/baritone/behavior/impl/FollowBehavior.java +++ b/src/main/java/baritone/behavior/FollowBehavior.java @@ -15,7 +15,7 @@ * along with Baritone. If not, see . */ -package baritone.behavior.impl; +package baritone.behavior; import baritone.api.event.events.TickEvent; import baritone.api.behavior.Behavior; @@ -28,14 +28,14 @@ import net.minecraft.util.math.BlockPos; * * @author leijurv */ -public class FollowBehavior extends Behavior { +public final class FollowBehavior extends Behavior { public static final FollowBehavior INSTANCE = new FollowBehavior(); private FollowBehavior() { } - Entity following; + private Entity following; @Override public void onTick(TickEvent event) { diff --git a/src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java b/src/main/java/baritone/behavior/LocationTrackingBehavior.java similarity index 98% rename from src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java rename to src/main/java/baritone/behavior/LocationTrackingBehavior.java index fb7d9db8..cf41543c 100644 --- a/src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java +++ b/src/main/java/baritone/behavior/LocationTrackingBehavior.java @@ -15,7 +15,7 @@ * along with Baritone. If not, see . */ -package baritone.behavior.impl; +package baritone.behavior; import baritone.api.behavior.Behavior; import baritone.cache.Waypoint; diff --git a/src/main/java/baritone/behavior/impl/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java similarity index 97% rename from src/main/java/baritone/behavior/impl/LookBehavior.java rename to src/main/java/baritone/behavior/LookBehavior.java index ddf58619..fa10d27d 100644 --- a/src/main/java/baritone/behavior/impl/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -15,7 +15,7 @@ * along with Baritone. If not, see . */ -package baritone.behavior.impl; +package baritone.behavior; import baritone.Baritone; import baritone.Settings; @@ -25,7 +25,7 @@ import baritone.api.behavior.Behavior; import baritone.utils.Helper; import baritone.utils.Rotation; -public class LookBehavior extends Behavior implements Helper { +public final class LookBehavior extends Behavior implements Helper { public static final LookBehavior INSTANCE = new LookBehavior(); diff --git a/src/main/java/baritone/behavior/impl/LookBehaviorUtils.java b/src/main/java/baritone/behavior/LookBehaviorUtils.java similarity index 99% rename from src/main/java/baritone/behavior/impl/LookBehaviorUtils.java rename to src/main/java/baritone/behavior/LookBehaviorUtils.java index a7896d03..bbab90bf 100644 --- a/src/main/java/baritone/behavior/impl/LookBehaviorUtils.java +++ b/src/main/java/baritone/behavior/LookBehaviorUtils.java @@ -15,7 +15,7 @@ * along with Baritone. If not, see . */ -package baritone.behavior.impl; +package baritone.behavior; import baritone.utils.*; import net.minecraft.block.BlockFire; diff --git a/src/main/java/baritone/behavior/impl/MemoryBehavior.java b/src/main/java/baritone/behavior/MemoryBehavior.java similarity index 88% rename from src/main/java/baritone/behavior/impl/MemoryBehavior.java rename to src/main/java/baritone/behavior/MemoryBehavior.java index 5d99c2d1..ee89ebbf 100644 --- a/src/main/java/baritone/behavior/impl/MemoryBehavior.java +++ b/src/main/java/baritone/behavior/MemoryBehavior.java @@ -1,4 +1,21 @@ -package baritone.behavior.impl; +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Baritone. If not, see . + */ + +package baritone.behavior; import baritone.api.event.events.PacketEvent; import baritone.api.event.events.PlayerUpdateEvent; @@ -21,7 +38,7 @@ import java.util.*; * @author Brady * @since 8/6/2018 9:47 PM */ -public class MemoryBehavior extends Behavior implements Helper { +public final class MemoryBehavior extends Behavior implements Helper { public static MemoryBehavior INSTANCE = new MemoryBehavior(); diff --git a/src/main/java/baritone/behavior/impl/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java similarity index 97% rename from src/main/java/baritone/behavior/impl/MineBehavior.java rename to src/main/java/baritone/behavior/MineBehavior.java index a36aa02f..2dbb0dbb 100644 --- a/src/main/java/baritone/behavior/impl/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -15,7 +15,7 @@ * along with Baritone. If not, see . */ -package baritone.behavior.impl; +package baritone.behavior; import baritone.api.event.events.PathEvent; import baritone.api.behavior.Behavior; @@ -43,7 +43,7 @@ import java.util.stream.Collectors; * * @author leijurv */ -public class MineBehavior extends Behavior implements Helper { +public final class MineBehavior extends Behavior implements Helper { public static final MineBehavior INSTANCE = new MineBehavior(); diff --git a/src/main/java/baritone/behavior/impl/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java similarity index 99% rename from src/main/java/baritone/behavior/impl/PathingBehavior.java rename to src/main/java/baritone/behavior/PathingBehavior.java index d29ecd10..944af0d2 100644 --- a/src/main/java/baritone/behavior/impl/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -15,7 +15,7 @@ * along with Baritone. If not, see . */ -package baritone.behavior.impl; +package baritone.behavior; import baritone.Baritone; import baritone.api.event.events.PathEvent; diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index 92c85b1d..2432699a 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -17,7 +17,7 @@ package baritone.pathing.calc; -import baritone.behavior.impl.PathingBehavior; +import baritone.behavior.PathingBehavior; import baritone.pathing.goals.Goal; import baritone.pathing.path.IPath; import baritone.utils.pathing.BetterBlockPos; diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index ddf36034..0c59bfc0 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -18,8 +18,8 @@ package baritone.pathing.movement; import baritone.Baritone; -import baritone.behavior.impl.LookBehavior; -import baritone.behavior.impl.LookBehaviorUtils; +import baritone.behavior.LookBehavior; +import baritone.behavior.LookBehaviorUtils; import baritone.pathing.movement.MovementState.MovementStatus; import baritone.utils.*; import baritone.utils.pathing.BetterBlockPos; diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 3f68cba6..8f886f7e 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -18,7 +18,7 @@ package baritone.pathing.movement; import baritone.Baritone; -import baritone.behavior.impl.LookBehaviorUtils; +import baritone.behavior.LookBehaviorUtils; import baritone.pathing.movement.MovementState.MovementTarget; import baritone.pathing.movement.movements.MovementDescend; import baritone.pathing.movement.movements.MovementFall; diff --git a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java index 60591d88..b802b53a 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java @@ -18,7 +18,7 @@ package baritone.pathing.movement.movements; import baritone.Baritone; -import baritone.behavior.impl.LookBehaviorUtils; +import baritone.behavior.LookBehaviorUtils; import baritone.pathing.movement.CalculationContext; import baritone.pathing.movement.Movement; import baritone.pathing.movement.MovementHelper; diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 61056ff2..dc586fac 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -18,7 +18,7 @@ package baritone.pathing.movement.movements; import baritone.Baritone; -import baritone.behavior.impl.LookBehaviorUtils; +import baritone.behavior.LookBehaviorUtils; import baritone.pathing.movement.CalculationContext; import baritone.pathing.movement.Movement; import baritone.pathing.movement.MovementHelper; diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index df0f3a27..2dfd9311 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -18,7 +18,7 @@ package baritone.pathing.movement.movements; import baritone.Baritone; -import baritone.behavior.impl.LookBehaviorUtils; +import baritone.behavior.LookBehaviorUtils; import baritone.pathing.movement.CalculationContext; import baritone.pathing.movement.Movement; import baritone.pathing.movement.MovementHelper; diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 54c72ec0..19efa55f 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -21,9 +21,9 @@ import baritone.Baritone; import baritone.Settings; import baritone.api.event.events.ChatEvent; import baritone.api.behavior.Behavior; -import baritone.behavior.impl.FollowBehavior; -import baritone.behavior.impl.MineBehavior; -import baritone.behavior.impl.PathingBehavior; +import baritone.behavior.FollowBehavior; +import baritone.behavior.MineBehavior; +import baritone.behavior.PathingBehavior; import baritone.cache.ChunkPacker; import baritone.cache.Waypoint; import baritone.cache.WorldProvider; diff --git a/src/main/java/baritone/utils/RayTraceUtils.java b/src/main/java/baritone/utils/RayTraceUtils.java index 123e283d..02ae52df 100644 --- a/src/main/java/baritone/utils/RayTraceUtils.java +++ b/src/main/java/baritone/utils/RayTraceUtils.java @@ -20,7 +20,7 @@ package baritone.utils; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; -import static baritone.behavior.impl.LookBehaviorUtils.calcVec3dFromRotation; +import static baritone.behavior.LookBehaviorUtils.calcVec3dFromRotation; /** * @author Brady From 796be3da793a8b689d3d0dde83340a289d7fce1d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 12 Sep 2018 16:29:10 -0700 Subject: [PATCH 015/120] can't break nether roof, fixes #164 --- src/main/java/baritone/cache/CachedChunk.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/baritone/cache/CachedChunk.java b/src/main/java/baritone/cache/CachedChunk.java index fbab3161..0debcc84 100644 --- a/src/main/java/baritone/cache/CachedChunk.java +++ b/src/main/java/baritone/cache/CachedChunk.java @@ -128,6 +128,9 @@ public final class CachedChunk implements IBlockTypeAccess { return state; } PathingBlockType type = getType(x, y, z); + if (type == PathingBlockType.SOLID && y == 128 && mc.player.dimension == -1) { + return Blocks.BEDROCK.getDefaultState(); + } return ChunkPacker.pathingTypeToBlock(type); } From 315c1bf63cd67594c13030f2207c5feea36b968f Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 12 Sep 2018 16:40:27 -0700 Subject: [PATCH 016/120] help i cannot math into number --- src/main/java/baritone/cache/CachedChunk.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/cache/CachedChunk.java b/src/main/java/baritone/cache/CachedChunk.java index 0debcc84..a79d3733 100644 --- a/src/main/java/baritone/cache/CachedChunk.java +++ b/src/main/java/baritone/cache/CachedChunk.java @@ -128,7 +128,7 @@ public final class CachedChunk implements IBlockTypeAccess { return state; } PathingBlockType type = getType(x, y, z); - if (type == PathingBlockType.SOLID && y == 128 && mc.player.dimension == -1) { + if (type == PathingBlockType.SOLID && y == 127 && mc.player.dimension == -1) { return Blocks.BEDROCK.getDefaultState(); } return ChunkPacker.pathingTypeToBlock(type); From df765a14b09d24f412bf262ff227aa29fe467d78 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 12 Sep 2018 20:49:53 -0700 Subject: [PATCH 017/120] update prebuilt baritone --- IMPACT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPACT.md b/IMPACT.md index ec7b6707..4c552963 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -2,7 +2,7 @@ Baritone will be in Impact 4.4 with nice integrations with its utility modules, but if you're impatient you can run Baritone on top of Impact 4.3 right now. -You can either build Baritone yourself, or download the jar (as of commit 72eec13, built on September 10) from here. +You can either build Baritone yourself, or download the jar (as of commit 315c1bf, built on September 12) from here. To build it yourself, clone and setup Baritone (instructions in main README.md). Then, build the jar. From the command line, it's `./gradlew build` (or `gradlew build` on Windows). In IntelliJ, you can just start the `build` task in the Gradle menu. From 4c5c35069d0394c72bc9092222d9c17f993d3565 Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 13 Sep 2018 09:44:51 -0500 Subject: [PATCH 018/120] Remove keycode state forcing It was a feature that was in the source of MineBot, but was actually never used. --- .../launch/mixins/MixinGameSettings.java | 44 ----------------- .../launch/mixins/MixinGuiContainer.java | 47 ------------------ .../launch/mixins/MixinGuiScreen.java | 48 ------------------- .../launch/mixins/MixinMinecraft.java | 12 ----- src/launch/resources/mixins.baritone.json | 3 -- .../baritone/utils/InputOverrideHandler.java | 25 ---------- 6 files changed, 179 deletions(-) delete mode 100644 src/launch/java/baritone/launch/mixins/MixinGameSettings.java delete mode 100644 src/launch/java/baritone/launch/mixins/MixinGuiContainer.java delete mode 100644 src/launch/java/baritone/launch/mixins/MixinGuiScreen.java diff --git a/src/launch/java/baritone/launch/mixins/MixinGameSettings.java b/src/launch/java/baritone/launch/mixins/MixinGameSettings.java deleted file mode 100644 index f5bae8ef..00000000 --- a/src/launch/java/baritone/launch/mixins/MixinGameSettings.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is part of Baritone. - * - * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Baritone is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Baritone. If not, see . - */ - -package baritone.launch.mixins; - -import baritone.Baritone; -import net.minecraft.client.settings.GameSettings; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -/** - * @author Brady - * @since 8/1/2018 12:28 AM - */ -@Mixin(GameSettings.class) -public class MixinGameSettings { - - @Redirect( - method = "isKeyDown", - at = @At( - value = "INVOKE", - target = "org/lwjgl/input/Keyboard.isKeyDown(I)Z", - remap = false - ) - ) - private static boolean isKeyDown(int keyCode) { - return Baritone.INSTANCE.getInputOverrideHandler().isKeyDown(keyCode); - } -} diff --git a/src/launch/java/baritone/launch/mixins/MixinGuiContainer.java b/src/launch/java/baritone/launch/mixins/MixinGuiContainer.java deleted file mode 100644 index c2c62d76..00000000 --- a/src/launch/java/baritone/launch/mixins/MixinGuiContainer.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of Baritone. - * - * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Baritone is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Baritone. If not, see . - */ - -package baritone.launch.mixins; - -import baritone.Baritone; -import net.minecraft.client.gui.inventory.GuiContainer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -/** - * @author Brady - * @since 7/31/2018 10:47 PM - */ -@Mixin(GuiContainer.class) -public class MixinGuiContainer { - - @Redirect( - method = { - "mouseClicked", - "mouseReleased" - }, - at = @At( - value = "INVOKE", - target = "org/lwjgl/input/Keyboard.isKeyDown(I)Z", - remap = false - ) - ) - private boolean isKeyDown(int keyCode) { - return Baritone.INSTANCE.getInputOverrideHandler().isKeyDown(keyCode); - } -} diff --git a/src/launch/java/baritone/launch/mixins/MixinGuiScreen.java b/src/launch/java/baritone/launch/mixins/MixinGuiScreen.java deleted file mode 100644 index 11a3e7f4..00000000 --- a/src/launch/java/baritone/launch/mixins/MixinGuiScreen.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of Baritone. - * - * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Baritone is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Baritone. If not, see . - */ - -package baritone.launch.mixins; - -import baritone.Baritone; -import net.minecraft.client.gui.GuiScreen; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -/** - * @author Brady - * @since 7/31/2018 10:38 PM - */ -@Mixin(GuiScreen.class) -public class MixinGuiScreen { - - @Redirect( - method = { - "isCtrlKeyDown", - "isShiftKeyDown", - "isAltKeyDown" - }, - at = @At( - value = "INVOKE", - target = "org/lwjgl/input/Keyboard.isKeyDown(I)Z", - remap = false - ) - ) - private static boolean isKeyDown(int keyCode) { - return Baritone.INSTANCE.getInputOverrideHandler().isKeyDown(keyCode); - } -} diff --git a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java index 6ea14221..2bcc54b9 100644 --- a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java +++ b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java @@ -85,18 +85,6 @@ public class MixinMinecraft { )); } - @Redirect( - method = "runTickKeyboard", - at = @At( - value = "INVOKE", - target = "org/lwjgl/input/Keyboard.isKeyDown(I)Z", - remap = false - ) - ) - private boolean Keyboard$isKeyDown(int keyCode) { - return Baritone.INSTANCE.getInputOverrideHandler().isKeyDown(keyCode); - } - @Inject( method = "processKeyBinds", at = @At("HEAD") diff --git a/src/launch/resources/mixins.baritone.json b/src/launch/resources/mixins.baritone.json index 413bbbe7..9ea70330 100644 --- a/src/launch/resources/mixins.baritone.json +++ b/src/launch/resources/mixins.baritone.json @@ -15,9 +15,6 @@ "MixinEntityLivingBase", "MixinEntityPlayerSP", "MixinEntityRenderer", - "MixinGameSettings", - "MixinGuiContainer", - "MixinGuiScreen", "MixinKeyBinding", "MixinMinecraft", "MixinNetHandlerPlayClient", diff --git a/src/main/java/baritone/utils/InputOverrideHandler.java b/src/main/java/baritone/utils/InputOverrideHandler.java index 9860e2e1..8540bcd4 100755 --- a/src/main/java/baritone/utils/InputOverrideHandler.java +++ b/src/main/java/baritone/utils/InputOverrideHandler.java @@ -57,14 +57,8 @@ public final class InputOverrideHandler implements Helper { */ private final Map inputForceStateMap = new HashMap<>(); - /** - * Maps keycodes to whether or not we are forcing their state down. - */ - private final Map keyCodeForceStateMap = new HashMap<>(); - public final void clearAllKeys() { inputForceStateMap.clear(); - keyCodeForceStateMap.clear(); } /** @@ -87,25 +81,6 @@ public final class InputOverrideHandler implements Helper { inputForceStateMap.put(input.getKeyBinding(), forced); } - /** - * A redirection in multiple places of {@link Keyboard#isKeyDown}. - * - * @return Whether or not the specified key is down or overridden. - */ - public boolean isKeyDown(int keyCode) { - return Keyboard.isKeyDown(keyCode) || keyCodeForceStateMap.getOrDefault(keyCode, false); - } - - /** - * Sets whether or not the specified key code is being forced down. - * - * @param keyCode The key code - * @param forced Whether or not the state is being forced - */ - public final void setKeyForceState(int keyCode, boolean forced) { - keyCodeForceStateMap.put(keyCode, forced); - } - /** * An {@link Enum} representing the possible inputs that we may want to force. */ From 530bdfae0fa227a3c43b27e94cb57ee052324d5d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 13 Sep 2018 09:15:50 -0700 Subject: [PATCH 019/120] add save command --- .../java/baritone/utils/ExampleBaritoneControl.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 19efa55f..b418f067 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -19,8 +19,8 @@ package baritone.utils; import baritone.Baritone; import baritone.Settings; -import baritone.api.event.events.ChatEvent; import baritone.api.behavior.Behavior; +import baritone.api.event.events.ChatEvent; import baritone.behavior.FollowBehavior; import baritone.behavior.MineBehavior; import baritone.behavior.PathingBehavior; @@ -41,7 +41,7 @@ import net.minecraft.util.math.BlockPos; import java.util.*; -public class ExampleBaritoneControl extends Behavior implements Helper { +public class ExampleBaritoneControl extends Behavior implements Helper { public static ExampleBaritoneControl INSTANCE = new ExampleBaritoneControl(); @@ -238,6 +238,13 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } + if (msg.toLowerCase().equals("save")) { + String name = msg.substring(4).trim(); + WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint(name, Waypoint.Tag.HOME, playerFeet())); + logDirect("Saved user defined tag under name '" + name + "'. Say 'goto user' to set goal, say 'list user' to list."); + event.cancel(); + return; + } if (msg.toLowerCase().startsWith("goto")) { String waypointType = msg.toLowerCase().substring(4).trim(); if (waypointType.endsWith("s") && Waypoint.Tag.fromString(waypointType.substring(0, waypointType.length() - 1)) != null) { From d07eb3f4862ed675842915088a8643db04fdde4c Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 13 Sep 2018 11:58:52 -0500 Subject: [PATCH 020/120] jurv is a noob --- proguard.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proguard.pro b/proguard.pro index 7f0cfcdc..86ddc1a2 100644 --- a/proguard.pro +++ b/proguard.pro @@ -13,7 +13,7 @@ -overloadaggressively -dontusemixedcaseclassnames -# instead of obfing to a, b, c, obf to baritone.a, baritone.b, baritone.c so as to not conflict with mcp +# instead of obfing to a, b, c, obf to baritone.a, baritone.b, baritone.c so as to not conflict with minecraft's obfd classes -flattenpackagehierarchy -repackageclasses 'baritone' From d536d311d6435f8b9291cebea048cd838144cbd0 Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 13 Sep 2018 12:14:10 -0500 Subject: [PATCH 021/120] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cdd31b0d..9204c4b9 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ the original version of the bot for Minecraft 1.8, rebuilt for 1.12.2. Baritone + Impact # Setup + +## IntelliJ's Gradle UI - Open the project in IntelliJ as a Gradle project - Run the Gradle task `setupDecompWorkspace` - Run the Gradle task `genIntellijRuns` From 651bfac786d1277056b1f8aa1b41bf4c768584d8 Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 13 Sep 2018 14:12:41 -0500 Subject: [PATCH 022/120] Fix copyright comment detection --- .idea/copyright/Baritone.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/.idea/copyright/Baritone.xml b/.idea/copyright/Baritone.xml index c0916294..aaaf59bb 100644 --- a/.idea/copyright/Baritone.xml +++ b/.idea/copyright/Baritone.xml @@ -1,5 +1,6 @@ + From 380f21bb386dd77c80c32e18a95cdd79d6b8ac87 Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 13 Sep 2018 14:48:23 -0500 Subject: [PATCH 023/120] Remove pythagoreanMetric setting --- src/main/java/baritone/Settings.java | 6 ------ src/main/java/baritone/pathing/goals/GoalXZ.java | 3 --- 2 files changed, 9 deletions(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index d29ec995..eb673efd 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -145,12 +145,6 @@ public class Settings { */ public Setting minimumImprovementRepropagation = new Setting<>(true); - /** - * Use a pythagorean metric (as opposed to the more accurate hybrid diagonal / traverse). - * You probably don't want this. It roughly triples nodes considered for no real advantage. - */ - public Setting pythagoreanMetric = new Setting<>(false); - /** * After calculating a path (potentially through cached chunks), artificially cut it off to just the part that is * entirely within currently loaded chunks. Improves path safety because cached chunks are heavily simplified. diff --git a/src/main/java/baritone/pathing/goals/GoalXZ.java b/src/main/java/baritone/pathing/goals/GoalXZ.java index 8abfb221..71808222 100644 --- a/src/main/java/baritone/pathing/goals/GoalXZ.java +++ b/src/main/java/baritone/pathing/goals/GoalXZ.java @@ -65,9 +65,6 @@ public class GoalXZ implements Goal { } public static double calculate(double xDiff, double zDiff) { - if (Baritone.settings().pythagoreanMetric.get()) { - return Math.sqrt(xDiff * xDiff + zDiff * zDiff) * Baritone.settings().costHeuristic.get(); - } //This is a combination of pythagorean and manhattan distance //It takes into account the fact that pathing can either walk diagonally or forwards From 13628789c8d97a3f106807c7a1bb470c6cf1930d Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 13 Sep 2018 15:10:29 -0500 Subject: [PATCH 024/120] We should only care about real client-sided packet flow Prior to this commit, IntegratedServer packets would be picked up by PacketEvent --- .../launch/mixins/MixinNetworkManager.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java b/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java index b0fedc62..d1e6a2d5 100644 --- a/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java +++ b/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java @@ -24,8 +24,10 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GenericFutureListener; +import net.minecraft.network.EnumPacketDirection; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -42,12 +44,18 @@ public class MixinNetworkManager { @Shadow private Channel channel; + @Shadow + @Final + private EnumPacketDirection direction; + @Inject( method = "dispatchPacket", at = @At("HEAD") ) private void preDispatchPacket(Packet inPacket, final GenericFutureListener>[] futureListeners, CallbackInfo ci) { - Baritone.INSTANCE.getGameEventHandler().onSendPacket(new PacketEvent(EventState.PRE, inPacket)); + if (this.direction == EnumPacketDirection.CLIENTBOUND) { + Baritone.INSTANCE.getGameEventHandler().onSendPacket(new PacketEvent(EventState.PRE, inPacket)); + } } @Inject( @@ -55,7 +63,9 @@ public class MixinNetworkManager { at = @At("RETURN") ) private void postDispatchPacket(Packet inPacket, final GenericFutureListener>[] futureListeners, CallbackInfo ci) { - Baritone.INSTANCE.getGameEventHandler().onSendPacket(new PacketEvent(EventState.POST, inPacket)); + if (this.direction == EnumPacketDirection.CLIENTBOUND) { + Baritone.INSTANCE.getGameEventHandler().onSendPacket(new PacketEvent(EventState.POST, inPacket)); + } } @Inject( @@ -66,7 +76,8 @@ public class MixinNetworkManager { ) ) private void preProcessPacket(ChannelHandlerContext context, Packet packet, CallbackInfo ci) { - Baritone.INSTANCE.getGameEventHandler().onReceivePacket(new PacketEvent(EventState.PRE, packet)); + if (this.direction == EnumPacketDirection.CLIENTBOUND) { + Baritone.INSTANCE.getGameEventHandler().onReceivePacket(new PacketEvent(EventState.PRE, packet));} } @Inject( @@ -74,7 +85,7 @@ public class MixinNetworkManager { at = @At("RETURN") ) private void postProcessPacket(ChannelHandlerContext context, Packet packet, CallbackInfo ci) { - if (this.channel.isOpen()) { + if (this.channel.isOpen() && this.direction == EnumPacketDirection.CLIENTBOUND) { Baritone.INSTANCE.getGameEventHandler().onReceivePacket(new PacketEvent(EventState.POST, packet)); } } From 33a0a2a7f9e659fd7ba56c166acb7931192d5ba5 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 13 Sep 2018 15:39:48 -0700 Subject: [PATCH 025/120] derp --- src/main/java/baritone/utils/ExampleBaritoneControl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index b418f067..da201494 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -238,7 +238,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().equals("save")) { + if (msg.toLowerCase().startsWith("save")) { String name = msg.substring(4).trim(); WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint(name, Waypoint.Tag.HOME, playerFeet())); logDirect("Saved user defined tag under name '" + name + "'. Say 'goto user' to set goal, say 'list user' to list."); From 924cea342baf05bb0293ab39e9f796d749ef43af Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 13 Sep 2018 15:41:00 -0700 Subject: [PATCH 026/120] user defined not home --- src/main/java/baritone/utils/ExampleBaritoneControl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index da201494..7a9326c2 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -240,7 +240,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { } if (msg.toLowerCase().startsWith("save")) { String name = msg.substring(4).trim(); - WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint(name, Waypoint.Tag.HOME, playerFeet())); + WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint(name, Waypoint.Tag.USER, playerFeet())); logDirect("Saved user defined tag under name '" + name + "'. Say 'goto user' to set goal, say 'list user' to list."); event.cancel(); return; From e3830643f6bc93faa5391f8f1781a2a76c0fefc2 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 13 Sep 2018 16:18:26 -0700 Subject: [PATCH 027/120] only fail on movement cost increase if calced through cached, fixes #165 --- .../pathing/calc/AbstractNodeCostSearch.java | 1 + src/main/java/baritone/pathing/calc/Path.java | 17 ++++++++++++++++- .../baritone/pathing/movement/Movement.java | 11 +++++++++++ src/main/java/baritone/pathing/path/IPath.java | 6 ++++++ .../baritone/pathing/path/PathExecutor.java | 2 +- 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index 2432699a..2f376082 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -83,6 +83,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { this.cancelRequested = false; try { Optional path = calculate0(timeout); + path.ifPresent(IPath::postprocess); isFinished = true; return path; } catch (Exception e) { diff --git a/src/main/java/baritone/pathing/calc/Path.java b/src/main/java/baritone/pathing/calc/Path.java index 96c8950e..d0ad696e 100644 --- a/src/main/java/baritone/pathing/calc/Path.java +++ b/src/main/java/baritone/pathing/calc/Path.java @@ -54,6 +54,8 @@ class Path implements IPath { private final int numNodes; + private volatile boolean verified; + Path(PathNode start, PathNode end, int numNodes) { this.start = start.pos; this.end = end.pos; @@ -61,7 +63,6 @@ class Path implements IPath { this.path = new ArrayList<>(); this.movements = new ArrayList<>(); assemblePath(start, end); - sanityCheck(); } /** @@ -116,8 +117,22 @@ class Path implements IPath { } } + @Override + public void postprocess() { + if (verified) { + throw new IllegalStateException(); + } + verified = true; + // more post processing here + movements.forEach(Movement::checkLoadedChunk); + sanityCheck(); + } + @Override public List movements() { + if (!verified) { + throw new IllegalStateException(); + } return Collections.unmodifiableList(movements); } diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 0c59bfc0..5aaf1be1 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -26,6 +26,7 @@ import baritone.utils.pathing.BetterBlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.chunk.EmptyChunk; import java.util.ArrayList; import java.util.Arrays; @@ -290,6 +291,16 @@ public abstract class Movement implements Helper, MovementHelper { return getDest().subtract(getSrc()); } + private Boolean calculatedWhileLoaded; + + public void checkLoadedChunk() { + calculatedWhileLoaded = !(world().getChunk(getDest()) instanceof EmptyChunk); + } + + public boolean calculatedWhileLoaded() { + return calculatedWhileLoaded; + } + public List toBreakCached = null; public List toPlaceCached = null; public List toWalkIntoCached = null; diff --git a/src/main/java/baritone/pathing/path/IPath.java b/src/main/java/baritone/pathing/path/IPath.java index 575aacb1..c9b473b5 100644 --- a/src/main/java/baritone/pathing/path/IPath.java +++ b/src/main/java/baritone/pathing/path/IPath.java @@ -49,6 +49,12 @@ public interface IPath extends Helper { */ List positions(); + /** + * This path is actually going to be executed in the world. Do whatever additional processing is required. + * (as opposed to Path objects that are just constructed every frame for rendering) + */ + default void postprocess() {} + /** * Number of positions in this path * diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index ab132ca0..8506eeb7 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -236,7 +236,7 @@ public class PathExecutor implements Helper { Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); return true; } - if (currentCost - currentMovementInitialCostEstimate > Baritone.settings().maxCostIncrease.get()) { + if (!movement.calculatedWhileLoaded() && currentCost - currentMovementInitialCostEstimate > Baritone.settings().maxCostIncrease.get()) { logDebug("Original cost " + currentMovementInitialCostEstimate + " current cost " + currentCost + ". Cancelling."); pathPosition = path.length() + 3; failed = true; From 7d0914bd43a7cf0536b6b769c1d880a794bf29ef Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 13 Sep 2018 16:40:55 -0700 Subject: [PATCH 028/120] don't crash on thisway typo lol --- .../java/baritone/utils/ExampleBaritoneControl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 7a9326c2..dab4ca01 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -209,9 +209,13 @@ public class ExampleBaritoneControl extends Behavior implements Helper { return; } if (msg.toLowerCase().startsWith("thisway")) { - Goal goal = GoalXZ.fromDirection(playerFeetAsVec(), player().rotationYaw, Double.parseDouble(msg.substring(7).trim())); - PathingBehavior.INSTANCE.setGoal(goal); - logDirect("Goal: " + goal); + try { + Goal goal = GoalXZ.fromDirection(playerFeetAsVec(), player().rotationYaw, Double.parseDouble(msg.substring(7).trim())); + PathingBehavior.INSTANCE.setGoal(goal); + logDirect("Goal: " + goal); + } catch (NumberFormatException ex) { + logDirect("Error unable to parse '" + msg.substring(7).trim() + "' to a double."); + } event.cancel(); return; } From 5f9b6683ac205fec481b7e1212d85b1377c04648 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 13 Sep 2018 17:01:16 -0700 Subject: [PATCH 029/120] update prebuilt jar --- IMPACT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPACT.md b/IMPACT.md index 4c552963..bfa61776 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -2,7 +2,7 @@ Baritone will be in Impact 4.4 with nice integrations with its utility modules, but if you're impatient you can run Baritone on top of Impact 4.3 right now. -You can either build Baritone yourself, or download the jar (as of commit 315c1bf, built on September 12) from here. +You can either build Baritone yourself, or download the jar (as of commit 7d0914b, built on September 13) from here. To build it yourself, clone and setup Baritone (instructions in main README.md). Then, build the jar. From the command line, it's `./gradlew build` (or `gradlew build` on Windows). In IntelliJ, you can just start the `build` task in the Gradle menu. From 853cbf355453cdfae8dd3b8dbf608eee7a5ae612 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 13 Sep 2018 18:00:08 -0700 Subject: [PATCH 030/120] add waypoint user --- src/main/java/baritone/cache/Waypoint.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/cache/Waypoint.java b/src/main/java/baritone/cache/Waypoint.java index 7cd5ace3..a8f162a5 100644 --- a/src/main/java/baritone/cache/Waypoint.java +++ b/src/main/java/baritone/cache/Waypoint.java @@ -21,7 +21,8 @@ import com.google.common.collect.ImmutableList; import net.minecraft.util.math.BlockPos; import org.apache.commons.lang3.ArrayUtils; -import java.util.*; +import java.util.Date; +import java.util.List; /** * A single waypoint @@ -75,7 +76,7 @@ public class Waypoint { HOME("home", "base"), DEATH("death"), BED("bed", "spawn"), - USER(); + USER("user"); private static final List TAG_LIST = ImmutableList.builder().add(Tag.values()).build(); From 6b45b847846d3b5032d38b9f17ea80c7c470ef00 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 13 Sep 2018 18:40:50 -0700 Subject: [PATCH 031/120] special request from plutie#9079 --- src/main/java/baritone/cache/CachedChunk.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/baritone/cache/CachedChunk.java b/src/main/java/baritone/cache/CachedChunk.java index a79d3733..7ef5b429 100644 --- a/src/main/java/baritone/cache/CachedChunk.java +++ b/src/main/java/baritone/cache/CachedChunk.java @@ -63,6 +63,7 @@ public final class CachedChunk implements IBlockTypeAccess { add(Blocks.DRAGON_EGG); add(Blocks.JUKEBOX); add(Blocks.END_GATEWAY); + add(Blocks.WEB); }}); /** From d7a646789e6f5a804db095830d3e64c9547ce1dc Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 08:40:34 -0700 Subject: [PATCH 032/120] fixes to parkour place --- src/main/java/baritone/Settings.java | 5 +++++ .../movement/movements/MovementParkour.java | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index eb673efd..fddb7bce 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -104,6 +104,11 @@ public class Settings { */ public Setting allowParkour = new Setting<>(false); + /** + * Like parkour, but even more unreliable! + */ + public Setting allowParkourPlace = new Setting<>(false); + /** * For example, if you have Mining Fatigue or Haste, adjust the costs of breaking blocks accordingly. */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index dc586fac..130d7244 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -81,7 +81,7 @@ public class MovementParkour extends Movement { if (!MovementHelper.fullyPassable(src.up(2))) { return null; } - for (int i = 2; i <= 4; i++) { + for (int i = 2; i <= (context.canSprint() ? 4 : 3); i++) { BlockPos dest = src.offset(dir, i); // TODO perhaps dest.up(3) doesn't need to be fullyPassable, just canWalkThrough, possibly? for (int y = 0; y < 4; y++) { @@ -93,6 +93,12 @@ public class MovementParkour extends Movement { return new MovementParkour(src, i, dir); } } + if (!context.canSprint()) { + return null; + } + if (!Baritone.settings().allowParkourPlace.get()) { + return null; + } BlockPos dest = src.offset(dir, 4); BlockPos positionToPlace = dest.down(); IBlockState toPlace = BlockStateInterface.get(positionToPlace); @@ -133,11 +139,17 @@ public class MovementParkour extends Movement { @Override protected double calculateCost(CalculationContext context) { // MUST BE KEPT IN SYNC WITH generate + if (!context.canSprint() && dist >= 4) { + return COST_INF; + } boolean placing = false; if (!MovementHelper.canWalkOn(dest.down())) { if (dist != 4) { return COST_INF; } + if (!Baritone.settings().allowParkourPlace.get()) { + return COST_INF; + } BlockPos positionToPlace = dest.down(); IBlockState toPlace = BlockStateInterface.get(positionToPlace); if (!context.hasThrowaway()) { From a38da64c4900e57b64b8774f766eed44a35134a1 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 09:05:29 -0700 Subject: [PATCH 033/120] make the left click workaround optional --- src/main/java/baritone/Settings.java | 8 +++++++ .../baritone/pathing/movement/Movement.java | 21 ++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index fddb7bce..895f76a4 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -314,6 +314,14 @@ public class Settings { */ public Setting prefix = new Setting<>(false); + /** + * true: can mine blocks when in inventory, chat, or tabbed away in ESC menu + * false: works on cosmic prisons + *

+ * LOL + */ + public Setting leftClickWorkaround = new Setting<>(true); + public final Map> byLowerName; public final List> allSettings; diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 5aaf1be1..b574a91b 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -119,18 +119,19 @@ public abstract class Movement implements Helper, MovementHelper { this.didBreakLastTick = false; latestState.getInputStates().forEach((input, forced) -> { - RayTraceResult trace = mc.objectMouseOver; - boolean isBlockTrace = trace != null && trace.typeOfHit == RayTraceResult.Type.BLOCK; - boolean isLeftClick = forced && input == Input.CLICK_LEFT; + if (Baritone.settings().leftClickWorkaround.get()) { + RayTraceResult trace = mc.objectMouseOver; + boolean isBlockTrace = trace != null && trace.typeOfHit == RayTraceResult.Type.BLOCK; + boolean isLeftClick = forced && input == Input.CLICK_LEFT; - // If we're forcing left click, we're in a gui screen, and we're looking - // at a block, break the block without a direct game input manipulation. - if (mc.currentScreen != null && isLeftClick && isBlockTrace) { - BlockBreakHelper.tryBreakBlock(trace.getBlockPos(), trace.sideHit); - this.didBreakLastTick = true; - return; + // If we're forcing left click, we're in a gui screen, and we're looking + // at a block, break the block without a direct game input manipulation. + if (mc.currentScreen != null && isLeftClick && isBlockTrace) { + BlockBreakHelper.tryBreakBlock(trace.getBlockPos(), trace.sideHit); + this.didBreakLastTick = true; + return; + } } - Baritone.INSTANCE.getInputOverrideHandler().setInputForceState(input, forced); }); latestState.getInputStates().replaceAll((input, forced) -> false); From 001070d40668db5745c37133b71ac554b420c32d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 09:21:52 -0700 Subject: [PATCH 034/120] more robust path destination verification --- .../baritone/api/event/events/PathEvent.java | 3 +- .../baritone/api/event/events/TickEvent.java | 7 ++++ .../java/baritone/behavior/MineBehavior.java | 36 +++++++++++++++---- .../pathing/calc/AStarPathFinder.java | 4 +-- .../pathing/calc/AbstractNodeCostSearch.java | 4 +-- src/main/java/baritone/pathing/calc/Path.java | 11 +++++- .../baritone/pathing/path/CutoffPath.java | 9 +++++ .../java/baritone/pathing/path/IPath.java | 7 ++++ .../utils/ExampleBaritoneControl.java | 4 +-- 9 files changed, 71 insertions(+), 14 deletions(-) diff --git a/src/api/java/baritone/api/event/events/PathEvent.java b/src/api/java/baritone/api/event/events/PathEvent.java index a3fee3f8..c134ba96 100644 --- a/src/api/java/baritone/api/event/events/PathEvent.java +++ b/src/api/java/baritone/api/event/events/PathEvent.java @@ -28,5 +28,6 @@ public enum PathEvent { AT_GOAL, PATH_FINISHED_NEXT_STILL_CALCULATING, NEXT_CALC_FAILED, - DISCARD_NEXT + DISCARD_NEXT, + CANCELED; } diff --git a/src/api/java/baritone/api/event/events/TickEvent.java b/src/api/java/baritone/api/event/events/TickEvent.java index e82c31ad..362a88cc 100644 --- a/src/api/java/baritone/api/event/events/TickEvent.java +++ b/src/api/java/baritone/api/event/events/TickEvent.java @@ -24,9 +24,16 @@ public final class TickEvent { private final EventState state; private final Type type; + private static int count; + public TickEvent(EventState state, Type type) { this.state = state; this.type = type; + count++; + } + + public int getCount() { + return count; } public Type getType() { diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 2dbb0dbb..6d9564bd 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -17,8 +17,9 @@ package baritone.behavior; -import baritone.api.event.events.PathEvent; import baritone.api.behavior.Behavior; +import baritone.api.event.events.PathEvent; +import baritone.api.event.events.TickEvent; import baritone.cache.CachedChunk; import baritone.cache.ChunkPacker; import baritone.cache.WorldProvider; @@ -26,16 +27,14 @@ import baritone.cache.WorldScanner; import baritone.pathing.goals.Goal; import baritone.pathing.goals.GoalComposite; import baritone.pathing.goals.GoalTwoBlocks; +import baritone.pathing.path.IPath; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; import net.minecraft.block.Block; import net.minecraft.util.math.BlockPos; import net.minecraft.world.chunk.EmptyChunk; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -52,6 +51,31 @@ public final class MineBehavior extends Behavior implements Helper { private List mining; + @Override + public void onTick(TickEvent event) { + if (mining == null) { + return; + } + if (event.getCount() % 5 == 0) { + updateGoal(); + } + Optional path = PathingBehavior.INSTANCE.getPath(); + if (!path.isPresent()) { + return; + } + Goal currentGoal = PathingBehavior.INSTANCE.getGoal(); + if (currentGoal == null) { + return; + } + Goal intended = path.get().getGoal(); + BlockPos end = path.get().getDest(); + if (intended.isInGoal(end) && !currentGoal.isInGoal(end)) { + // this path used to end in the goal + // but the goal has changed, so there's no reason to continue... + PathingBehavior.INSTANCE.cancel(); + } + } + @Override public void onPathEvent(PathEvent event) { updateGoal(); @@ -113,7 +137,7 @@ public final class MineBehavior extends Behavior implements Helper { } public void cancel() { - PathingBehavior.INSTANCE.cancel(); mine((String[]) null); + PathingBehavior.INSTANCE.cancel(); } } diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index 643df531..ddf61b7a 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -103,7 +103,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { if (goal.isInGoal(currentNodePos)) { currentlyRunning = null; logDebug("Took " + (System.nanoTime() / 1000000L - startTime) + "ms, " + numMovementsConsidered + " movements considered"); - return Optional.of(new Path(startNode, currentNode, numNodes)); + return Optional.of(new Path(startNode, currentNode, numNodes, goal)); } Movement[] possibleMovements = getConnectedPositions(currentNodePos, calcContext);//movement that we could take that start at currentNodePos, in random order shuffle(possibleMovements); @@ -199,7 +199,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { } System.out.println("Path goes for " + Math.sqrt(dist) + " blocks"); currentlyRunning = null; - return Optional.of(new Path(startNode, bestSoFar[i], numNodes)); + return Optional.of(new Path(startNode, bestSoFar[i], numNodes, goal)); } } logDebug("Even with a cost coefficient of " + COEFFICIENTS[COEFFICIENTS.length - 1] + ", I couldn't get more than " + Math.sqrt(bestDist) + " blocks"); diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index 2f376082..3b8bfade 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -140,7 +140,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { @Override public Optional pathToMostRecentNodeConsidered() { - return Optional.ofNullable(mostRecentConsidered).map(node -> new Path(startNode, node, 0)); + return Optional.ofNullable(mostRecentConsidered).map(node -> new Path(startNode, node, 0, goal)); } @Override @@ -153,7 +153,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { continue; } if (getDistFromStartSq(bestSoFar[i]) > MIN_DIST_PATH * MIN_DIST_PATH) { // square the comparison since distFromStartSq is squared - return Optional.of(new Path(startNode, bestSoFar[i], 0)); + return Optional.of(new Path(startNode, bestSoFar[i], 0, goal)); } } // instead of returning bestSoFar[0], be less misleading diff --git a/src/main/java/baritone/pathing/calc/Path.java b/src/main/java/baritone/pathing/calc/Path.java index d0ad696e..bec1e3a0 100644 --- a/src/main/java/baritone/pathing/calc/Path.java +++ b/src/main/java/baritone/pathing/calc/Path.java @@ -17,6 +17,7 @@ package baritone.pathing.calc; +import baritone.pathing.goals.Goal; import baritone.pathing.movement.Movement; import baritone.pathing.path.IPath; import baritone.utils.pathing.BetterBlockPos; @@ -52,19 +53,27 @@ class Path implements IPath { final List movements; + final Goal goal; + private final int numNodes; private volatile boolean verified; - Path(PathNode start, PathNode end, int numNodes) { + Path(PathNode start, PathNode end, int numNodes, Goal goal) { this.start = start.pos; this.end = end.pos; this.numNodes = numNodes; this.path = new ArrayList<>(); this.movements = new ArrayList<>(); + this.goal = goal; assemblePath(start, end); } + @Override + public Goal getGoal() { + return goal; + } + /** * Assembles this path given the start and end nodes. * diff --git a/src/main/java/baritone/pathing/path/CutoffPath.java b/src/main/java/baritone/pathing/path/CutoffPath.java index 51618918..ea10e8c5 100644 --- a/src/main/java/baritone/pathing/path/CutoffPath.java +++ b/src/main/java/baritone/pathing/path/CutoffPath.java @@ -17,6 +17,7 @@ package baritone.pathing.path; +import baritone.pathing.goals.Goal; import baritone.pathing.movement.Movement; import baritone.utils.pathing.BetterBlockPos; @@ -31,10 +32,18 @@ public class CutoffPath implements IPath { private final int numNodes; + final Goal goal; + public CutoffPath(IPath prev, int lastPositionToInclude) { path = prev.positions().subList(0, lastPositionToInclude + 1); movements = prev.movements().subList(0, lastPositionToInclude + 1); numNodes = prev.getNumNodesConsidered(); + goal = prev.getGoal(); + } + + @Override + public Goal getGoal() { + return goal; } @Override diff --git a/src/main/java/baritone/pathing/path/IPath.java b/src/main/java/baritone/pathing/path/IPath.java index c9b473b5..5ab8f7aa 100644 --- a/src/main/java/baritone/pathing/path/IPath.java +++ b/src/main/java/baritone/pathing/path/IPath.java @@ -64,6 +64,13 @@ public interface IPath extends Helper { return positions().size(); } + /** + * What goal was this path calculated towards? + * + * @return + */ + Goal getGoal(); + default Tuple closestPathPos(double x, double y, double z) { double best = -1; BlockPos bestPos = null; diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index dab4ca01..65208d76 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -120,9 +120,9 @@ public class ExampleBaritoneControl extends Behavior implements Helper { return; } if (msg.toLowerCase().equals("cancel")) { - PathingBehavior.INSTANCE.cancel(); - FollowBehavior.INSTANCE.cancel(); MineBehavior.INSTANCE.cancel(); + FollowBehavior.INSTANCE.cancel(); + PathingBehavior.INSTANCE.cancel(); event.cancel(); logDirect("ok canceled"); return; From 1bd15e5d5bd23918d0c6fbe61716d56611aa1407 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 11:35:41 -0700 Subject: [PATCH 035/120] added link to plutie's jenkins --- IMPACT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPACT.md b/IMPACT.md index bfa61776..369dc664 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -2,7 +2,7 @@ Baritone will be in Impact 4.4 with nice integrations with its utility modules, but if you're impatient you can run Baritone on top of Impact 4.3 right now. -You can either build Baritone yourself, or download the jar (as of commit 7d0914b, built on September 13) from here. +You can either build Baritone yourself, or download the "official" jar (as of commit 7d0914b, built on September 13) from here. If you really want the cutting edge latest release, and you trust @Plutie#9079, commits are automatically built on their Jenkins here. To build it yourself, clone and setup Baritone (instructions in main README.md). Then, build the jar. From the command line, it's `./gradlew build` (or `gradlew build` on Windows). In IntelliJ, you can just start the `build` task in the Gradle menu. From 7d94cb259fc7e19b487d390c7f72bc316159d649 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 12:24:53 -0700 Subject: [PATCH 036/120] world scanner do 1 chunk only if blocks at same y have been found --- src/main/java/baritone/cache/WorldScanner.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index 975683d1..76118093 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -44,8 +44,10 @@ public enum WorldScanner implements Helper { int playerChunkX = playerFeet().getX() >> 4; int playerChunkZ = playerFeet().getZ() >> 4; + int playerY = playerFeet().getY(); int searchRadiusSq = 0; + boolean foundWithinY = false; while (true) { boolean allUnloaded = true; for (int xoff = -searchRadiusSq; xoff <= searchRadiusSq; xoff++) { @@ -78,7 +80,11 @@ public enum WorldScanner implements Helper { for (int x = 0; x < 16; x++) { IBlockState state = bsc.get(x, y, z); if (blocks.contains(state.getBlock())) { - res.add(new BlockPos(chunkX | x, yReal | y, chunkZ | z)); + int yy = yReal | y; + res.add(new BlockPos(chunkX | x, yy, chunkZ | z)); + if (Math.abs(yy - playerY) < 10) { + foundWithinY = true; + } } } } @@ -89,7 +95,7 @@ public enum WorldScanner implements Helper { if (allUnloaded) { return res; } - if (res.size() >= max && searchRadiusSq > 26) { + if (res.size() >= max && (searchRadiusSq > 26 || (searchRadiusSq > 1 && foundWithinY))) { return res; } searchRadiusSq++; From 29391af5ad76386f27037f8c98f902857d46f81a Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 15:57:46 -0700 Subject: [PATCH 037/120] solidarity --- .../pathing/movement/movements/MovementParkour.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 130d7244..1d0dcdd4 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -191,13 +191,8 @@ public class MovementParkour extends Movement { @Override public MovementState updateState(MovementState state) { super.updateState(state); - switch (state.getStatus()) { - case WAITING: - state.setStatus(MovementState.MovementStatus.RUNNING); - case RUNNING: - break; - default: - return state; + if (state.getStatus() != MovementState.MovementStatus.RUNNING) { + return state; } if (dist >= 4) { state.setInput(InputOverrideHandler.Input.SPRINT, true); From 13cfb8e3696c221f8d87b2b5d49bcbc19f7e5e07 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 16:45:51 -0700 Subject: [PATCH 038/120] walkWhileBreaking, fixes #147 --- src/main/java/baritone/Settings.java | 5 +++ .../movement/movements/MovementTraverse.java | 32 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 895f76a4..cb2f4632 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -322,6 +322,11 @@ public class Settings { */ public Setting leftClickWorkaround = new Setting<>(true); + /** + * Don't stop walking forward when you need to break blocks in your way + */ + public Setting walkWhileBreaking = new Setting<>(true); + public final Map> byLowerName; public final List> allSettings; diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index 2dfd9311..36c0cfc9 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -25,6 +25,7 @@ import baritone.pathing.movement.MovementHelper; import baritone.pathing.movement.MovementState; import baritone.utils.BlockStateInterface; import baritone.utils.InputOverrideHandler; +import baritone.utils.Rotation; import baritone.utils.Utils; import baritone.utils.pathing.BetterBlockPos; import net.minecraft.block.*; @@ -131,8 +132,37 @@ public class MovementTraverse extends Movement { public MovementState updateState(MovementState state) { super.updateState(state); if (state.getStatus() != MovementState.MovementStatus.RUNNING) { - return state; + // if the setting is enabled + if (!Baritone.settings().walkWhileBreaking.get()) { + return state; + } + // and if we're prepping (aka mining the block in front) + if (state.getStatus() != MovementState.MovementStatus.PREPPING) { + return state; + } + // and if it's fine to walk into the blocks in front + if (MovementHelper.avoidWalkingInto(BlockStateInterface.get(positionsToBreak[0]).getBlock())) { + return state; + } + if (MovementHelper.avoidWalkingInto(BlockStateInterface.get(positionsToBreak[1]).getBlock())) { + return state; + } + // and we aren't already pressed up against the block + double dist = Math.max(Math.abs(player().posX - (dest.getX() + 0.5D)), Math.abs(player().posZ - (dest.getZ() + 0.5D))); + if (dist < 0.83) { + return state; + } + + // combine the yaw to the center of the destination, and the pitch to the specific block we're trying to break + // it's safe to do this since the two blocks we break (in a traverse) are right on top of each other and so will have the same yaw + float yawToDest = Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(dest, world())).getFirst(); + float pitchToBreak = state.getTarget().getRotation().get().getSecond(); + + state.setTarget(new MovementState.MovementTarget(new Rotation(yawToDest, pitchToBreak), true)); + return state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, true); } + + //sneak may have been set to true in the PREPPING state while mining an adjacent block state.setInput(InputOverrideHandler.Input.SNEAK, false); Block fd = BlockStateInterface.get(src.down()).getBlock(); From 12b64ead5ca182be5944b8656546f6de00ce167e Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 18:29:35 -0700 Subject: [PATCH 039/120] a much needed path executor overhaul --- .../api/event/events/type/EventState.java | 2 +- .../baritone/pathing/movement/Movement.java | 1 + .../java/baritone/pathing/path/IPath.java | 4 +- .../baritone/pathing/path/PathExecutor.java | 206 +++++++++--------- .../baritone/utils/InputOverrideHandler.java | 3 +- src/main/java/baritone/utils/Utils.java | 11 + 6 files changed, 119 insertions(+), 108 deletions(-) diff --git a/src/api/java/baritone/api/event/events/type/EventState.java b/src/api/java/baritone/api/event/events/type/EventState.java index a7fccff1..bba516a6 100644 --- a/src/api/java/baritone/api/event/events/type/EventState.java +++ b/src/api/java/baritone/api/event/events/type/EventState.java @@ -31,7 +31,7 @@ public enum EventState { /** * Indicates that whatever movement the event is being - * dispatched as a result of has already occured. + * dispatched as a result of has already occurred. */ POST } diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index b574a91b..5c7aae36 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -102,6 +102,7 @@ public abstract class Movement implements Helper, MovementHelper { * @return Status */ public MovementStatus update() { + player().capabilities.allowFlying = false; MovementState latestState = updateState(currentState); if (BlockStateInterface.isLiquid(playerFeet())) { latestState.setInput(Input.JUMP, true); diff --git a/src/main/java/baritone/pathing/path/IPath.java b/src/main/java/baritone/pathing/path/IPath.java index 5ab8f7aa..f007f899 100644 --- a/src/main/java/baritone/pathing/path/IPath.java +++ b/src/main/java/baritone/pathing/path/IPath.java @@ -71,11 +71,11 @@ public interface IPath extends Helper { */ Goal getGoal(); - default Tuple closestPathPos(double x, double y, double z) { + default Tuple closestPathPos() { double best = -1; BlockPos bestPos = null; for (BlockPos pos : positions()) { - double dist = Utils.distanceToCenter(pos, x, y, z); + double dist = Utils.playerDistanceToCenter(pos); if (dist < best || best == -1) { best = dist; bestPos = pos; diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 8506eeb7..734849ca 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -26,7 +26,7 @@ import baritone.pathing.movement.movements.MovementFall; import baritone.pathing.movement.movements.MovementTraverse; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; -import net.minecraft.client.entity.EntityPlayerSP; +import baritone.utils.Utils; import net.minecraft.init.Blocks; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; @@ -75,18 +75,11 @@ public class PathExecutor implements Helper { if (event.getType() == TickEvent.Type.OUT) { throw new IllegalStateException(); } - if (pathPosition >= path.length()) { - //stop bugging me, I'm done - //TODO Baritone.INSTANCE.behaviors.remove(this) - return true; + if (pathPosition >= path.length() - 1) { + return true; // stop bugging me, I'm done } BlockPos whereShouldIBe = path.positions().get(pathPosition); - EntityPlayerSP thePlayer = mc.player; BlockPos whereAmI = playerFeet(); - if (pathPosition == path.length() - 1) { - pathPosition++; - return true; - } if (!whereShouldIBe.equals(whereAmI)) { //System.out.println("Should be at " + whereShouldIBe + " actually am at " + whereAmI); if (!Blocks.AIR.equals(BlockStateInterface.getBlock(whereAmI.down()))) {//do not skip if standing on air, because our position isn't stable to skip @@ -98,7 +91,7 @@ public class PathExecutor implements Helper { for (int j = pathPosition; j <= previousPos; j++) { path.movements().get(j).reset(); } - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); + clearKeys(); return false; } } @@ -109,38 +102,28 @@ public class PathExecutor implements Helper { } System.out.println("Double skip sundae"); pathPosition = i - 1; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); + clearKeys(); return false; } } } } - Tuple status = path.closestPathPos(thePlayer.posX, thePlayer.posY, thePlayer.posZ); - double distanceFromPath = status.getFirst(); - if (distanceFromPath > MAX_DIST_FROM_PATH) { + Tuple status = path.closestPathPos(); + if (possiblyOffPath(status, MAX_DIST_FROM_PATH)) { ticksAway++; - System.out.println("FAR AWAY FROM PATH FOR " + ticksAway + " TICKS. Current distance: " + distanceFromPath + ". Threshold: " + MAX_DIST_FROM_PATH); + System.out.println("FAR AWAY FROM PATH FOR " + ticksAway + " TICKS. Current distance: " + status.getFirst() + ". Threshold: " + MAX_DIST_FROM_PATH); if (ticksAway > MAX_TICKS_AWAY) { logDebug("Too far away from path for too long, cancelling path"); - System.out.println("Too many ticks"); - pathPosition = path.length() + 3; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); - failed = true; + cancel(); return false; } } else { ticksAway = 0; } - if (distanceFromPath > MAX_MAX_DIST_FROM_PATH) { - if (!(path.movements().get(pathPosition) instanceof MovementFall)) { // might be midair - if (pathPosition == 0 || !(path.movements().get(pathPosition - 1) instanceof MovementFall)) { // might have overshot the landing - logDebug("too far from path"); - pathPosition = path.length() + 3; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); - failed = true; - return false; - } - } + if (possiblyOffPath(status, MAX_MAX_DIST_FROM_PATH)) { // ok, stop right away, we're way too far. + logDebug("too far from path"); + cancel(); + return false; } //this commented block is literally cursed. /*Out.log(actions.get(pathPosition)); @@ -176,23 +159,24 @@ public class PathExecutor implements Helper { }*/ long start = System.nanoTime() / 1000000L; for (int i = pathPosition - 10; i < pathPosition + 10; i++) { - if (i >= 0 && i < path.movements().size()) { - Movement m = path.movements().get(i); - HashSet prevBreak = new HashSet<>(m.toBreak()); - HashSet prevPlace = new HashSet<>(m.toPlace()); - HashSet prevWalkInto = new HashSet<>(m.toWalkInto()); - m.toBreakCached = null; - m.toPlaceCached = null; - m.toWalkIntoCached = null; - if (!prevBreak.equals(new HashSet<>(m.toBreak()))) { - recalcBP = true; - } - if (!prevPlace.equals(new HashSet<>(m.toPlace()))) { - recalcBP = true; - } - if (!prevWalkInto.equals(new HashSet<>(m.toWalkInto()))) { - recalcBP = true; - } + if (i < 0 || i >= path.movements().size()) { + continue; + } + Movement m = path.movements().get(i); + HashSet prevBreak = new HashSet<>(m.toBreak()); + HashSet prevPlace = new HashSet<>(m.toPlace()); + HashSet prevWalkInto = new HashSet<>(m.toWalkInto()); + m.toBreakCached = null; + m.toPlaceCached = null; + m.toWalkIntoCached = null; + if (!prevBreak.equals(new HashSet<>(m.toBreak()))) { + recalcBP = true; + } + if (!prevPlace.equals(new HashSet<>(m.toPlace()))) { + recalcBP = true; + } + if (!prevWalkInto.equals(new HashSet<>(m.toWalkInto()))) { + recalcBP = true; } } if (recalcBP) { @@ -221,9 +205,7 @@ public class PathExecutor implements Helper { for (int i = 1; i < Baritone.settings().costVerificationLookahead.get() && pathPosition + i < path.length() - 1; i++) { if (path.movements().get(pathPosition + i).calculateCostWithoutCaching() >= ActionCosts.COST_INF) { logDebug("Something has changed in the world and a future movement has become impossible. Cancelling."); - pathPosition = path.length() + 3; - failed = true; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); + cancel(); return true; } } @@ -231,108 +213,98 @@ public class PathExecutor implements Helper { double currentCost = movement.recalculateCost(); if (currentCost >= ActionCosts.COST_INF) { logDebug("Something has changed in the world and this movement has become impossible. Cancelling."); - pathPosition = path.length() + 3; - failed = true; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); + cancel(); return true; } if (!movement.calculatedWhileLoaded() && currentCost - currentMovementInitialCostEstimate > Baritone.settings().maxCostIncrease.get()) { logDebug("Original cost " + currentMovementInitialCostEstimate + " current cost " + currentCost + ". Cancelling."); - pathPosition = path.length() + 3; - failed = true; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); + cancel(); return true; } - player().capabilities.allowFlying = false; MovementState.MovementStatus movementStatus = movement.update(); if (movementStatus == UNREACHABLE || movementStatus == FAILED) { logDebug("Movement returns status " + movementStatus); - pathPosition = path.length() + 3; - failed = true; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); + cancel(); return true; } if (movementStatus == SUCCESS) { //System.out.println("Movement done, next path"); pathPosition++; ticksOnCurrent = 0; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); + clearKeys(); onTick(event); return true; } else { sprintIfRequested(); ticksOnCurrent++; if (ticksOnCurrent > currentMovementInitialCostEstimate + Baritone.settings().movementTimeoutTicks.get()) { - // only fail if the total time has exceeded the initial estimate + // only cancel if the total time has exceeded the initial estimate // as you break the blocks required, the remaining cost goes down, to the point where // ticksOnCurrent is greater than recalculateCost + 100 // this is why we cache cost at the beginning, and don't recalculate for this comparison every tick logDebug("This movement has taken too long (" + ticksOnCurrent + " ticks, expected " + currentMovementInitialCostEstimate + "). Cancelling."); - movement.cancel(); - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); - pathPosition = path.length() + 3; - failed = true; + cancel(); return true; } } return false; // movement is in progress } + private boolean possiblyOffPath(Tuple status, double leniency) { + double distanceFromPath = status.getFirst(); + if (distanceFromPath > leniency) { + // when we're midair in the middle of a fall, we're very far from both the beginning and the end, but we aren't actually off path + if (path.movements().get(pathPosition) instanceof MovementFall) { + BlockPos fallDest = path.positions().get(pathPosition + 1); // .get(pathPosition) is the block we fell off of + if (Utils.playerFlatDistanceToCenter(fallDest) < 0.5) { + return false; + } + return true; + } else { + return true; + } + } else { + return false; + } + } + private void sprintIfRequested() { + + // first and foremost, if allowSprint is off, or if we don't have enough hunger, don't try and sprint if (!new CalculationContext().canSprint()) { player().setSprinting(false); return; } + + // if the movement requested sprinting, then we're done if (Baritone.INSTANCE.getInputOverrideHandler().isInputForcedDown(mc.gameSettings.keyBindSprint)) { if (!player().isSprinting()) { player().setSprinting(true); } return; } - Movement movement = path.movements().get(pathPosition); - if (movement instanceof MovementDescend && pathPosition < path.length() - 2) { - BlockPos descendStart = movement.getSrc(); - BlockPos descendEnd = movement.getDest(); - BlockPos into = descendEnd.subtract(descendStart.down()).add(descendEnd); - if (into.getY() != descendEnd.getY()) { - throw new IllegalStateException(); // sanity check - } - for (int i = 0; i <= 2; i++) { - if (MovementHelper.avoidWalkingInto(BlockStateInterface.getBlock(into.up(i)))) { + + // however, descend doesn't request sprinting, beceause it doesn't know the context of what movement comes after it + Movement current = path.movements().get(pathPosition); + if (current instanceof MovementDescend && pathPosition < path.length() - 2) { + + // (dest - src) + dest is offset 1 more in the same direction + // so it's the block we'd need to worry about running into if we decide to sprint straight through this descend + + BlockPos into = current.getDest().subtract(current.getSrc().down()).add(current.getDest()); + for (int y = 0; y <= 2; y++) { // we could hit any of the three blocks + if (MovementHelper.avoidWalkingInto(BlockStateInterface.getBlock(into.up(y)))) { logDebug("Sprinting would be unsafe"); player().setSprinting(false); return; } } + Movement next = path.movements().get(pathPosition + 1); - if (next instanceof MovementDescend) { - if (next.getDirection().equals(movement.getDirection())) { - if (playerFeet().equals(movement.getDest())) { - pathPosition++; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); - } - if (!player().isSprinting()) { - player().setSprinting(true); - } - return; - } - } - if (next instanceof MovementTraverse) { - if (next.getDirection().down().equals(movement.getDirection()) && MovementHelper.canWalkOn(next.getDest().down())) { - if (playerFeet().equals(movement.getDest())) { - pathPosition++; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); - } - if (!player().isSprinting()) { - player().setSprinting(true); - } - return; - } - } - if (next instanceof MovementDiagonal && Baritone.settings().allowOvershootDiagonalDescend.get()) { - if (playerFeet().equals(movement.getDest())) { + if (canSprintInto(current, next)) { + if (playerFeet().equals(current.getDest())) { pathPosition++; - Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); + clearKeys(); } if (!player().isSprinting()) { player().setSprinting(true); @@ -344,6 +316,34 @@ public class PathExecutor implements Helper { player().setSprinting(false); } + private static boolean canSprintInto(Movement current, Movement next) { + if (next instanceof MovementDescend) { + if (next.getDirection().equals(current.getDirection())) { + return true; + } + } + if (next instanceof MovementTraverse) { + if (next.getDirection().down().equals(current.getDirection()) && MovementHelper.canWalkOn(next.getDest().down())) { + return true; + } + } + if (next instanceof MovementDiagonal && Baritone.settings().allowOvershootDiagonalDescend.get()) { + return true; + } + return false; + } + + private static void clearKeys() { + // i'm just sick and tired of this snippet being everywhere lol + Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); + } + + private void cancel() { + clearKeys(); + pathPosition = path.length() + 3; + failed = true; + } + public int getPosition() { return pathPosition; } diff --git a/src/main/java/baritone/utils/InputOverrideHandler.java b/src/main/java/baritone/utils/InputOverrideHandler.java index 8540bcd4..6024df63 100755 --- a/src/main/java/baritone/utils/InputOverrideHandler.java +++ b/src/main/java/baritone/utils/InputOverrideHandler.java @@ -35,7 +35,6 @@ package baritone.utils; import net.minecraft.client.settings.KeyBinding; -import org.lwjgl.input.Keyboard; import java.util.HashMap; import java.util.Map; @@ -134,7 +133,7 @@ public final class InputOverrideHandler implements Helper { /** * The actual game {@link KeyBinding} being forced. */ - private KeyBinding keyBinding; + private final KeyBinding keyBinding; Input(KeyBinding keyBinding) { this.keyBinding = keyBinding; diff --git a/src/main/java/baritone/utils/Utils.java b/src/main/java/baritone/utils/Utils.java index 9f1ac3b3..4aedce6a 100755 --- a/src/main/java/baritone/utils/Utils.java +++ b/src/main/java/baritone/utils/Utils.java @@ -19,6 +19,7 @@ package baritone.utils; import net.minecraft.block.BlockFire; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -112,6 +113,16 @@ public final class Utils { return Math.sqrt(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff); } + public static double playerDistanceToCenter(BlockPos pos) { + EntityPlayerSP player = (new Helper() {}).player(); + return distanceToCenter(pos, player.posX, player.posY, player.posZ); + } + + public static double playerFlatDistanceToCenter(BlockPos pos) { + EntityPlayerSP player = (new Helper() {}).player(); + return distanceToCenter(pos, player.posX, pos.getY() + 0.5, player.posZ); + } + public static double degToRad(double deg) { return deg * DEG_TO_RAD; } From 5513d0669f0ccc97a619bd14488d9c6673492565 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 07:04:22 -0700 Subject: [PATCH 040/120] helps with nether fortresses --- src/main/java/baritone/cache/CachedChunk.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/baritone/cache/CachedChunk.java b/src/main/java/baritone/cache/CachedChunk.java index 7ef5b429..6705ffa5 100644 --- a/src/main/java/baritone/cache/CachedChunk.java +++ b/src/main/java/baritone/cache/CachedChunk.java @@ -64,6 +64,7 @@ public final class CachedChunk implements IBlockTypeAccess { add(Blocks.JUKEBOX); add(Blocks.END_GATEWAY); add(Blocks.WEB); + add(Blocks.NETHER_WART); }}); /** From 1745ce6a6241cd8e7c4d866ac52db5eed68981ba Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 07:38:53 -0700 Subject: [PATCH 041/120] fix wrong y coordinate on path beginning --- .../baritone/pathing/path/PathExecutor.java | 17 +++++++++++------ src/main/java/baritone/utils/Helper.java | 8 +++++--- .../baritone/utils/pathing/BetterBlockPos.java | 5 +++++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 734849ca..2b787a8a 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -20,13 +20,11 @@ package baritone.pathing.path; import baritone.Baritone; import baritone.api.event.events.TickEvent; import baritone.pathing.movement.*; -import baritone.pathing.movement.movements.MovementDescend; -import baritone.pathing.movement.movements.MovementDiagonal; -import baritone.pathing.movement.movements.MovementFall; -import baritone.pathing.movement.movements.MovementTraverse; +import baritone.pathing.movement.movements.*; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; import baritone.utils.Utils; +import baritone.utils.pathing.BetterBlockPos; import net.minecraft.init.Blocks; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; @@ -78,9 +76,16 @@ public class PathExecutor implements Helper { if (pathPosition >= path.length() - 1) { return true; // stop bugging me, I'm done } - BlockPos whereShouldIBe = path.positions().get(pathPosition); - BlockPos whereAmI = playerFeet(); + BetterBlockPos whereShouldIBe = path.positions().get(pathPosition); + BetterBlockPos whereAmI = playerFeet(); if (!whereShouldIBe.equals(whereAmI)) { + + if (pathPosition == 0 && whereAmI.equals(whereShouldIBe.up()) && Math.abs(player().motionY) < 0.1) { + // avoid the Wrong Y coordinate bug + new MovementDownward(whereAmI, whereShouldIBe).update(); + return false; + } + //System.out.println("Should be at " + whereShouldIBe + " actually am at " + whereAmI); if (!Blocks.AIR.equals(BlockStateInterface.getBlock(whereAmI.down()))) {//do not skip if standing on air, because our position isn't stable to skip for (int i = 0; i < pathPosition - 1 && i < path.length(); i++) {//this happens for example when you lag out and get teleported back a couple blocks diff --git a/src/main/java/baritone/utils/Helper.java b/src/main/java/baritone/utils/Helper.java index 9bcf082d..0b729014 100755 --- a/src/main/java/baritone/utils/Helper.java +++ b/src/main/java/baritone/utils/Helper.java @@ -18,11 +18,11 @@ package baritone.utils; import baritone.Baritone; +import baritone.utils.pathing.BetterBlockPos; import net.minecraft.block.BlockSlab; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; @@ -52,9 +52,9 @@ public interface Helper { return mc.world; } - default BlockPos playerFeet() { + default BetterBlockPos playerFeet() { // TODO find a better way to deal with soul sand!!!!! - BlockPos feet = new BlockPos(player().posX, player().posY + 0.1251, player().posZ); + BetterBlockPos feet = new BetterBlockPos(player().posX, player().posY + 0.1251, player().posZ); if (BlockStateInterface.get(feet).getBlock() instanceof BlockSlab) { return feet.up(); } @@ -75,6 +75,7 @@ public interface Helper { /** * Send a message to chat only if chatDebug is on + * * @param message */ default void logDebug(String message) { @@ -88,6 +89,7 @@ public interface Helper { /** * Send a message to chat regardless of chatDebug (should only be used for critically important messages, or as a direct response to a chat command) + * * @param message */ default void logDirect(String message) { diff --git a/src/main/java/baritone/utils/pathing/BetterBlockPos.java b/src/main/java/baritone/utils/pathing/BetterBlockPos.java index 895d982f..f908dd78 100644 --- a/src/main/java/baritone/utils/pathing/BetterBlockPos.java +++ b/src/main/java/baritone/utils/pathing/BetterBlockPos.java @@ -19,6 +19,7 @@ package baritone.utils.pathing; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3i; /** @@ -59,6 +60,10 @@ public final class BetterBlockPos extends BlockPos { this.hashCode = hash; } + public BetterBlockPos(double x, double y, double z) { + this(MathHelper.floor(x), MathHelper.floor(y), MathHelper.floor(z)); + } + public BetterBlockPos(BlockPos pos) { this(pos.getX(), pos.getY(), pos.getZ()); } From 9b375e1f5f5978f055b80595900f6460aaa56bbd Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 07:42:03 -0700 Subject: [PATCH 042/120] fix path not derendering once finished --- src/main/java/baritone/pathing/path/PathExecutor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 2b787a8a..23c82e83 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -73,7 +73,10 @@ public class PathExecutor implements Helper { if (event.getType() == TickEvent.Type.OUT) { throw new IllegalStateException(); } - if (pathPosition >= path.length() - 1) { + if (pathPosition == path.length() - 1) { + pathPosition++; + } + if (pathPosition >= path.length()) { return true; // stop bugging me, I'm done } BetterBlockPos whereShouldIBe = path.positions().get(pathPosition); From 19b47d77e5f24e859bd327d94e9e0d081ab25fc6 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 07:51:46 -0700 Subject: [PATCH 043/120] can still fall into water if assumeWalkOnWater is true --- .../pathing/movement/movements/MovementFall.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementFall.java b/src/main/java/baritone/pathing/movement/movements/MovementFall.java index dbcde285..ccdae099 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementFall.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementFall.java @@ -60,7 +60,8 @@ public class MovementFall extends Movement { return COST_INF; // falling onto a half slab is really glitchy, and can cause more fall damage than we'd expect } double placeBucketCost = 0.0; - if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > context.maxFallHeightNoWater()) { + boolean destIsWater = BlockStateInterface.isWater(dest); + if (!destIsWater && src.getY() - dest.getY() > context.maxFallHeightNoWater()) { if (!context.hasWaterBucket()) { return COST_INF; } @@ -88,7 +89,14 @@ public class MovementFall extends Movement { // And falling through signs is possible, but they do have a mining duration, right? if (MovementHelper.getMiningDurationTicks(context, positionsToBreak[i], false) > 0) { //can't break while falling - return COST_INF; + + if (i != positionsToBreak.length - 1 || !destIsWater) { + // if we're checking the very last block to mine + // and it's water (so this is a water fall) + // don't consider the cost of "mining" it + // (if assumeWalkOnWater is true, water isn't canWalkThrough) + return COST_INF; + } } } return WALK_OFF_BLOCK_COST + FALL_N_BLOCKS_COST[positionsToBreak.length - 1] + placeBucketCost + frontThree; From 0b30e822c269e40f622b43ce6e81fb5eb5b9eafb Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 08:00:24 -0700 Subject: [PATCH 044/120] fix flowing water detection for assumeWalkOnWater --- src/main/java/baritone/pathing/movement/MovementHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 8f886f7e..d602fdad 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -250,7 +250,7 @@ public interface MovementHelper extends ActionCosts, Helper { if (up instanceof BlockLilyPad) { return true; } - if (BlockStateInterface.isFlowing(state)) { + if (BlockStateInterface.isFlowing(state) || block == Blocks.FLOWING_WATER) { // the only scenario in which we can walk on flowing water is if it's under still water with jesus off return BlockStateInterface.isWater(up) && !Baritone.settings().assumeWalkOnWater.get(); } From 20ecab7d538cdfe3ce7f6ea42e9aa88f3e924156 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 08:14:57 -0700 Subject: [PATCH 045/120] fix breaking movementfall last block with assumeWalkOnWater --- README.md | 4 ++++ .../baritone/pathing/movement/movements/MovementFall.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 9204c4b9..f280d18a 100644 --- a/README.md +++ b/README.md @@ -57,3 +57,7 @@ Sure! (As long as usage is in compliance with the GPL 3 License) ## How is it so fast? Magic + +## Why is it called Baritone? + +It's named for FitMC's deep sultry voice. \ No newline at end of file diff --git a/src/main/java/baritone/pathing/movement/movements/MovementFall.java b/src/main/java/baritone/pathing/movement/movements/MovementFall.java index ccdae099..7875a937 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementFall.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementFall.java @@ -162,4 +162,9 @@ public class MovementFall extends Movement { } return toBreak; } + + @Override + protected boolean prepared(MovementState state) { + return true; + } } From 67c5a9caa02fc18b048d8dc419c16fa7b0f721f4 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 09:29:03 -0700 Subject: [PATCH 046/120] fix failure to break on fall --- .../pathing/movement/movements/MovementFall.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementFall.java b/src/main/java/baritone/pathing/movement/movements/MovementFall.java index 7875a937..60a5a0a5 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementFall.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementFall.java @@ -165,6 +165,16 @@ public class MovementFall extends Movement { @Override protected boolean prepared(MovementState state) { + if (state.getStatus() == MovementStatus.WAITING) { + return true; + } + // only break if one of the first three needs to be broken + // specifically ignore the last one which might be water + for (int i = 0; i < 4 && i < positionsToBreak.length; i++) { + if (!MovementHelper.canWalkThrough(positionsToBreak[i])) { + return super.prepared(state); + } + } return true; } } From b5a512963da3dfb506d703d7533d28aa58ba48af Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 10:04:48 -0700 Subject: [PATCH 047/120] don't get stuck on ascend, fixes #171 --- src/main/java/baritone/pathing/path/PathExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 23c82e83..4f955611 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -83,7 +83,7 @@ public class PathExecutor implements Helper { BetterBlockPos whereAmI = playerFeet(); if (!whereShouldIBe.equals(whereAmI)) { - if (pathPosition == 0 && whereAmI.equals(whereShouldIBe.up()) && Math.abs(player().motionY) < 0.1) { + if (pathPosition == 0 && whereAmI.equals(whereShouldIBe.up()) && Math.abs(player().motionY) < 0.1 && !(path.movements().get(0) instanceof MovementAscend) && !(path.movements().get(0) instanceof MovementPillar)) { // avoid the Wrong Y coordinate bug new MovementDownward(whereAmI, whereShouldIBe).update(); return false; From a978ddec08c36192fbccc55a81f67b87b9b9b70d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 10:34:02 -0700 Subject: [PATCH 048/120] mineGoalUpdateInterval and cancelOnGoalInvalidation --- src/main/java/baritone/Settings.java | 11 +++++++++++ src/main/java/baritone/behavior/MineBehavior.java | 11 +++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index cb2f4632..d14d75ee 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -327,6 +327,17 @@ public class Settings { */ public Setting walkWhileBreaking = new Setting<>(true); + /** + * Rescan for the goal once every 5 ticks. + * Set to 0 to disable. + */ + public Setting mineGoalUpdateInterval = new Setting<>(5); + + /** + * Cancel the current path if the goal has changed, and the path originally ended in the goal but doesn't anymore + */ + public Setting cancelOnGoalInvalidation = new Setting<>(true); + public final Map> byLowerName; public final List> allSettings; diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 6d9564bd..9a03b156 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -17,6 +17,7 @@ package baritone.behavior; +import baritone.Baritone; import baritone.api.behavior.Behavior; import baritone.api.event.events.PathEvent; import baritone.api.event.events.TickEvent; @@ -56,8 +57,14 @@ public final class MineBehavior extends Behavior implements Helper { if (mining == null) { return; } - if (event.getCount() % 5 == 0) { - updateGoal(); + int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.get(); + if (mineGoalUpdateInterval != 0) { + if (event.getCount() % mineGoalUpdateInterval == 0) { + updateGoal(); + } + } + if (!Baritone.settings().cancelOnGoalInvalidation.get()) { + return; } Optional path = PathingBehavior.INSTANCE.getPath(); if (!path.isPresent()) { From 27b9324cf14813552228ca74a2664a52f20ad499 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 12:51:37 -0700 Subject: [PATCH 049/120] add goal axis and fix movement fall path detection --- src/main/java/baritone/Settings.java | 5 ++ .../java/baritone/pathing/goals/GoalAxis.java | 54 +++++++++++++++++++ .../baritone/pathing/goals/GoalBlock.java | 4 +- .../pathing/goals/GoalGetToBlock.java | 5 ++ .../baritone/pathing/goals/GoalRunAway.java | 6 ++- .../java/baritone/pathing/goals/GoalXZ.java | 2 +- .../baritone/pathing/goals/GoalYLevel.java | 14 +++-- .../movement/movements/MovementFall.java | 19 ++++--- .../baritone/pathing/path/PathExecutor.java | 2 +- .../utils/ExampleBaritoneControl.java | 6 +++ 10 files changed, 100 insertions(+), 17 deletions(-) create mode 100644 src/main/java/baritone/pathing/goals/GoalAxis.java diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index d14d75ee..67ac6ab5 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -338,6 +338,11 @@ public class Settings { */ public Setting cancelOnGoalInvalidation = new Setting<>(true); + /** + * The "axis" command (aka GoalAxis) will go to a axis, or diagonal axis, at this Y level. + */ + public Setting axisHeight = new Setting<>(120); + public final Map> byLowerName; public final List> allSettings; diff --git a/src/main/java/baritone/pathing/goals/GoalAxis.java b/src/main/java/baritone/pathing/goals/GoalAxis.java new file mode 100644 index 00000000..9e6dc697 --- /dev/null +++ b/src/main/java/baritone/pathing/goals/GoalAxis.java @@ -0,0 +1,54 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Baritone. If not, see . + */ + +package baritone.pathing.goals; + +import baritone.Baritone; +import net.minecraft.util.math.BlockPos; + +public class GoalAxis implements Goal { + + private static final double SQRT_2_OVER_2 = Math.sqrt(2) / 2; + + @Override + public boolean isInGoal(BlockPos pos) { + int x = pos.getX(); + int y = pos.getY(); + int z = pos.getZ(); + return y == Baritone.settings().axisHeight.get() && (x == 0 || z == 0 || Math.abs(x) == Math.abs(z)); + } + + @Override + public double heuristic(BlockPos pos) { + int x = Math.abs(pos.getX()); + int y = pos.getY(); + int z = Math.abs(pos.getZ()); + + int shrt = Math.min(x, z); + int lng = Math.max(x, z); + int diff = lng - shrt; + + double flatAxisDistance = Math.min(x, Math.min(z, diff * SQRT_2_OVER_2)); + + return flatAxisDistance * Baritone.settings().costHeuristic.get() + GoalYLevel.calculate(Baritone.settings().axisHeight.get(), y); + } + + @Override + public String toString() { + return "GoalAxis"; + } +} diff --git a/src/main/java/baritone/pathing/goals/GoalBlock.java b/src/main/java/baritone/pathing/goals/GoalBlock.java index 9e6ea556..124740a3 100644 --- a/src/main/java/baritone/pathing/goals/GoalBlock.java +++ b/src/main/java/baritone/pathing/goals/GoalBlock.java @@ -77,7 +77,7 @@ public class GoalBlock implements Goal, IGoalRenderPos { @Override public String toString() { - return "Goal{x=" + x + ",y=" + y + ",z=" + z + "}"; + return "GoalBlock{x=" + x + ",y=" + y + ",z=" + z + "}"; } /** @@ -92,7 +92,7 @@ public class GoalBlock implements Goal, IGoalRenderPos { // if yDiff is 1 that means that pos.getY()-this.y==1 which means that we're 1 block below where we should be // therefore going from 0,0,0 to a GoalYLevel of pos.getY()-this.y is accurate - heuristic += new GoalYLevel(yDiff).heuristic(new BlockPos(0, 0, 0)); + heuristic += GoalYLevel.calculate(yDiff, 0); //use the pythagorean and manhattan mixture from GoalXZ heuristic += GoalXZ.calculate(xDiff, zDiff); diff --git a/src/main/java/baritone/pathing/goals/GoalGetToBlock.java b/src/main/java/baritone/pathing/goals/GoalGetToBlock.java index 4e81018b..16cf9f4b 100644 --- a/src/main/java/baritone/pathing/goals/GoalGetToBlock.java +++ b/src/main/java/baritone/pathing/goals/GoalGetToBlock.java @@ -61,4 +61,9 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos { int zDiff = pos.getZ() - this.z; return GoalBlock.calculate(xDiff, yDiff, zDiff); } + + @Override + public String toString() { + return "GoalGetToBlock{x=" + x + ",y=" + y + ",z=" + z + "}"; + } } diff --git a/src/main/java/baritone/pathing/goals/GoalRunAway.java b/src/main/java/baritone/pathing/goals/GoalRunAway.java index 620794d2..90e2f68e 100644 --- a/src/main/java/baritone/pathing/goals/GoalRunAway.java +++ b/src/main/java/baritone/pathing/goals/GoalRunAway.java @@ -17,11 +17,13 @@ package baritone.pathing.goals; -import java.util.Arrays; import net.minecraft.util.math.BlockPos; +import java.util.Arrays; + /** * Useful for automated combat (retreating specifically) + * * @author leijurv */ public class GoalRunAway implements Goal { @@ -65,6 +67,6 @@ public class GoalRunAway implements Goal { @Override public String toString() { - return "GoalRunAwayFrom[" + Arrays.asList(from) + "]"; + return "GoalRunAwayFrom" + Arrays.asList(from); } } diff --git a/src/main/java/baritone/pathing/goals/GoalXZ.java b/src/main/java/baritone/pathing/goals/GoalXZ.java index 71808222..7b876665 100644 --- a/src/main/java/baritone/pathing/goals/GoalXZ.java +++ b/src/main/java/baritone/pathing/goals/GoalXZ.java @@ -61,7 +61,7 @@ public class GoalXZ implements Goal { @Override public String toString() { - return "Goal{x=" + x + ",z=" + z + "}"; + return "GoalXZ{x=" + x + ",z=" + z + "}"; } public static double calculate(double xDiff, double zDiff) { diff --git a/src/main/java/baritone/pathing/goals/GoalYLevel.java b/src/main/java/baritone/pathing/goals/GoalYLevel.java index 89cef250..445a450b 100644 --- a/src/main/java/baritone/pathing/goals/GoalYLevel.java +++ b/src/main/java/baritone/pathing/goals/GoalYLevel.java @@ -42,19 +42,23 @@ public class GoalYLevel implements Goal { @Override public double heuristic(BlockPos pos) { - if (pos.getY() > level) { + return calculate(level, pos.getY()); + } + + static double calculate(int goalY, int currentY) { + if (currentY > goalY) { // need to descend - return FALL_N_BLOCKS_COST[2] / 2 * (pos.getY() - level); + return FALL_N_BLOCKS_COST[2] / 2 * (currentY - goalY); } - if (pos.getY() < level) { + if (currentY < goalY) { // need to ascend - return (level - pos.getY()) * JUMP_ONE_BLOCK_COST; + return (goalY - currentY) * JUMP_ONE_BLOCK_COST; } return 0; } @Override public String toString() { - return "Goal{y=" + level + "}"; + return "GoalYLevel{y=" + level + "}"; } } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementFall.java b/src/main/java/baritone/pathing/movement/movements/MovementFall.java index 60a5a0a5..e0356444 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementFall.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementFall.java @@ -134,15 +134,22 @@ public class MovementFall extends Movement { state.setTarget(new MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.getBlockPosCenter(dest)), false)); } if (playerFeet.equals(dest) && (player().posY - playerFeet.getY() < 0.094 || BlockStateInterface.isWater(dest))) { // 0.094 because lilypads - if (BlockStateInterface.isWater(dest) && InventoryPlayer.isHotbar(player().inventory.getSlotFor(STACK_BUCKET_EMPTY))) { - player().inventory.currentItem = player().inventory.getSlotFor(STACK_BUCKET_EMPTY); - if (player().motionY >= 0) { - return state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); + if (BlockStateInterface.isWater(dest)) { + if (InventoryPlayer.isHotbar(player().inventory.getSlotFor(STACK_BUCKET_EMPTY))) { + player().inventory.currentItem = player().inventory.getSlotFor(STACK_BUCKET_EMPTY); + if (player().motionY >= 0) { + return state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); + } else { + return state; + } } else { - return state; + if (player().motionY >= 0) { + return state.setStatus(MovementStatus.SUCCESS); + } // don't else return state; we need to stay centered because this water might be flowing under the surface } + } else { + return state.setStatus(MovementStatus.SUCCESS); } - return state.setStatus(MovementStatus.SUCCESS); } Vec3d destCenter = Utils.getBlockPosCenter(dest); // we are moving to the 0.5 center not the edge (like if we were falling on a ladder) if (Math.abs(player().posX - destCenter.x) > 0.2 || Math.abs(player().posZ - destCenter.z) > 0.2) { diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 4f955611..0e2750e0 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -264,7 +264,7 @@ public class PathExecutor implements Helper { // when we're midair in the middle of a fall, we're very far from both the beginning and the end, but we aren't actually off path if (path.movements().get(pathPosition) instanceof MovementFall) { BlockPos fallDest = path.positions().get(pathPosition + 1); // .get(pathPosition) is the block we fell off of - if (Utils.playerFlatDistanceToCenter(fallDest) < 0.5) { + if (Utils.playerFlatDistanceToCenter(fallDest) < leniency) { // ignore Y by using flat distance return false; } return true; diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 65208d76..cb6f1382 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -119,6 +119,12 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } + if (msg.equals("axis")) { + PathingBehavior.INSTANCE.setGoal(new GoalAxis()); + PathingBehavior.INSTANCE.path(); + event.cancel(); + return; + } if (msg.toLowerCase().equals("cancel")) { MineBehavior.INSTANCE.cancel(); FollowBehavior.INSTANCE.cancel(); From 43cf2062bc8b36890086c9997bf76c16d5132543 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 12:56:35 -0700 Subject: [PATCH 050/120] locations cache --- src/main/java/baritone/behavior/MineBehavior.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 9a03b156..3b0e4ec8 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -51,6 +51,7 @@ public final class MineBehavior extends Behavior implements Helper { } private List mining; + private List locationsCache; @Override public void onTick(TickEvent event) { @@ -92,12 +93,18 @@ public final class MineBehavior extends Behavior implements Helper { if (mining == null) { return; } + if (!locationsCache.isEmpty()) { + locationsCache = prune(new ArrayList<>(locationsCache), mining, 64); + PathingBehavior.INSTANCE.setGoal(new GoalComposite(locationsCache.stream().map(GoalTwoBlocks::new).toArray(Goal[]::new))); + PathingBehavior.INSTANCE.path(); + } List locs = scanFor(mining, 64); if (locs.isEmpty()) { logDebug("No locations for " + mining + " known, cancelling"); cancel(); return; } + locationsCache = locs; PathingBehavior.INSTANCE.setGoal(new GoalComposite(locs.stream().map(GoalTwoBlocks::new).toArray(Goal[]::new))); PathingBehavior.INSTANCE.path(); } @@ -119,6 +126,10 @@ public final class MineBehavior extends Behavior implements Helper { locs.addAll(WorldScanner.INSTANCE.scanLoadedChunks(uninteresting, max)); //System.out.println("Scan of loaded chunks took " + (System.currentTimeMillis() - before) + "ms"); } + return prune(locs, mining, max); + } + + public static List prune(List locs, List mining, int max) { BlockPos playerFeet = MineBehavior.INSTANCE.playerFeet(); locs.sort(Comparator.comparingDouble(playerFeet::distanceSq)); @@ -135,11 +146,13 @@ public final class MineBehavior extends Behavior implements Helper { public void mine(String... blocks) { this.mining = blocks == null || blocks.length == 0 ? null : Arrays.stream(blocks).map(ChunkPacker::stringToBlock).collect(Collectors.toList()); + this.locationsCache = new ArrayList<>(); updateGoal(); } public void mine(Block... blocks) { this.mining = blocks == null || blocks.length == 0 ? null : Arrays.asList(blocks); + this.locationsCache = new ArrayList<>(); updateGoal(); } From e54ea6c5711929918581bde4874f51ee164f0ca0 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 15:22:34 -0700 Subject: [PATCH 051/120] pathingbehavior must emit canceled event for mining to recalc --- src/main/java/baritone/behavior/PathingBehavior.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 944af0d2..205e5001 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -18,11 +18,11 @@ package baritone.behavior; import baritone.Baritone; +import baritone.api.behavior.Behavior; import baritone.api.event.events.PathEvent; import baritone.api.event.events.PlayerUpdateEvent; import baritone.api.event.events.RenderEvent; import baritone.api.event.events.TickEvent; -import baritone.api.behavior.Behavior; import baritone.pathing.calc.AStarPathFinder; import baritone.pathing.calc.AbstractNodeCostSearch; import baritone.pathing.calc.IPathFinder; @@ -194,6 +194,7 @@ public final class PathingBehavior extends Behavior implements Helper { } public void cancel() { + dispatchPathEvent(PathEvent.CANCELED); current = null; next = null; Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys(); From eca41a046a03a93af8db26f951d87680593d0cf2 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 15 Sep 2018 19:35:35 -0700 Subject: [PATCH 052/120] more accurate name --- .../java/baritone/pathing/path/PathExecutor.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 0e2750e0..8783ceb8 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -49,7 +49,7 @@ public class PathExecutor implements Helper { private int pathPosition; private int ticksAway; private int ticksOnCurrent; - private Double currentMovementInitialCostEstimate; + private Double currentMovementOriginalCostEstimate; private Integer costEstimateIndex; private boolean failed; private boolean recalcBP = true; @@ -209,7 +209,7 @@ public class PathExecutor implements Helper { if (costEstimateIndex == null || costEstimateIndex != pathPosition) { costEstimateIndex = pathPosition; // do this only once, when the movement starts, and deliberately get the cost as cached when this path was calculated, not the cost as it is right now - currentMovementInitialCostEstimate = movement.getCost(null); + currentMovementOriginalCostEstimate = movement.getCost(null); for (int i = 1; i < Baritone.settings().costVerificationLookahead.get() && pathPosition + i < path.length() - 1; i++) { if (path.movements().get(pathPosition + i).calculateCostWithoutCaching() >= ActionCosts.COST_INF) { logDebug("Something has changed in the world and a future movement has become impossible. Cancelling."); @@ -224,8 +224,8 @@ public class PathExecutor implements Helper { cancel(); return true; } - if (!movement.calculatedWhileLoaded() && currentCost - currentMovementInitialCostEstimate > Baritone.settings().maxCostIncrease.get()) { - logDebug("Original cost " + currentMovementInitialCostEstimate + " current cost " + currentCost + ". Cancelling."); + if (!movement.calculatedWhileLoaded() && currentCost - currentMovementOriginalCostEstimate > Baritone.settings().maxCostIncrease.get()) { + logDebug("Original cost " + currentMovementOriginalCostEstimate + " current cost " + currentCost + ". Cancelling."); cancel(); return true; } @@ -245,12 +245,12 @@ public class PathExecutor implements Helper { } else { sprintIfRequested(); ticksOnCurrent++; - if (ticksOnCurrent > currentMovementInitialCostEstimate + Baritone.settings().movementTimeoutTicks.get()) { + if (ticksOnCurrent > currentMovementOriginalCostEstimate + Baritone.settings().movementTimeoutTicks.get()) { // only cancel if the total time has exceeded the initial estimate // as you break the blocks required, the remaining cost goes down, to the point where // ticksOnCurrent is greater than recalculateCost + 100 // this is why we cache cost at the beginning, and don't recalculate for this comparison every tick - logDebug("This movement has taken too long (" + ticksOnCurrent + " ticks, expected " + currentMovementInitialCostEstimate + "). Cancelling."); + logDebug("This movement has taken too long (" + ticksOnCurrent + " ticks, expected " + currentMovementOriginalCostEstimate + "). Cancelling."); cancel(); return true; } From 9937739518713fc4b10629408edfcc46d45733f7 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 13:00:44 -0700 Subject: [PATCH 053/120] force internal mining --- src/main/java/baritone/Settings.java | 13 ++++++++ .../java/baritone/behavior/MineBehavior.java | 30 +++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 67ac6ab5..6502b9bd 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -343,6 +343,19 @@ public class Settings { */ public Setting axisHeight = new Setting<>(120); + /** + * When mining block of a certain type, try to mine two at once instead of one. + * If the block above is also a goal block, set GoalBlock instead of GoalTwoBlocks + * If the block below is also a goal block, set GoalBlock to the position one down instead of GoalTwoBlocks + */ + public Setting forceInternalMining = new Setting<>(true); + + /** + * Modification to the previous setting, only has effect if forceInternalMining is true + * If true, only apply the previous setting if the block adjacent to the goal isn't air. + */ + public Setting internalMiningAirException = new Setting<>(true); + public final Map> byLowerName; public final List> allSettings; diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 3b0e4ec8..64c6c732 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -26,12 +26,14 @@ import baritone.cache.ChunkPacker; import baritone.cache.WorldProvider; import baritone.cache.WorldScanner; import baritone.pathing.goals.Goal; +import baritone.pathing.goals.GoalBlock; import baritone.pathing.goals.GoalComposite; import baritone.pathing.goals.GoalTwoBlocks; import baritone.pathing.path.IPath; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.chunk.EmptyChunk; @@ -95,7 +97,7 @@ public final class MineBehavior extends Behavior implements Helper { } if (!locationsCache.isEmpty()) { locationsCache = prune(new ArrayList<>(locationsCache), mining, 64); - PathingBehavior.INSTANCE.setGoal(new GoalComposite(locationsCache.stream().map(GoalTwoBlocks::new).toArray(Goal[]::new))); + PathingBehavior.INSTANCE.setGoal(coalesce(locationsCache)); PathingBehavior.INSTANCE.path(); } List locs = scanFor(mining, 64); @@ -105,10 +107,34 @@ public final class MineBehavior extends Behavior implements Helper { return; } locationsCache = locs; - PathingBehavior.INSTANCE.setGoal(new GoalComposite(locs.stream().map(GoalTwoBlocks::new).toArray(Goal[]::new))); + PathingBehavior.INSTANCE.setGoal(coalesce(locs)); PathingBehavior.INSTANCE.path(); } + public static GoalComposite coalesce(List locs) { + return new GoalComposite(locs.stream().map(loc -> { + if (!Baritone.settings().forceInternalMining.get()) { + return new GoalTwoBlocks(loc); + } + + boolean noUp = locs.contains(loc.up()) && !(Baritone.settings().internalMiningAirException.get() && BlockStateInterface.getBlock(loc.up()) == Blocks.AIR); + boolean noDown = locs.contains(loc.down()) && !(Baritone.settings().internalMiningAirException.get() && BlockStateInterface.getBlock(loc.up()) == Blocks.AIR); + if (noUp) { + if (noDown) { + return new GoalTwoBlocks(loc); + } else { + return new GoalBlock(loc.down()); + } + } else { + if (noDown) { + return new GoalBlock(loc); + } else { + return new GoalTwoBlocks(loc); + } + } + }).toArray(Goal[]::new)); + } + public static List scanFor(List mining, int max) { List locs = new ArrayList<>(); List uninteresting = new ArrayList<>(); From 5492dc59e2c9e142a9d98030e0d81bbaca899b2c Mon Sep 17 00:00:00 2001 From: Brady Date: Sun, 16 Sep 2018 15:05:05 -0500 Subject: [PATCH 054/120] Replace Setting usages with their actual number types --- src/main/java/baritone/Settings.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 6502b9bd..bfbbec61 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -129,7 +129,7 @@ public class Settings { *

* Finding the optimal path is worth it, so it's the default. */ - public Setting costHeuristic = this.new Setting(3.5D); + public Setting costHeuristic = new Setting<>(3.5D); // a bunch of obscure internal A* settings that you probably don't want to change /** @@ -222,12 +222,12 @@ public class Settings { /** * Pathing can never take longer than this */ - public Setting pathTimeoutMS = new Setting<>(2000L); + public Setting pathTimeoutMS = new Setting<>(2000L); /** * Planning ahead while executing a segment can never take longer than this */ - public Setting planAheadTimeoutMS = new Setting<>(4000L); + public Setting planAheadTimeoutMS = new Setting<>(4000L); /** * For debugging, consider nodes much much slower @@ -237,12 +237,12 @@ public class Settings { /** * Milliseconds between each node */ - public Setting slowPathTimeDelayMS = new Setting<>(100L); + public Setting slowPathTimeDelayMS = new Setting<>(100L); /** * The alternative timeout number when slowPath is on */ - public Setting slowPathTimeoutMS = new Setting<>(40000L); + public Setting slowPathTimeoutMS = new Setting<>(40000L); /** * The big one. Download all chunks in simplified 2-bit format and save them for better very-long-distance pathing. From 30fc72a34c317ed78494a42a44c2293e591eac3b Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 13:28:16 -0700 Subject: [PATCH 055/120] scan loaded if not cached --- src/main/java/baritone/behavior/MineBehavior.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 64c6c732..e272a310 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -147,6 +147,9 @@ public final class MineBehavior extends Behavior implements Helper { } } //System.out.println("Scan of cached chunks took " + (System.currentTimeMillis() - b) + "ms"); + if (locs.isEmpty()) { + uninteresting = mining; + } if (!uninteresting.isEmpty()) { //long before = System.currentTimeMillis(); locs.addAll(WorldScanner.INSTANCE.scanLoadedChunks(uninteresting, max)); From 0ce68ee21f744d6c5ccf4339f0643c18b4b1576a Mon Sep 17 00:00:00 2001 From: Brady Date: Sun, 16 Sep 2018 15:28:23 -0500 Subject: [PATCH 056/120] Replace some issue references with proper javadocs where applicable --- src/main/java/baritone/Settings.java | 6 ++++-- .../baritone/pathing/calc/AbstractNodeCostSearch.java | 8 ++++++-- src/main/java/baritone/pathing/path/PathExecutor.java | 11 ++++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index bfbbec61..48dd17d8 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -139,8 +139,9 @@ public class Settings { public Setting pathingMaxChunkBorderFetch = new Setting<>(50); /** - * See issue #18 * Set to 1.0 to effectively disable this feature + * + * @see Issue #18 */ public Setting backtrackCostFavoringCoefficient = new Setting<>(0.9); @@ -153,7 +154,8 @@ public class Settings { /** * After calculating a path (potentially through cached chunks), artificially cut it off to just the part that is * entirely within currently loaded chunks. Improves path safety because cached chunks are heavily simplified. - * See issue #114 for why this is disabled. + * + * @see Issue #144 */ public Setting cutoffAtLoadBoundary = new Setting<>(false); diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index 3b8bfade..f4d90986 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -42,7 +42,10 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { protected final Goal goal; - private final Long2ObjectOpenHashMap map; // see issue #107 + /** + * @see Issue #107 + */ + private final Long2ObjectOpenHashMap map; protected PathNode startNode; @@ -119,11 +122,12 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { * for the node mapped to the specified pos. If no node is found, * a new node is created. * + * @see Issue #107 + * * @param pos The pos to lookup * @return The associated node */ protected PathNode getNodeAtPosition(BetterBlockPos pos) { - // see issue #107 long hashCode = pos.hashCode; PathNode node = map.get(hashCode); if (node == null) { diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 8783ceb8..9db754ae 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -44,7 +44,16 @@ import static baritone.pathing.movement.MovementState.MovementStatus.*; public class PathExecutor implements Helper { private static final double MAX_MAX_DIST_FROM_PATH = 3; private static final double MAX_DIST_FROM_PATH = 2; - private static final double MAX_TICKS_AWAY = 200; // ten seconds. ok to decrease this, but it must be at least 110, see issue #102 + + /** + * Default value is equal to 10 seconds. It's find to decrease it, but it must be at least 5.5s (110 ticks). + * For more information, see issue #102. + * + * @see Issue #102 + * @see Anime + */ + private static final double MAX_TICKS_AWAY = 200; + private final IPath path; private int pathPosition; private int ticksAway; From 3f15451e8878766d58cee1166f9400dc6c3d11af Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 13:43:54 -0700 Subject: [PATCH 057/120] command to rescan and repack all loaded chunks --- .../utils/ExampleBaritoneControl.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index cb6f1382..546dc36a 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -36,8 +36,10 @@ import baritone.pathing.movement.Movement; import baritone.pathing.movement.MovementHelper; import baritone.utils.pathing.BetterBlockPos; import net.minecraft.block.Block; +import net.minecraft.client.multiplayer.ChunkProviderClient; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.chunk.Chunk; import java.util.*; @@ -119,6 +121,24 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } + if (msg.equals("repack") || msg.equals("rescan")) { + ChunkProviderClient cli = world().getChunkProvider(); + int playerChunkX = playerFeet().getX() >> 4; + int playerChunkZ = playerFeet().getZ() >> 4; + int count = 0; + for (int x = playerChunkX - 40; x <= playerChunkX + 40; x++) { + for (int z = playerChunkZ - 40; z <= playerChunkZ + 40; z++) { + Chunk chunk = cli.getLoadedChunk(x, z); + if (chunk != null) { + count++; + WorldProvider.INSTANCE.getCurrentWorld().cache.queueForPacking(chunk); + } + } + } + logDirect("Queued " + count + " chunks for repacking"); + event.cancel(); + return; + } if (msg.equals("axis")) { PathingBehavior.INSTANCE.setGoal(new GoalAxis()); PathingBehavior.INSTANCE.path(); From 23779329a90ba35b4457e45b919d77eb9905a3d6 Mon Sep 17 00:00:00 2001 From: Brady Date: Sun, 16 Sep 2018 15:59:40 -0500 Subject: [PATCH 058/120] Expose registerEventListener in Baritone class --- src/main/java/baritone/Baritone.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index fb373c6e..ed69acda 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -114,7 +114,11 @@ public enum Baritone { public void registerBehavior(Behavior behavior) { this.behaviors.add(behavior); - this.gameEventHandler.registerEventListener(behavior); + this.registerEventListener(behavior); + } + + public void registerEventListener(IGameEventListener listener) { + this.gameEventHandler.registerEventListener(listener); } public final boolean isActive() { From 8dac838fe001d4033ea341e9387c47e896ff591d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 14:14:50 -0700 Subject: [PATCH 059/120] thread pool executor --- src/main/java/baritone/Baritone.java | 29 +++++++++++++------ .../baritone/behavior/PathingBehavior.java | 6 ++-- src/main/java/baritone/cache/CachedWorld.java | 8 ++--- src/main/java/baritone/cache/WorldData.java | 12 ++++---- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index ed69acda..0d89b730 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -17,8 +17,8 @@ package baritone; -import baritone.api.event.listener.IGameEventListener; import baritone.api.behavior.Behavior; +import baritone.api.event.listener.IGameEventListener; import baritone.behavior.*; import baritone.event.GameEventHandler; import baritone.utils.InputOverrideHandler; @@ -29,6 +29,10 @@ import java.io.IOException; import java.nio.file.Files; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.Executor; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import java.util.function.Consumer; /** @@ -52,6 +56,8 @@ public enum Baritone { private Settings settings; private List behaviors; private File dir; + private ThreadPoolExecutor threadPool; + /** * List of consumers to be called after Baritone has initialized @@ -71,6 +77,7 @@ public enum Baritone { if (initialized) { return; } + this.threadPool = new ThreadPoolExecutor(4, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>()); this.gameEventHandler = new GameEventHandler(); this.inputOverrideHandler = new InputOverrideHandler(); this.settings = new Settings(); @@ -96,22 +103,26 @@ public enum Baritone { this.onInitConsumers.forEach(consumer -> consumer.accept(this)); } - public final boolean isInitialized() { + public boolean isInitialized() { return this.initialized; } - public final IGameEventListener getGameEventHandler() { + public IGameEventListener getGameEventHandler() { return this.gameEventHandler; } - public final InputOverrideHandler getInputOverrideHandler() { + public InputOverrideHandler getInputOverrideHandler() { return this.inputOverrideHandler; } - public final List getBehaviors() { + public List getBehaviors() { return this.behaviors; } + public Executor getExecutor() { + return threadPool; + } + public void registerBehavior(Behavior behavior) { this.behaviors.add(behavior); this.registerEventListener(behavior); @@ -121,11 +132,11 @@ public enum Baritone { this.gameEventHandler.registerEventListener(listener); } - public final boolean isActive() { + public boolean isActive() { return this.active; } - public final Settings getSettings() { + public Settings getSettings() { return this.settings; } @@ -133,11 +144,11 @@ public enum Baritone { return Baritone.INSTANCE.settings; // yolo } - public final File getDir() { + public File getDir() { return this.dir; } - public final void registerInitListener(Consumer runnable) { + public void registerInitListener(Consumer runnable) { this.onInitConsumers.add(runnable); } } diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 205e5001..99d7f5e2 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -61,7 +61,7 @@ public final class PathingBehavior extends Behavior implements Helper { private boolean lastAutoJump; private void dispatchPathEvent(PathEvent event) { - new Thread(() -> Baritone.INSTANCE.getGameEventHandler().onPathEvent(event)).start(); + Baritone.INSTANCE.getExecutor().execute(() -> Baritone.INSTANCE.getGameEventHandler().onPathEvent(event)); } @Override @@ -249,7 +249,7 @@ public final class PathingBehavior extends Behavior implements Helper { } isPathCalcInProgress = true; } - new Thread(() -> { + Baritone.INSTANCE.getExecutor().execute(() -> { if (talkAboutIt) { logDebug("Starting to search for path from " + start + " to " + goal); } @@ -292,7 +292,7 @@ public final class PathingBehavior extends Behavior implements Helper { synchronized (pathCalcLock) { isPathCalcInProgress = false; } - }).start(); + }); } /** diff --git a/src/main/java/baritone/cache/CachedWorld.java b/src/main/java/baritone/cache/CachedWorld.java index d903c2cd..f866989a 100644 --- a/src/main/java/baritone/cache/CachedWorld.java +++ b/src/main/java/baritone/cache/CachedWorld.java @@ -66,8 +66,8 @@ public final class CachedWorld implements Helper { System.out.println("Cached world directory: " + directory); // Insert an invalid region element cachedRegions.put(0, null); - new PackerThread().start(); - new Thread(() -> { + Baritone.INSTANCE.getExecutor().execute(new PackerThread()); + Baritone.INSTANCE.getExecutor().execute(() -> { try { Thread.sleep(30000); while (true) { @@ -80,7 +80,7 @@ public final class CachedWorld implements Helper { } catch (InterruptedException e) { e.printStackTrace(); } - }).start(); + }); } public final void queueForPacking(Chunk chunk) { @@ -221,7 +221,7 @@ public final class CachedWorld implements Helper { return regionX <= REGION_MAX && regionX >= -REGION_MAX && regionZ <= REGION_MAX && regionZ >= -REGION_MAX; } - private class PackerThread extends Thread { + private class PackerThread implements Runnable { public void run() { while (true) { LinkedBlockingQueue queue = toPack; diff --git a/src/main/java/baritone/cache/WorldData.java b/src/main/java/baritone/cache/WorldData.java index a7d0b72a..6637d7b1 100644 --- a/src/main/java/baritone/cache/WorldData.java +++ b/src/main/java/baritone/cache/WorldData.java @@ -17,6 +17,8 @@ package baritone.cache; +import baritone.Baritone; + import java.nio.file.Path; /** @@ -37,11 +39,9 @@ public class WorldData { } void onClose() { - new Thread() { - public void run() { - System.out.println("Started saving the world in a new thread"); - cache.save(); - } - }.start(); + Baritone.INSTANCE.getExecutor().execute(() -> { + System.out.println("Started saving the world in a new thread"); + cache.save(); + }); } } From a92465a5f991960b6c0159d18924278f7d2e3309 Mon Sep 17 00:00:00 2001 From: Brady Date: Sun, 16 Sep 2018 16:46:41 -0500 Subject: [PATCH 060/120] Exceedingly beautiful --- src/main/java/baritone/cache/ChunkPacker.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index 5c2374ce..46d0f175 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -111,14 +111,14 @@ public final class ChunkPacker implements Helper { //System.out.println("Chunk packing took " + (end - start) + "ms for " + chunk.x + "," + chunk.z); String[] blockNames = new String[256]; for (int z = 0; z < 16; z++) { - outerLoop: + https://www.ibm.com/developerworks/library/j-perry-writing-good-java-code/index.html for (int x = 0; x < 16; x++) { for (int y = 255; y >= 0; y--) { int index = CachedChunk.getPositionIndex(x, y, z); if (bitSet.get(index) || bitSet.get(index + 1)) { String name = blockToString(chunk.getBlockState(x, y, z).getBlock()); blockNames[z << 4 | x] = name; - continue outerLoop; + continue https; } } blockNames[z << 4 | x] = "air"; From 7fd0d2d038d5fe02e266f1031e750ffa8884e0ae Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 16:45:56 -0700 Subject: [PATCH 061/120] clean up toLowerCase --- .../utils/ExampleBaritoneControl.java | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 546dc36a..98964315 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -62,16 +62,16 @@ public class ExampleBaritoneControl extends Behavior implements Helper { return; } } - String msg = event.getMessage(); + String msg = event.getMessage().toLowerCase(Locale.US); if (Baritone.settings().prefix.get()) { if (!msg.startsWith("#")) { return; } msg = msg.substring(1); } - if (msg.toLowerCase().startsWith("goal")) { + if (msg.startsWith("goal")) { event.cancel(); - String[] params = msg.toLowerCase().substring(4).trim().split(" "); + String[] params = msg.substring(4).trim().split(" "); if (params[0].equals("")) { params = new String[]{}; } @@ -145,7 +145,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().equals("cancel")) { + if (msg.equals("cancel")) { MineBehavior.INSTANCE.cancel(); FollowBehavior.INSTANCE.cancel(); PathingBehavior.INSTANCE.cancel(); @@ -153,13 +153,13 @@ public class ExampleBaritoneControl extends Behavior implements Helper { logDirect("ok canceled"); return; } - if (msg.toLowerCase().equals("forcecancel")) { + if (msg.equals("forcecancel")) { AbstractNodeCostSearch.forceCancel(); event.cancel(); logDirect("ok force canceled"); return; } - if (msg.toLowerCase().equals("invert")) { + if (msg.equals("invert")) { Goal goal = PathingBehavior.INSTANCE.getGoal(); BlockPos runAwayFrom; if (goal instanceof GoalXZ) { @@ -183,7 +183,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().equals("follow")) { + if (msg.equals("follow")) { Optional entity = MovementHelper.whatEntityAmILookingAt(); if (!entity.isPresent()) { logDirect("You aren't looking at an entity bruh"); @@ -195,20 +195,20 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().equals("reloadall")) { + if (msg.equals("reloadall")) { WorldProvider.INSTANCE.getCurrentWorld().cache.reloadAllFromDisk(); logDirect("ok"); event.cancel(); return; } - if (msg.toLowerCase().equals("saveall")) { + if (msg.equals("saveall")) { WorldProvider.INSTANCE.getCurrentWorld().cache.save(); logDirect("ok"); event.cancel(); return; } - if (msg.toLowerCase().startsWith("find")) { - String blockType = msg.toLowerCase().substring(4).trim(); + if (msg.startsWith("find")) { + String blockType = msg.substring(4).trim(); LinkedList locs = WorldProvider.INSTANCE.getCurrentWorld().cache.getLocationsOf(blockType, 1, 4); logDirect("Have " + locs.size() + " locations"); for (BlockPos pos : locs) { @@ -220,8 +220,8 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().startsWith("mine")) { - String[] blockTypes = msg.toLowerCase().substring(4).trim().split(" "); + if (msg.startsWith("mine")) { + String[] blockTypes = msg.substring(4).trim().split(" "); for (String s : blockTypes) { if (ChunkPacker.stringToBlock(s) == null) { logDirect(s + " isn't a valid block name"); @@ -234,7 +234,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().startsWith("thisway")) { + if (msg.startsWith("thisway")) { try { Goal goal = GoalXZ.fromDirection(playerFeetAsVec(), player().rotationYaw, Double.parseDouble(msg.substring(7).trim())); PathingBehavior.INSTANCE.setGoal(goal); @@ -245,8 +245,8 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().startsWith("list") || msg.toLowerCase().startsWith("get ") || msg.toLowerCase().startsWith("show")) { - String waypointType = msg.toLowerCase().substring(4).trim(); + if (msg.startsWith("list") || msg.startsWith("get ") || msg.startsWith("show")) { + String waypointType = msg.substring(4).trim(); if (waypointType.endsWith("s")) { // for example, "show deaths" waypointType = waypointType.substring(0, waypointType.length() - 1); @@ -268,15 +268,15 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().startsWith("save")) { + if (msg.startsWith("save")) { String name = msg.substring(4).trim(); WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint(name, Waypoint.Tag.USER, playerFeet())); logDirect("Saved user defined tag under name '" + name + "'. Say 'goto user' to set goal, say 'list user' to list."); event.cancel(); return; } - if (msg.toLowerCase().startsWith("goto")) { - String waypointType = msg.toLowerCase().substring(4).trim(); + if (msg.startsWith("goto")) { + String waypointType = msg.substring(4).trim(); if (waypointType.endsWith("s") && Waypoint.Tag.fromString(waypointType.substring(0, waypointType.length() - 1)) != null) { // for example, "show deaths" waypointType = waypointType.substring(0, waypointType.length() - 1); @@ -316,7 +316,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().equals("spawn") || msg.toLowerCase().equals("bed")) { + if (msg.equals("spawn") || msg.equals("bed")) { Waypoint waypoint = WorldProvider.INSTANCE.getCurrentWorld().waypoints.getMostRecentByTag(Waypoint.Tag.BED); if (waypoint == null) { BlockPos spawnPoint = player().getBedLocation(); @@ -332,13 +332,13 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().equals("sethome")) { + if (msg.equals("sethome")) { WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint("", Waypoint.Tag.HOME, playerFeet())); logDirect("Saved. Say home to set goal."); event.cancel(); return; } - if (msg.toLowerCase().equals("home")) { + if (msg.equals("home")) { Waypoint waypoint = WorldProvider.INSTANCE.getCurrentWorld().waypoints.getMostRecentByTag(Waypoint.Tag.HOME); if (waypoint == null) { logDirect("home not saved"); @@ -350,7 +350,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.toLowerCase().equals("costs")) { + if (msg.equals("costs")) { Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext()); List moves = new ArrayList<>(Arrays.asList(movements)); while (moves.contains(null)) { @@ -378,7 +378,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { return; } } - if (msg.toLowerCase().equals("baritone") || msg.toLowerCase().equals("settings")) { + if (msg.equals("baritone") || msg.equals("settings")) { for (Settings.Setting setting : Baritone.settings().allSettings) { logDirect(setting.toString()); } @@ -388,7 +388,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { if (msg.contains(" ")) { String[] data = msg.split(" "); if (data.length == 2) { - Settings.Setting setting = Baritone.settings().byLowerName.get(data[0].toLowerCase()); + Settings.Setting setting = Baritone.settings().byLowerName.get(data[0]); if (setting != null) { try { if (setting.value.getClass() == Long.class) { @@ -411,8 +411,8 @@ public class ExampleBaritoneControl extends Behavior implements Helper { } } } - if (Baritone.settings().byLowerName.containsKey(msg.toLowerCase())) { - Settings.Setting setting = Baritone.settings().byLowerName.get(msg.toLowerCase()); + if (Baritone.settings().byLowerName.containsKey(msg)) { + Settings.Setting setting = Baritone.settings().byLowerName.get(msg); logDirect(setting.toString()); event.cancel(); return; From 51f1cadbb8abaa3a51ed6edff61f4c48dcaadb66 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 16:50:56 -0700 Subject: [PATCH 062/120] now unused --- src/main/java/baritone/pathing/goals/GoalBlock.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/java/baritone/pathing/goals/GoalBlock.java b/src/main/java/baritone/pathing/goals/GoalBlock.java index 124740a3..0c96787c 100644 --- a/src/main/java/baritone/pathing/goals/GoalBlock.java +++ b/src/main/java/baritone/pathing/goals/GoalBlock.java @@ -57,16 +57,6 @@ public class GoalBlock implements Goal, IGoalRenderPos { return pos.getX() == this.x && pos.getY() == this.y && pos.getZ() == this.z; } - /** - * The min range value over which to begin considering Y coordinate in the heuristic - */ - private static final double MIN = 20; - - /** - * The max range value over which to begin considering Y coordinate in the heuristic - */ - private static final double MAX = 150; - @Override public double heuristic(BlockPos pos) { int xDiff = pos.getX() - this.x; From fb7d729b11a02c996436f3a85bc4e485ae40f446 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 17:11:04 -0700 Subject: [PATCH 063/120] misc cleanup --- .../movement/movements/MovementTraverse.java | 3 +- .../baritone/pathing/path/PathExecutor.java | 2 +- .../pathing/calc/openset/OpenSetsTest.java | 34 +++++++++++++------ .../utils/pathing/BetterBlockPosTest.java | 4 +++ 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index 36c0cfc9..f28f29fb 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -263,9 +263,8 @@ public class MovementTraverse extends Movement { if (Objects.equals(LookBehaviorUtils.getSelectedBlock().orElse(null), against1) && Minecraft.getMinecraft().player.isSneaking()) { if (LookBehaviorUtils.getSelectedBlock().get().offset(side).equals(positionToPlace)) { return state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); - } else { - // Out.gui("Wrong. " + side + " " + LookBehaviorUtils.getSelectedBlock().get().offset(side) + " " + positionsToPlace[0], Out.Mode.Debug); } + // wrong side? } System.out.println("Trying to look at " + against1 + ", actually looking at" + LookBehaviorUtils.getSelectedBlock()); return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true); diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 9db754ae..02435502 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -212,7 +212,7 @@ public class PathExecutor implements Helper { } long end = System.nanoTime() / 1000000L; if (end - start > 0) { - //logDebug("Recalculating break and place took " + (end - start) + "ms"); + System.out.println("Recalculating break and place took " + (end - start) + "ms"); } Movement movement = path.movements().get(pathPosition); if (costEstimateIndex == null || costEstimateIndex != pathPosition) { diff --git a/src/test/java/baritone/pathing/calc/openset/OpenSetsTest.java b/src/test/java/baritone/pathing/calc/openset/OpenSetsTest.java index 6812f90d..5ab10d24 100644 --- a/src/test/java/baritone/pathing/calc/openset/OpenSetsTest.java +++ b/src/test/java/baritone/pathing/calc/openset/OpenSetsTest.java @@ -22,24 +22,37 @@ import baritone.pathing.goals.Goal; import baritone.utils.pathing.BetterBlockPos; import net.minecraft.util.math.BlockPos; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; import java.util.*; import static org.junit.Assert.*; +@RunWith(Parameterized.class) public class OpenSetsTest { - @Test - public void testOpenSets() { - for (int size = 1; size < 100; size++) { - testSize(size); - } - for (int size = 100; size < 10000; size += 100) { - testSize(size); - } + private final int size; + + public OpenSetsTest(int size) { + this.size = size; } - public void removeAndTest(int amount, IOpenSet[] test, Optional> mustContain) { + @Parameterized.Parameters + public static Collection data() { + ArrayList testSizes = new ArrayList<>(); + for (int size = 1; size < 20; size++) { + testSizes.add(new Object[]{size}); + } + for (int size = 100; size <= 1000; size += 100) { + testSizes.add(new Object[]{size}); + } + testSizes.add(new Object[]{5000}); + testSizes.add(new Object[]{10000}); + return testSizes; + } + + private static void removeAndTest(int amount, IOpenSet[] test, Optional> mustContain) { double[][] results = new double[test.length][amount]; for (int i = 0; i < test.length; i++) { long before = System.nanoTime() / 1000000L; @@ -62,7 +75,8 @@ public class OpenSetsTest { } } - public void testSize(int size) { + @Test + public void testSize() { System.out.println("Testing size " + size); // Include LinkedListOpenSet even though it's not performant because I absolutely trust that it behaves properly // I'm really testing the heap implementations against it as the ground truth diff --git a/src/test/java/baritone/utils/pathing/BetterBlockPosTest.java b/src/test/java/baritone/utils/pathing/BetterBlockPosTest.java index 758812f2..ff54579b 100644 --- a/src/test/java/baritone/utils/pathing/BetterBlockPosTest.java +++ b/src/test/java/baritone/utils/pathing/BetterBlockPosTest.java @@ -20,6 +20,8 @@ package baritone.utils.pathing; import net.minecraft.util.math.BlockPos; import org.junit.Test; +import static org.junit.Assert.assertTrue; + public class BetterBlockPosTest { @Test @@ -33,7 +35,9 @@ public class BetterBlockPosTest { for (int i = 0; i < 10; i++) { // eliminate any advantage to going first benchN(); + assertTrue(i<10); } + } public void benchOne() { From dbd1fb2aa2abd514bc7866b4c702ba8e9514b22f Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 17:15:33 -0700 Subject: [PATCH 064/120] misc cleanup 2 --- .../event/listener/IGameEventListener.java | 5 ++++ .../baritone/behavior/PathingBehavior.java | 6 ++--- src/main/java/baritone/cache/ChunkPacker.java | 27 +++---------------- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/api/java/baritone/api/event/listener/IGameEventListener.java b/src/api/java/baritone/api/event/listener/IGameEventListener.java index c63cbfbc..9587376a 100644 --- a/src/api/java/baritone/api/event/listener/IGameEventListener.java +++ b/src/api/java/baritone/api/event/listener/IGameEventListener.java @@ -109,6 +109,8 @@ public interface IGameEventListener { * Runs before a outbound packet is sent * * @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[]) + * @see Packet + * @see GenericFutureListener */ void onSendPacket(PacketEvent event); @@ -116,6 +118,8 @@ public interface IGameEventListener { * Runs before an inbound packet is processed * * @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[]) + * @see Packet + * @see GenericFutureListener */ void onReceivePacket(PacketEvent event); @@ -140,6 +144,7 @@ public interface IGameEventListener { * Called when the local player dies, as indicated by the creation of the {@link GuiGameOver} screen. * * @see GuiGameOver(ITextComponent) + * @see ITextComponent */ void onPlayerDeath(); diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 99d7f5e2..22440af4 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -355,7 +355,7 @@ public final class PathingBehavior extends Behavior implements Helper { return; } - long start = System.nanoTime(); + //long start = System.nanoTime(); PathExecutor current = this.current; // this should prevent most race conditions? @@ -372,7 +372,7 @@ public final class PathingBehavior extends Behavior implements Helper { PathRenderer.drawPath(next.getPath(), 0, player(), partialTicks, Color.MAGENTA, Baritone.settings().fadePath.get(), 10, 20); } - long split = System.nanoTime(); + //long split = System.nanoTime(); if (current != null) { PathRenderer.drawManySelectionBoxes(player(), current.toBreak(), partialTicks, Color.RED); PathRenderer.drawManySelectionBoxes(player(), current.toPlace(), partialTicks, Color.GREEN); @@ -390,7 +390,7 @@ public final class PathingBehavior extends Behavior implements Helper { }); }); }); - long end = System.nanoTime(); + //long end = System.nanoTime(); //System.out.println((end - split) + " " + (split - start)); // if (end - start > 0) { // System.out.println("Frame took " + (split - start) + " " + (end - split)); diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index 46d0f175..c73a0212 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -42,24 +42,8 @@ public final class ChunkPacker implements Helper { private ChunkPacker() {} - private static BitSet originalPacker(Chunk chunk) { - BitSet bitSet = new BitSet(CachedChunk.SIZE); - for (int y = 0; y < 256; y++) { - for (int z = 0; z < 16; z++) { - for (int x = 0; x < 16; x++) { - int index = CachedChunk.getPositionIndex(x, y, z); - IBlockState state = chunk.getBlockState(x, y, z); - boolean[] bits = getPathingBlockType(state).getBits(); - bitSet.set(index, bits[0]); - bitSet.set(index + 1, bits[1]); - } - } - } - return bitSet; - } - public static CachedChunk pack(Chunk chunk) { - long start = System.nanoTime() / 1000000L; + //long start = System.nanoTime() / 1000000L; Map> specialBlocks = new HashMap<>(); BitSet bitSet = new BitSet(CachedChunk.SIZE); @@ -100,18 +84,15 @@ public final class ChunkPacker implements Helper { } } } - /*if (!bitSet.equals(originalPacker(chunk))) { - throw new IllegalStateException(); - }*/ } catch (Exception e) { e.printStackTrace(); } - //System.out.println("Packed special blocks: " + specialBlocks); - long end = System.nanoTime() / 1000000L; + //long end = System.nanoTime() / 1000000L; //System.out.println("Chunk packing took " + (end - start) + "ms for " + chunk.x + "," + chunk.z); String[] blockNames = new String[256]; for (int z = 0; z < 16; z++) { - https://www.ibm.com/developerworks/library/j-perry-writing-good-java-code/index.html + https: +//www.ibm.com/developerworks/library/j-perry-writing-good-java-code/index.html for (int x = 0; x < 16; x++) { for (int y = 255; y >= 0; y--) { int index = CachedChunk.getPositionIndex(x, y, z); From e75d0ff102635d0479e8d0557f33eff60cd06e62 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 17:25:14 -0700 Subject: [PATCH 065/120] huh thats neat --- .../baritone/pathing/calc/AbstractNodeCostSearch.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index f4d90986..6e8220e1 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -89,14 +89,10 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { path.ifPresent(IPath::postprocess); isFinished = true; return path; - } catch (Exception e) { + } finally { + // this is run regardless of what exception may or may not be raised by calculate0 currentlyRunning = null; isFinished = true; - if (e instanceof RuntimeException) { - throw (RuntimeException) e; - } else { - throw new RuntimeException(e); - } } } @@ -122,10 +118,9 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { * for the node mapped to the specified pos. If no node is found, * a new node is created. * - * @see Issue #107 - * * @param pos The pos to lookup * @return The associated node + * @see Issue #107 */ protected PathNode getNodeAtPosition(BetterBlockPos pos) { long hashCode = pos.hashCode; From af58304b3836a4edfadcf1ee3c65e56e96275bcf Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 17:49:19 -0700 Subject: [PATCH 066/120] misc cleanup 3 --- .../baritone/api/event/events/TickEvent.java | 9 +++++++-- .../java/baritone/behavior/MineBehavior.java | 2 +- src/main/java/baritone/cache/ChunkPacker.java | 10 +++------- src/main/java/baritone/pathing/calc/Path.java | 10 +++++----- .../baritone/pathing/goals/GoalComposite.java | 5 +++-- .../java/baritone/pathing/goals/GoalNear.java | 8 ++++---- .../java/baritone/pathing/goals/GoalRunAway.java | 4 ++-- .../java/baritone/pathing/goals/GoalYLevel.java | 2 +- ...stsButOnlyTheOnesThatMakeMickeyDieInside.java | 9 ++++----- .../java/baritone/pathing/movement/Movement.java | 5 +---- .../pathing/movement/MovementHelper.java | 16 ++++++++-------- .../movement/movements/MovementDescend.java | 4 ++-- .../movement/movements/MovementParkour.java | 7 +++---- .../java/baritone/pathing/path/CutoffPath.java | 6 +++--- .../baritone/utils/InputOverrideHandler.java | 2 -- src/main/java/baritone/utils/ToolSet.java | 5 ----- 16 files changed, 47 insertions(+), 57 deletions(-) diff --git a/src/api/java/baritone/api/event/events/TickEvent.java b/src/api/java/baritone/api/event/events/TickEvent.java index 362a88cc..c765daa9 100644 --- a/src/api/java/baritone/api/event/events/TickEvent.java +++ b/src/api/java/baritone/api/event/events/TickEvent.java @@ -23,13 +23,18 @@ public final class TickEvent { private final EventState state; private final Type type; + private final int count; - private static int count; + private static int overallTickCount; public TickEvent(EventState state, Type type) { this.state = state; this.type = type; - count++; + this.count = incrementCount(); + } + + private static synchronized int incrementCount() { + return overallTickCount++; } public int getCount() { diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index e272a310..4c542c47 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -168,7 +168,7 @@ public final class MineBehavior extends Behavior implements Helper { .filter(pos -> !mining.contains(BlockStateInterface.get(pos).getBlock())) .collect(Collectors.toList())); if (locs.size() > max) { - locs = locs.subList(0, max); + return locs.subList(0, max); } return locs; } diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index c73a0212..3055553b 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -91,8 +91,7 @@ public final class ChunkPacker implements Helper { //System.out.println("Chunk packing took " + (end - start) + "ms for " + chunk.x + "," + chunk.z); String[] blockNames = new String[256]; for (int z = 0; z < 16; z++) { - https: -//www.ibm.com/developerworks/library/j-perry-writing-good-java-code/index.html + https://www.ibm.com/developerworks/library/j-perry-writing-good-java-code/index.html for (int x = 0; x < 16; x++) { for (int y = 255; y >= 0; y--) { int index = CachedChunk.getPositionIndex(x, y, z); @@ -119,10 +118,7 @@ public final class ChunkPacker implements Helper { } public static Block stringToBlock(String name) { - if (!name.contains(":")) { - name = "minecraft:" + name; - } - return Block.getBlockFromName(name); + return Block.getBlockFromName(name.contains(":") ? name : "minecraft:" + name); } private static PathingBlockType getPathingBlockType(IBlockState state) { @@ -146,7 +142,7 @@ public final class ChunkPacker implements Helper { return PathingBlockType.SOLID; } - static IBlockState pathingTypeToBlock(PathingBlockType type) { + public static IBlockState pathingTypeToBlock(PathingBlockType type) { if (type != null) { switch (type) { case AIR: diff --git a/src/main/java/baritone/pathing/calc/Path.java b/src/main/java/baritone/pathing/calc/Path.java index bec1e3a0..1910927c 100644 --- a/src/main/java/baritone/pathing/calc/Path.java +++ b/src/main/java/baritone/pathing/calc/Path.java @@ -38,22 +38,22 @@ class Path implements IPath { /** * The start position of this path */ - final BetterBlockPos start; + private final BetterBlockPos start; /** * The end position of this path */ - final BetterBlockPos end; + private final BetterBlockPos end; /** * The blocks on the path. Guaranteed that path.get(0) equals start and * path.get(path.size()-1) equals end */ - final List path; + private final List path; - final List movements; + private final List movements; - final Goal goal; + private final Goal goal; private final int numNodes; diff --git a/src/main/java/baritone/pathing/goals/GoalComposite.java b/src/main/java/baritone/pathing/goals/GoalComposite.java index 558e124e..bd1e0905 100644 --- a/src/main/java/baritone/pathing/goals/GoalComposite.java +++ b/src/main/java/baritone/pathing/goals/GoalComposite.java @@ -17,9 +17,10 @@ package baritone.pathing.goals; +import net.minecraft.util.math.BlockPos; + import java.util.Arrays; import java.util.Collection; -import net.minecraft.util.math.BlockPos; /** * A composite of many goals, any one of which satisfies the composite. @@ -33,7 +34,7 @@ public class GoalComposite implements Goal { /** * An array of goals that any one of must be satisfied */ - public final Goal[] goals; + private final Goal[] goals; public GoalComposite(Goal... goals) { this.goals = goals; diff --git a/src/main/java/baritone/pathing/goals/GoalNear.java b/src/main/java/baritone/pathing/goals/GoalNear.java index e78788ac..7786c4f1 100644 --- a/src/main/java/baritone/pathing/goals/GoalNear.java +++ b/src/main/java/baritone/pathing/goals/GoalNear.java @@ -21,10 +21,10 @@ import baritone.utils.interfaces.IGoalRenderPos; import net.minecraft.util.math.BlockPos; public class GoalNear implements Goal, IGoalRenderPos { - final int x; - final int y; - final int z; - final int rangeSq; + private final int x; + private final int y; + private final int z; + private final int rangeSq; public GoalNear(BlockPos pos, int range) { this.x = pos.getX(); diff --git a/src/main/java/baritone/pathing/goals/GoalRunAway.java b/src/main/java/baritone/pathing/goals/GoalRunAway.java index 90e2f68e..15cd2489 100644 --- a/src/main/java/baritone/pathing/goals/GoalRunAway.java +++ b/src/main/java/baritone/pathing/goals/GoalRunAway.java @@ -28,9 +28,9 @@ import java.util.Arrays; */ public class GoalRunAway implements Goal { - public final BlockPos[] from; + private final BlockPos[] from; - final double distanceSq; + private final double distanceSq; public GoalRunAway(double distance, BlockPos... from) { if (from.length == 0) { diff --git a/src/main/java/baritone/pathing/goals/GoalYLevel.java b/src/main/java/baritone/pathing/goals/GoalYLevel.java index 445a450b..97d63311 100644 --- a/src/main/java/baritone/pathing/goals/GoalYLevel.java +++ b/src/main/java/baritone/pathing/goals/GoalYLevel.java @@ -45,7 +45,7 @@ public class GoalYLevel implements Goal { return calculate(level, pos.getY()); } - static double calculate(int goalY, int currentY) { + public static double calculate(int goalY, int currentY) { if (currentY > goalY) { // need to descend return FALL_N_BLOCKS_COST[2] / 2 * (currentY - goalY); diff --git a/src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java b/src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java index c2481cda..e955c41e 100644 --- a/src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java +++ b/src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java @@ -57,16 +57,15 @@ public interface ActionCostsButOnlyTheOnesThatMakeMickeyDieInside { if (distance == 0) { return 0; // Avoid 0/0 NaN } + double tmpDistance = distance; int tickCount = 0; while (true) { double fallDistance = velocity(tickCount); - if (distance <= fallDistance) { - return tickCount + distance / fallDistance; + if (tmpDistance <= fallDistance) { + return tickCount + tmpDistance / fallDistance; } - distance -= fallDistance; + tmpDistance -= fallDistance; tickCount++; } } - - } diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 5c7aae36..4f31d1a0 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -72,10 +72,7 @@ public abstract class Movement implements Helper, MovementHelper { public double getCost(CalculationContext context) { if (cost == null) { - if (context == null) { - context = new CalculationContext(); - } - cost = calculateCost(context); + cost = calculateCost(context != null ? context : new CalculationContext()); } return cost; } diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index d602fdad..1d7ca673 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -438,15 +438,15 @@ public interface MovementHelper extends ActionCosts, Helper { if (canWalkThrough(onto, ontoBlock)) { continue; } - if (canWalkOn(onto, ontoBlock)) { - if ((calcContext.hasWaterBucket() && fallHeight <= calcContext.maxFallHeightBucket() + 1) || fallHeight <= calcContext.maxFallHeightNoWater() + 1) { - // fallHeight = 4 means onto.up() is 3 blocks down, which is the max - return new MovementFall(pos, onto.up()); - } else { - return null; - } + if (!canWalkOn(onto, ontoBlock)) { + break; + } + if ((calcContext.hasWaterBucket() && fallHeight <= calcContext.maxFallHeightBucket() + 1) || fallHeight <= calcContext.maxFallHeightNoWater() + 1) { + // fallHeight = 4 means onto.up() is 3 blocks down, which is the max + return new MovementFall(pos, onto.up()); + } else { + return null; } - break; } return null; } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDescend.java b/src/main/java/baritone/pathing/movement/movements/MovementDescend.java index 593c410a..b033b6fc 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDescend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDescend.java @@ -31,6 +31,8 @@ import net.minecraft.util.math.BlockPos; public class MovementDescend extends Movement { + private int numTicks = 0; + public MovementDescend(BetterBlockPos start, BetterBlockPos end) { super(start, end, new BlockPos[]{end.up(2), end.up(), end}, end.down()); } @@ -63,8 +65,6 @@ public class MovementDescend extends Movement { return walk + Math.max(FALL_N_BLOCKS_COST[1], CENTER_AFTER_FALL_COST) + getTotalHardnessOfBlocksToBreak(context); } - int numTicks = 0; - @Override public MovementState updateState(MovementState state) { super.updateState(state); diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 1d0dcdd4..ca116342 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -38,11 +38,10 @@ import net.minecraft.util.math.Vec3d; import java.util.Objects; public class MovementParkour extends Movement { - protected static final EnumFacing[] HORIZONTALS_BUT_ALSO_DOWN_SO_EVERY_DIRECTION_EXCEPT_UP = {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.DOWN}; + private static final EnumFacing[] HORIZONTALS_BUT_ALSO_DOWN_SO_EVERY_DIRECTION_EXCEPT_UP = {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.DOWN}; - - final EnumFacing direction; - final int dist; + private final EnumFacing direction; + private final int dist; private MovementParkour(BetterBlockPos src, int dist, EnumFacing dir) { super(src, src.offset(dir, dist), new BlockPos[]{}); diff --git a/src/main/java/baritone/pathing/path/CutoffPath.java b/src/main/java/baritone/pathing/path/CutoffPath.java index ea10e8c5..d55d8652 100644 --- a/src/main/java/baritone/pathing/path/CutoffPath.java +++ b/src/main/java/baritone/pathing/path/CutoffPath.java @@ -26,13 +26,13 @@ import java.util.List; public class CutoffPath implements IPath { - final List path; + private final List path; - final List movements; + private final List movements; private final int numNodes; - final Goal goal; + private final Goal goal; public CutoffPath(IPath prev, int lastPositionToInclude) { path = prev.positions().subList(0, lastPositionToInclude + 1); diff --git a/src/main/java/baritone/utils/InputOverrideHandler.java b/src/main/java/baritone/utils/InputOverrideHandler.java index 6024df63..eba6b9c0 100755 --- a/src/main/java/baritone/utils/InputOverrideHandler.java +++ b/src/main/java/baritone/utils/InputOverrideHandler.java @@ -49,8 +49,6 @@ import java.util.Map; */ public final class InputOverrideHandler implements Helper { - public InputOverrideHandler() {} - /** * Maps keybinds to whether or not we are forcing their state down. */ diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 9a6ca4d7..1415d9e2 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -41,11 +41,6 @@ public class ToolSet implements Helper { */ private Map breakStrengthCache = new HashMap<>(); - /** - * Create a toolset from the current player's inventory (but don't calculate any hardness values just yet) - */ - public ToolSet() {} - /** * Calculate which tool on the hotbar is best for mining * From 543c0d0a3357187ab024d6b3ac158214cc6d98d3 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 17:51:39 -0700 Subject: [PATCH 067/120] dont modify arguments --- src/main/java/baritone/utils/PathRenderer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index ae078268..ee9a585c 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -56,7 +56,7 @@ public final class PathRenderer implements Helper { private static final Tessellator TESSELLATOR = Tessellator.getInstance(); private static final BufferBuilder BUFFER = TESSELLATOR.getBuffer(); - public static void drawPath(IPath path, int startIndex, EntityPlayerSP player, float partialTicks, Color color, boolean fadeOut, int fadeStart, int fadeEnd) { + public static void drawPath(IPath path, int startIndex, EntityPlayerSP player, float partialTicks, Color color, boolean fadeOut, int fadeStart0, int fadeEnd0) { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F); @@ -66,8 +66,8 @@ public final class PathRenderer implements Helper { List positions = path.positions(); int next; Tessellator tessellator = Tessellator.getInstance(); - fadeStart += startIndex; - fadeEnd += startIndex; + int fadeStart = fadeStart0 + startIndex; + int fadeEnd = fadeEnd0 + startIndex; for (int i = startIndex; i < positions.size() - 1; i = next) { BlockPos start = positions.get(i); From b7cc707737fa12998e7b3fb96844c300628b48f0 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 17:58:35 -0700 Subject: [PATCH 068/120] misc cleanup 4 --- src/main/java/baritone/Settings.java | 2 +- src/main/java/baritone/cache/CachedRegion.java | 2 +- src/main/java/baritone/pathing/calc/AStarPathFinder.java | 2 +- .../java/baritone/pathing/calc/openset/LinkedListOpenSet.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 48dd17d8..d9c2ff40 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -414,7 +414,7 @@ public class Settings { } } } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } byLowerName = Collections.unmodifiableMap(tmpByName); allSettings = Collections.unmodifiableList(tmpAll); diff --git a/src/main/java/baritone/cache/CachedRegion.java b/src/main/java/baritone/cache/CachedRegion.java index 1e5e8ea5..1805f5ea 100644 --- a/src/main/java/baritone/cache/CachedRegion.java +++ b/src/main/java/baritone/cache/CachedRegion.java @@ -100,7 +100,7 @@ public final class CachedRegion implements IBlockTypeAccess { return res; } - final synchronized void updateCachedChunk(int chunkX, int chunkZ, CachedChunk chunk) { + public final synchronized void updateCachedChunk(int chunkX, int chunkZ, CachedChunk chunk) { this.chunks[chunkX][chunkZ] = chunk; hasUnsavedChanges = true; } diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index ddf61b7a..8868e1fe 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -116,7 +116,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { int chunkZ = currentNodePos.z >> 4; if (dest.x >> 4 != chunkX || dest.z >> 4 != chunkZ) { // only need to check if the destination is a loaded chunk if it's in a different chunk than the start of the movement - if (chunkProvider.getLoadedChunk(chunkX, chunkZ) == null) { + if (chunkProvider.isChunkGeneratedAt(chunkX, chunkZ)) { // see issue #106 if (cachedWorld == null || !cachedWorld.isCached(dest)) { numEmptyChunk++; diff --git a/src/main/java/baritone/pathing/calc/openset/LinkedListOpenSet.java b/src/main/java/baritone/pathing/calc/openset/LinkedListOpenSet.java index 8ff5a674..e06a9850 100644 --- a/src/main/java/baritone/pathing/calc/openset/LinkedListOpenSet.java +++ b/src/main/java/baritone/pathing/calc/openset/LinkedListOpenSet.java @@ -83,7 +83,7 @@ class LinkedListOpenSet implements IOpenSet { } public static class Node { //wrapper with next - Node nextOpen; - PathNode val; + private Node nextOpen; + private PathNode val; } } From bc82276e62b26f664f016f4a73a9a8c8d9f5a03b Mon Sep 17 00:00:00 2001 From: Brady Date: Sun, 16 Sep 2018 20:14:51 -0500 Subject: [PATCH 069/120] Why null check when you can default null --- src/main/java/baritone/cache/ChunkPacker.java | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index 3055553b..042c37f4 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -143,29 +143,28 @@ public final class ChunkPacker implements Helper { } public static IBlockState pathingTypeToBlock(PathingBlockType type) { - if (type != null) { - switch (type) { - case AIR: - return Blocks.AIR.getDefaultState(); - case WATER: - return Blocks.WATER.getDefaultState(); - case AVOID: - return Blocks.LAVA.getDefaultState(); - case SOLID: - // Dimension solid types - switch (mc.player.dimension) { - case -1: - return Blocks.NETHERRACK.getDefaultState(); - case 0: - return Blocks.STONE.getDefaultState(); - case 1: - return Blocks.END_STONE.getDefaultState(); - } + switch (type) { + case AIR: + return Blocks.AIR.getDefaultState(); + case WATER: + return Blocks.WATER.getDefaultState(); + case AVOID: + return Blocks.LAVA.getDefaultState(); + case SOLID: + // Dimension solid types + switch (mc.player.dimension) { + case -1: + return Blocks.NETHERRACK.getDefaultState(); + case 0: + return Blocks.STONE.getDefaultState(); + case 1: + return Blocks.END_STONE.getDefaultState(); + } - // The fallback solid type - return Blocks.STONE.getDefaultState(); - } + // The fallback solid type + return Blocks.STONE.getDefaultState(); + default: + return null; } - return null; } } From aa2caf63d3389bc9c2b5c021c426a40a9aa3c106 Mon Sep 17 00:00:00 2001 From: Brady Date: Sun, 16 Sep 2018 21:18:39 -0500 Subject: [PATCH 070/120] Clean up PathingBehavior#findPath --- .../java/baritone/behavior/PathingBehavior.java | 16 ++++------------ .../java/baritone/pathing/goals/GoalBlock.java | 1 + .../baritone/pathing/goals/GoalGetToBlock.java | 1 + .../java/baritone/pathing/goals/GoalNear.java | 1 + .../baritone/pathing/goals/GoalTwoBlocks.java | 1 + 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 22440af4..b42075d6 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -33,6 +33,7 @@ import baritone.pathing.path.PathExecutor; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; import baritone.utils.PathRenderer; +import baritone.utils.interfaces.IGoalRenderPos; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.chunk.EmptyChunk; @@ -309,18 +310,9 @@ public final class PathingBehavior extends Behavior implements Helper { } if (Baritone.settings().simplifyUnloadedYCoord.get()) { BlockPos pos = null; - if (goal instanceof GoalBlock) { - pos = ((GoalBlock) goal).getGoalPos(); - } - if (goal instanceof GoalTwoBlocks) { - pos = ((GoalTwoBlocks) goal).getGoalPos(); - } - if (goal instanceof GoalNear) { - pos = ((GoalNear) goal).getGoalPos(); - } - if (goal instanceof GoalGetToBlock) { - pos = ((GoalGetToBlock) goal).getGoalPos(); - } + if (goal instanceof IGoalRenderPos) + pos = ((IGoalRenderPos) goal).getGoalPos(); + // TODO simplify each individual goal in a GoalComposite if (pos != null && world().getChunk(pos) instanceof EmptyChunk) { logDebug("Simplifying " + goal.getClass() + " to GoalXZ due to distance"); diff --git a/src/main/java/baritone/pathing/goals/GoalBlock.java b/src/main/java/baritone/pathing/goals/GoalBlock.java index 0c96787c..b85f468a 100644 --- a/src/main/java/baritone/pathing/goals/GoalBlock.java +++ b/src/main/java/baritone/pathing/goals/GoalBlock.java @@ -73,6 +73,7 @@ public class GoalBlock implements Goal, IGoalRenderPos { /** * @return The position of this goal as a {@link BlockPos} */ + @Override public BlockPos getGoalPos() { return new BlockPos(x, y, z); } diff --git a/src/main/java/baritone/pathing/goals/GoalGetToBlock.java b/src/main/java/baritone/pathing/goals/GoalGetToBlock.java index 16cf9f4b..cefed91a 100644 --- a/src/main/java/baritone/pathing/goals/GoalGetToBlock.java +++ b/src/main/java/baritone/pathing/goals/GoalGetToBlock.java @@ -39,6 +39,7 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos { this.z = pos.getZ(); } + @Override public BlockPos getGoalPos() { return new BetterBlockPos(x, y, z); } diff --git a/src/main/java/baritone/pathing/goals/GoalNear.java b/src/main/java/baritone/pathing/goals/GoalNear.java index 7786c4f1..1b214c10 100644 --- a/src/main/java/baritone/pathing/goals/GoalNear.java +++ b/src/main/java/baritone/pathing/goals/GoalNear.java @@ -49,6 +49,7 @@ public class GoalNear implements Goal, IGoalRenderPos { return GoalBlock.calculate(diffX, diffY, diffZ); } + @Override public BlockPos getGoalPos() { return new BlockPos(x, y, z); } diff --git a/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java b/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java index dcd8d17d..edc70483 100644 --- a/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java +++ b/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java @@ -69,6 +69,7 @@ public class GoalTwoBlocks implements Goal, IGoalRenderPos { return GoalBlock.calculate(xDiff, yDiff, zDiff); } + @Override public BlockPos getGoalPos() { return new BlockPos(x, y, z); } From b4ddd98bcbe4ec2c0fc0e6ca032de8fb77c5375e Mon Sep 17 00:00:00 2001 From: Brady Date: Sun, 16 Sep 2018 21:24:13 -0500 Subject: [PATCH 071/120] cUrLy BrAcKeT --- src/main/java/baritone/behavior/PathingBehavior.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index b42075d6..6dee8b46 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -310,8 +310,9 @@ public final class PathingBehavior extends Behavior implements Helper { } if (Baritone.settings().simplifyUnloadedYCoord.get()) { BlockPos pos = null; - if (goal instanceof IGoalRenderPos) + if (goal instanceof IGoalRenderPos) { pos = ((IGoalRenderPos) goal).getGoalPos(); + } // TODO simplify each individual goal in a GoalComposite if (pos != null && world().getChunk(pos) instanceof EmptyChunk) { From 5f0009a060d8c8f96d42259fe013ab884942f838 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 19:24:21 -0700 Subject: [PATCH 072/120] fuming --- src/api/java/baritone/api/behavior/Behavior.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/behavior/Behavior.java b/src/api/java/baritone/api/behavior/Behavior.java index 67d3c25b..0ee05429 100644 --- a/src/api/java/baritone/api/behavior/Behavior.java +++ b/src/api/java/baritone/api/behavior/Behavior.java @@ -50,8 +50,9 @@ public class Behavior implements AbstractGameEventListener, Toggleable { */ @Override public final boolean setEnabled(boolean enabled) { - if (enabled == this.enabled) + if (enabled == this.enabled) { return this.enabled; + } if (this.enabled = enabled) { this.onEnable(); From eac5184d4db30313f8f947a24ba6d57dbf1a681a Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 19:30:47 -0700 Subject: [PATCH 073/120] nit --- src/api/java/baritone/api/behavior/Behavior.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/behavior/Behavior.java b/src/api/java/baritone/api/behavior/Behavior.java index 0ee05429..b231465f 100644 --- a/src/api/java/baritone/api/behavior/Behavior.java +++ b/src/api/java/baritone/api/behavior/Behavior.java @@ -40,7 +40,7 @@ public class Behavior implements AbstractGameEventListener, Toggleable { */ @Override public final boolean toggle() { - return this.setEnabled(!this.enabled); + return this.setEnabled(!this.isEnabled()); } /** From 71473ab17d54965a5b0c576420c29550648d2ab5 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 19:34:18 -0700 Subject: [PATCH 074/120] nit 2 --- src/api/java/baritone/api/behavior/Behavior.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/api/java/baritone/api/behavior/Behavior.java b/src/api/java/baritone/api/behavior/Behavior.java index b231465f..68ca580f 100644 --- a/src/api/java/baritone/api/behavior/Behavior.java +++ b/src/api/java/baritone/api/behavior/Behavior.java @@ -53,13 +53,11 @@ public class Behavior implements AbstractGameEventListener, Toggleable { if (enabled == this.enabled) { return this.enabled; } - if (this.enabled = enabled) { this.onEnable(); } else { this.onDisable(); } - return this.enabled; } From f25f264fd33d5263049b975ae23d76a2c5a29cbe Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 19:43:48 -0700 Subject: [PATCH 075/120] epicer default --- src/main/java/baritone/cache/ChunkPacker.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index 042c37f4..2ed6d596 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -156,13 +156,11 @@ public final class ChunkPacker implements Helper { case -1: return Blocks.NETHERRACK.getDefaultState(); case 0: + default: // The fallback solid type return Blocks.STONE.getDefaultState(); case 1: return Blocks.END_STONE.getDefaultState(); } - - // The fallback solid type - return Blocks.STONE.getDefaultState(); default: return null; } From 3011b85aee5f9a0a44004eac443668b006337cf0 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 19:50:07 -0700 Subject: [PATCH 076/120] add defaults to switches --- .../java/baritone/behavior/LookBehavior.java | 4 +- .../baritone/behavior/MemoryBehavior.java | 41 +++++++++---------- .../baritone/behavior/PathingBehavior.java | 5 ++- .../java/baritone/event/GameEventHandler.java | 16 +++----- .../movement/movements/MovementParkour.java | 3 +- 5 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java index fa10d27d..53f8132f 100644 --- a/src/main/java/baritone/behavior/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -19,9 +19,9 @@ package baritone.behavior; import baritone.Baritone; import baritone.Settings; +import baritone.api.behavior.Behavior; import baritone.api.event.events.PlayerUpdateEvent; import baritone.api.event.events.RotationMoveEvent; -import baritone.api.behavior.Behavior; import baritone.utils.Helper; import baritone.utils.Rotation; @@ -89,6 +89,8 @@ public final class LookBehavior extends Behavior implements Helper { } break; } + default: + break; } } diff --git a/src/main/java/baritone/behavior/MemoryBehavior.java b/src/main/java/baritone/behavior/MemoryBehavior.java index ee89ebbf..4c73e33d 100644 --- a/src/main/java/baritone/behavior/MemoryBehavior.java +++ b/src/main/java/baritone/behavior/MemoryBehavior.java @@ -17,10 +17,10 @@ package baritone.behavior; +import baritone.api.behavior.Behavior; import baritone.api.event.events.PacketEvent; import baritone.api.event.events.PlayerUpdateEvent; import baritone.api.event.events.type.EventState; -import baritone.api.behavior.Behavior; import baritone.utils.Helper; import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; @@ -94,31 +94,28 @@ public final class MemoryBehavior extends Behavior implements Helper { public void onReceivePacket(PacketEvent event) { Packet p = event.getPacket(); - switch (event.getState()) { - case PRE: { - if (p instanceof SPacketOpenWindow) { - SPacketOpenWindow packet = event.cast(); + if (event.getState() == EventState.PRE) { + if (p instanceof SPacketOpenWindow) { + SPacketOpenWindow packet = event.cast(); - // Remove any entries that were created over a second ago, this should make up for INSANE latency - this.futureInventories.removeIf(i -> System.nanoTime() / 1000000L - i.time > 1000); + // Remove any entries that were created over a second ago, this should make up for INSANE latency + this.futureInventories.removeIf(i -> System.nanoTime() / 1000000L - i.time > 1000); - this.futureInventories.stream() - .filter(i -> i.type.equals(packet.getGuiId()) && i.slots == packet.getSlotCount()) - .findFirst().ifPresent(matched -> { - // Remove the future inventory - this.futureInventories.remove(matched); + this.futureInventories.stream() + .filter(i -> i.type.equals(packet.getGuiId()) && i.slots == packet.getSlotCount()) + .findFirst().ifPresent(matched -> { + // Remove the future inventory + this.futureInventories.remove(matched); - // Setup the remembered inventory - RememberedInventory inventory = this.rememberedInventories.computeIfAbsent(matched.pos, pos -> new RememberedInventory()); - inventory.windowId = packet.getWindowId(); - inventory.size = packet.getSlotCount(); - }); - } + // Setup the remembered inventory + RememberedInventory inventory = this.rememberedInventories.computeIfAbsent(matched.pos, pos -> new RememberedInventory()); + inventory.windowId = packet.getWindowId(); + inventory.size = packet.getSlotCount(); + }); + } - if (p instanceof SPacketCloseWindow) { - updateInventory(); - } - break; + if (p instanceof SPacketCloseWindow) { + updateInventory(); } } } diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 6dee8b46..34358b5d 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -26,7 +26,8 @@ import baritone.api.event.events.TickEvent; import baritone.pathing.calc.AStarPathFinder; import baritone.pathing.calc.AbstractNodeCostSearch; import baritone.pathing.calc.IPathFinder; -import baritone.pathing.goals.*; +import baritone.pathing.goals.Goal; +import baritone.pathing.goals.GoalXZ; import baritone.pathing.movement.MovementHelper; import baritone.pathing.path.IPath; import baritone.pathing.path.PathExecutor; @@ -163,6 +164,8 @@ public final class PathingBehavior extends Behavior implements Helper { case POST: mc.gameSettings.autoJump = lastAutoJump; break; + default: + break; } } } diff --git a/src/main/java/baritone/event/GameEventHandler.java b/src/main/java/baritone/event/GameEventHandler.java index 5d2c6558..7f29968d 100644 --- a/src/main/java/baritone/event/GameEventHandler.java +++ b/src/main/java/baritone/event/GameEventHandler.java @@ -21,11 +21,11 @@ import baritone.Baritone; import baritone.api.event.events.*; import baritone.api.event.events.type.EventState; import baritone.api.event.listener.IGameEventListener; +import baritone.api.utils.interfaces.Toggleable; import baritone.cache.WorldProvider; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; import baritone.utils.InputOverrideHandler; -import baritone.api.utils.interfaces.Toggleable; import net.minecraft.client.settings.KeyBinding; import net.minecraft.world.chunk.Chunk; import org.lwjgl.input.Keyboard; @@ -136,15 +136,11 @@ public final class GameEventHandler implements IGameEventListener, Helper { BlockStateInterface.clearCachedChunk(); - switch (event.getState()) { - case PRE: - break; - case POST: - cache.closeWorld(); - if (event.getWorld() != null) { - cache.initWorld(event.getWorld()); - } - break; + if (event.getState() == EventState.POST) { + cache.closeWorld(); + if (event.getWorld() != null) { + cache.initWorld(event.getWorld()); + } } listeners.forEach(l -> { diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index ca116342..ab7a32cc 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -130,8 +130,9 @@ public class MovementParkour extends Movement { return WALK_ONE_BLOCK_COST * 3; case 4: return SPRINT_ONE_BLOCK_COST * 4; + default: + throw new IllegalStateException("LOL"); } - throw new IllegalStateException("LOL"); } From 0b640199efabb43353ff517d3bdbf1be1eabad0c Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 19:56:33 -0700 Subject: [PATCH 077/120] add defaults to more switches --- .../java/baritone/behavior/LookBehavior.java | 3 +++ .../baritone/behavior/MemoryBehavior.java | 27 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java index 53f8132f..ef5b6b7d 100644 --- a/src/main/java/baritone/behavior/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -92,6 +92,7 @@ public final class LookBehavior extends Behavior implements Helper { default: break; } + new Thread().start(); } @Override @@ -111,6 +112,8 @@ public final class LookBehavior extends Behavior implements Helper { this.target = null; } break; + default: + break; } } } diff --git a/src/main/java/baritone/behavior/MemoryBehavior.java b/src/main/java/baritone/behavior/MemoryBehavior.java index 4c73e33d..d8794a66 100644 --- a/src/main/java/baritone/behavior/MemoryBehavior.java +++ b/src/main/java/baritone/behavior/MemoryBehavior.java @@ -65,27 +65,24 @@ public final class MemoryBehavior extends Behavior implements Helper { public void onSendPacket(PacketEvent event) { Packet p = event.getPacket(); - switch (event.getState()) { - case PRE: { - if (p instanceof CPacketPlayerTryUseItemOnBlock) { - CPacketPlayerTryUseItemOnBlock packet = event.cast(); + if (event.getState() == EventState.PRE) { + if (p instanceof CPacketPlayerTryUseItemOnBlock) { + CPacketPlayerTryUseItemOnBlock packet = event.cast(); - TileEntity tileEntity = world().getTileEntity(packet.getPos()); + TileEntity tileEntity = world().getTileEntity(packet.getPos()); - // Ensure the TileEntity is a container of some sort - if (tileEntity instanceof TileEntityLockable) { + // Ensure the TileEntity is a container of some sort + if (tileEntity instanceof TileEntityLockable) { - TileEntityLockable lockable = (TileEntityLockable) tileEntity; - int size = lockable.getSizeInventory(); + TileEntityLockable lockable = (TileEntityLockable) tileEntity; + int size = lockable.getSizeInventory(); - this.futureInventories.add(new FutureInventory(System.nanoTime() / 1000000L, size, lockable.getGuiID(), tileEntity.getPos())); - } + this.futureInventories.add(new FutureInventory(System.nanoTime() / 1000000L, size, lockable.getGuiID(), tileEntity.getPos())); } + } - if (p instanceof CPacketCloseWindow) { - updateInventory(); - } - break; + if (p instanceof CPacketCloseWindow) { + updateInventory(); } } } From 74dc8d4118c41a651ab7fe737aa15808e5a460f4 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 19:58:44 -0700 Subject: [PATCH 078/120] unneeded --- src/main/java/baritone/utils/BlockStateInterface.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/baritone/utils/BlockStateInterface.java b/src/main/java/baritone/utils/BlockStateInterface.java index bb4d094d..6db9a66e 100644 --- a/src/main/java/baritone/utils/BlockStateInterface.java +++ b/src/main/java/baritone/utils/BlockStateInterface.java @@ -39,10 +39,6 @@ public class BlockStateInterface implements Helper { private static CachedRegion prevCached = null; private static IBlockState AIR = Blocks.AIR.getDefaultState(); - public static final Block waterFlowing = Blocks.FLOWING_WATER; - public static final Block waterStill = Blocks.WATER; - public static final Block lavaFlowing = Blocks.FLOWING_LAVA; - public static final Block lavaStill = Blocks.LAVA; public static IBlockState get(BlockPos pos) { return get(pos.getX(), pos.getY(), pos.getZ()); @@ -111,7 +107,7 @@ public class BlockStateInterface implements Helper { * @return Whether or not the block is water */ public static boolean isWater(Block b) { - return b == waterFlowing || b == waterStill; + return b == Blocks.FLOWING_WATER || b == Blocks.WATER; } /** @@ -126,7 +122,7 @@ public class BlockStateInterface implements Helper { } public static boolean isLava(Block b) { - return b == lavaFlowing || b == lavaStill; + return b == Blocks.FLOWING_LAVA || b == Blocks.LAVA; } /** From a589cb0d9ec37dbdac7e790dba417b089a545d6e Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 20:16:05 -0700 Subject: [PATCH 079/120] rearranged constructors --- src/main/java/baritone/behavior/FollowBehavior.java | 7 +++---- src/main/java/baritone/behavior/LookBehavior.java | 4 ++-- src/main/java/baritone/behavior/MemoryBehavior.java | 4 ++-- src/main/java/baritone/behavior/MineBehavior.java | 5 ++--- src/main/java/baritone/behavior/PathingBehavior.java | 6 ++---- .../java/baritone/pathing/calc/AStarPathFinder.java | 4 ++-- .../java/baritone/pathing/movement/Movement.java | 12 ++++++------ src/main/java/baritone/utils/BlockBreakHelper.java | 6 +++--- src/main/java/baritone/utils/PathRenderer.java | 7 +++---- 9 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/main/java/baritone/behavior/FollowBehavior.java b/src/main/java/baritone/behavior/FollowBehavior.java index 0a7fff6b..8eb51708 100644 --- a/src/main/java/baritone/behavior/FollowBehavior.java +++ b/src/main/java/baritone/behavior/FollowBehavior.java @@ -17,8 +17,8 @@ package baritone.behavior; -import baritone.api.event.events.TickEvent; import baritone.api.behavior.Behavior; +import baritone.api.event.events.TickEvent; import baritone.pathing.goals.GoalNear; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; @@ -32,11 +32,10 @@ public final class FollowBehavior extends Behavior { public static final FollowBehavior INSTANCE = new FollowBehavior(); - private FollowBehavior() { - } - private Entity following; + private FollowBehavior() {} + @Override public void onTick(TickEvent event) { if (event.getType() == TickEvent.Type.OUT) { diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java index ef5b6b7d..c577588f 100644 --- a/src/main/java/baritone/behavior/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -29,8 +29,6 @@ public final class LookBehavior extends Behavior implements Helper { public static final LookBehavior INSTANCE = new LookBehavior(); - private LookBehavior() {} - /** * Target's values are as follows: *

@@ -51,6 +49,8 @@ public final class LookBehavior extends Behavior implements Helper { */ private float lastYaw; + private LookBehavior() {} + public void updateTarget(Rotation target, boolean force) { this.target = target; this.force = force || !Baritone.settings().freeLook.get(); diff --git a/src/main/java/baritone/behavior/MemoryBehavior.java b/src/main/java/baritone/behavior/MemoryBehavior.java index d8794a66..716dfaee 100644 --- a/src/main/java/baritone/behavior/MemoryBehavior.java +++ b/src/main/java/baritone/behavior/MemoryBehavior.java @@ -42,8 +42,6 @@ public final class MemoryBehavior extends Behavior implements Helper { public static MemoryBehavior INSTANCE = new MemoryBehavior(); - private MemoryBehavior() {} - /** * Possible future inventories that we will be able to remember */ @@ -54,6 +52,8 @@ public final class MemoryBehavior extends Behavior implements Helper { */ private final Map rememberedInventories = new HashMap<>(); + private MemoryBehavior() {} + @Override public void onPlayerUpdate(PlayerUpdateEvent event) { if (event.getState() == EventState.PRE) { diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 4c542c47..33a8e96d 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -49,12 +49,11 @@ public final class MineBehavior extends Behavior implements Helper { public static final MineBehavior INSTANCE = new MineBehavior(); - private MineBehavior() { - } - private List mining; private List locationsCache; + private MineBehavior() {} + @Override public void onTick(TickEvent event) { if (mining == null) { diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 34358b5d..8d962bd6 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -47,9 +47,6 @@ public final class PathingBehavior extends Behavior implements Helper { public static final PathingBehavior INSTANCE = new PathingBehavior(); - private PathingBehavior() { - } - private PathExecutor current; private PathExecutor next; @@ -62,6 +59,8 @@ public final class PathingBehavior extends Behavior implements Helper { private boolean lastAutoJump; + private PathingBehavior() {} + private void dispatchPathEvent(PathEvent event) { Baritone.INSTANCE.getExecutor().execute(() -> Baritone.INSTANCE.getGameEventHandler().onPathEvent(event)); } @@ -391,6 +390,5 @@ public final class PathingBehavior extends Behavior implements Helper { // if (end - start > 0) { // System.out.println("Frame took " + (split - start) + " " + (end - split)); //} - } } diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index 8868e1fe..4c47639e 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -50,6 +50,8 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { private final Optional> favoredPositions; + private final Random random = new Random(); + public AStarPathFinder(BlockPos start, Goal goal, Optional> favoredPositions) { super(start, goal); this.favoredPositions = favoredPositions.map(HashSet::new); // <-- okay this is epic @@ -250,8 +252,6 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { }; } - private final Random random = new Random(); - private void shuffle(T[] list) { int len = list.length; for (int i = 0; i < len; i++) { diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 4f31d1a0..7b1bce61 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -59,6 +59,12 @@ public abstract class Movement implements Helper, MovementHelper { private Double cost; + public List toBreakCached = null; + public List toPlaceCached = null; + public List toWalkIntoCached = null; + + private Boolean calculatedWhileLoaded; + protected Movement(BetterBlockPos src, BetterBlockPos dest, BlockPos[] toBreak, BlockPos toPlace) { this.src = src; this.dest = dest; @@ -290,8 +296,6 @@ public abstract class Movement implements Helper, MovementHelper { return getDest().subtract(getSrc()); } - private Boolean calculatedWhileLoaded; - public void checkLoadedChunk() { calculatedWhileLoaded = !(world().getChunk(getDest()) instanceof EmptyChunk); } @@ -300,10 +304,6 @@ public abstract class Movement implements Helper, MovementHelper { return calculatedWhileLoaded; } - public List toBreakCached = null; - public List toPlaceCached = null; - public List toWalkIntoCached = null; - public List toBreak() { if (toBreakCached != null) { return toBreakCached; diff --git a/src/main/java/baritone/utils/BlockBreakHelper.java b/src/main/java/baritone/utils/BlockBreakHelper.java index 8c224a2b..b293f01e 100644 --- a/src/main/java/baritone/utils/BlockBreakHelper.java +++ b/src/main/java/baritone/utils/BlockBreakHelper.java @@ -26,15 +26,15 @@ import net.minecraft.util.math.BlockPos; * @since 8/25/2018 */ public final class BlockBreakHelper implements Helper { - - private BlockBreakHelper() {} - + /** * The last block that we tried to break, if this value changes * between attempts, then we re-initialize the breaking process. */ private static BlockPos lastBlock; + private BlockBreakHelper() {} + public static void tryBreakBlock(BlockPos pos, EnumFacing side) { if (!pos.equals(lastBlock)) { mc.playerController.clickBlock(pos, side); diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index ee9a585c..a05e89bf 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -49,13 +49,12 @@ import static org.lwjgl.opengl.GL11.*; * @since 8/9/2018 4:39 PM */ public final class PathRenderer implements Helper { - - private PathRenderer() { - } - + private static final Tessellator TESSELLATOR = Tessellator.getInstance(); private static final BufferBuilder BUFFER = TESSELLATOR.getBuffer(); + private PathRenderer() {} + public static void drawPath(IPath path, int startIndex, EntityPlayerSP player, float partialTicks, Color color, boolean fadeOut, int fadeStart0, int fadeEnd0) { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); From f36b11016ead93fe12ebab9cb1205e9724564adc Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 20:19:41 -0700 Subject: [PATCH 080/120] codacy badge --- README.md | 2 +- src/main/java/baritone/utils/BlockBreakHelper.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f280d18a..10e0c46c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Baritone -[![Build Status](https://travis-ci.com/cabaletta/baritone.svg?branch=master)](https://travis-ci.com/cabaletta/baritone) +[![Build Status](https://travis-ci.com/cabaletta/baritone.svg?branch=master)](https://travis-ci.com/cabaletta/baritone) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/7150d8ccf6094057b1782aa7a8f92d7d)](https://www.codacy.com/app/leijurv/baritone?utm_source=github.com&utm_medium=referral&utm_content=cabaletta/baritone&utm_campaign=Badge_Grade) A Minecraft bot. This project is an updated version of [Minebot](https://github.com/leijurv/MineBot/), the original version of the bot for Minecraft 1.8, rebuilt for 1.12.2. diff --git a/src/main/java/baritone/utils/BlockBreakHelper.java b/src/main/java/baritone/utils/BlockBreakHelper.java index b293f01e..ef12fff2 100644 --- a/src/main/java/baritone/utils/BlockBreakHelper.java +++ b/src/main/java/baritone/utils/BlockBreakHelper.java @@ -26,7 +26,7 @@ import net.minecraft.util.math.BlockPos; * @since 8/25/2018 */ public final class BlockBreakHelper implements Helper { - + /** * The last block that we tried to break, if this value changes * between attempts, then we re-initialize the breaking process. From d2be54f138db91b6f3f9b9fd3a0287e84906c82e Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 16 Sep 2018 20:23:08 -0700 Subject: [PATCH 081/120] license badge --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 10e0c46c..30754ed6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Baritone -[![Build Status](https://travis-ci.com/cabaletta/baritone.svg?branch=master)](https://travis-ci.com/cabaletta/baritone) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/7150d8ccf6094057b1782aa7a8f92d7d)](https://www.codacy.com/app/leijurv/baritone?utm_source=github.com&utm_medium=referral&utm_content=cabaletta/baritone&utm_campaign=Badge_Grade) +[![Build Status](https://travis-ci.com/cabaletta/baritone.svg?branch=master)](https://travis-ci.com/cabaletta/baritone) +[![License](https://img.shields.io/github/license/ImpactDevelopment/ClientAPI.svg)](LICENSE) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/7150d8ccf6094057b1782aa7a8f92d7d)](https://www.codacy.com/app/leijurv/baritone?utm_source=github.com&utm_medium=referral&utm_content=cabaletta/baritone&utm_campaign=Badge_Grade) A Minecraft bot. This project is an updated version of [Minebot](https://github.com/leijurv/MineBot/), the original version of the bot for Minecraft 1.8, rebuilt for 1.12.2. From 583a5046ef241c26924134cc4f56bb4d987c408d Mon Sep 17 00:00:00 2001 From: Brady Date: Mon, 17 Sep 2018 12:17:42 -0500 Subject: [PATCH 082/120] Utilize the fact that all MovementState methods return "this" --- .../movement/movements/MovementDescend.java | 3 +-- .../movement/movements/MovementDownward.java | 3 +-- .../movement/movements/MovementFall.java | 3 +-- .../movement/movements/MovementPillar.java | 3 +-- .../movement/movements/MovementTraverse.java | 21 +++++++------------ 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDescend.java b/src/main/java/baritone/pathing/movement/movements/MovementDescend.java index b033b6fc..99e6872b 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDescend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDescend.java @@ -76,8 +76,7 @@ public class MovementDescend extends Movement { if (playerFeet.equals(dest)) { if (BlockStateInterface.isLiquid(dest) || player().posY - playerFeet.getY() < 0.094) { // lilypads // Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately - state.setStatus(MovementStatus.SUCCESS); - return state; + return state.setStatus(MovementStatus.SUCCESS); } else { System.out.println(player().posY + " " + playerFeet.getY() + " " + (player().posY - playerFeet.getY())); } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDownward.java b/src/main/java/baritone/pathing/movement/movements/MovementDownward.java index 48d26161..2ceb3c16 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDownward.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDownward.java @@ -66,8 +66,7 @@ public class MovementDownward extends Movement { } if (playerFeet().equals(dest)) { - state.setStatus(MovementState.MovementStatus.SUCCESS); - return state; + return state.setStatus(MovementState.MovementStatus.SUCCESS); } double diffX = player().posX - (dest.getX() + 0.5); double diffZ = player().posZ - (dest.getZ() + 0.5); diff --git a/src/main/java/baritone/pathing/movement/movements/MovementFall.java b/src/main/java/baritone/pathing/movement/movements/MovementFall.java index e0356444..a82826eb 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementFall.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementFall.java @@ -113,8 +113,7 @@ public class MovementFall extends Movement { Rotation targetRotation = null; if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > Baritone.settings().maxFallHeightNoWater.get() && !playerFeet.equals(dest)) { if (!InventoryPlayer.isHotbar(player().inventory.getSlotFor(STACK_BUCKET_WATER)) || world().provider.isNether()) { - state.setStatus(MovementStatus.UNREACHABLE); - return state; + return state.setStatus(MovementStatus.UNREACHABLE); } if (player().posY - dest.getY() < mc.playerController.getBlockReachDistance()) { diff --git a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java index db5bbf49..1885f48b 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java @@ -160,8 +160,7 @@ public class MovementPillar extends Movement { } else { // Get ready to place a throwaway block if (!MovementHelper.throwaway(true)) { - state.setStatus(MovementState.MovementStatus.UNREACHABLE); - return state; + return state.setStatus(MovementState.MovementStatus.UNREACHABLE); } numTicks++; diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index f28f29fb..b0efeb79 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -180,9 +180,8 @@ public class MovementTraverse extends Movement { } if (isDoorActuallyBlockingUs) { if (!(Blocks.IRON_DOOR.equals(pb0.getBlock()) || Blocks.IRON_DOOR.equals(pb1.getBlock()))) { - state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())), true)); - state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); - return state; + return state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(positionsToBreak[0], world())), true)) + .setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); } } } @@ -196,9 +195,8 @@ public class MovementTraverse extends Movement { } if (blocked != null) { - state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(blocked, world())), true)); - state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); - return state; + return state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.calcCenterFromCoords(blocked, world())), true)) + .setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); } } @@ -214,8 +212,7 @@ public class MovementTraverse extends Movement { if (isTheBridgeBlockThere) { if (playerFeet().equals(dest)) { - state.setStatus(MovementState.MovementStatus.SUCCESS); - return state; + return state.setStatus(MovementState.MovementStatus.SUCCESS); } if (wasTheBridgeBlockAlwaysThere && !BlockStateInterface.isLiquid(playerFeet())) { state.setInput(InputOverrideHandler.Input.SPRINT, true); @@ -248,9 +245,8 @@ public class MovementTraverse extends Movement { double dist = Math.max(Math.abs(dest.getX() + 0.5 - player().posX), Math.abs(dest.getZ() + 0.5 - player().posZ)); if (dist < 0.85) { // 0.5 + 0.3 + epsilon MovementHelper.moveTowards(state, dest); - state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, false); - state.setInput(InputOverrideHandler.Input.MOVE_BACK, true); - return state; + return state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, false) + .setInput(InputOverrideHandler.Input.MOVE_BACK, true); } } state.setInput(InputOverrideHandler.Input.MOVE_BACK, false); @@ -290,8 +286,7 @@ public class MovementTraverse extends Movement { state.setInput(InputOverrideHandler.Input.MOVE_BACK, true); state.setInput(InputOverrideHandler.Input.SNEAK, true); if (Objects.equals(LookBehaviorUtils.getSelectedBlock().orElse(null), goalLook)) { - state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); // wait to right click until we are able to place - return state; + return state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true); // wait to right click until we are able to place } // Out.log("Trying to look at " + goalLook + ", actually looking at" + Baritone.whatAreYouLookingAt()); return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true); From b3654492beeff3e49dfa09fb40558ec3cc39a4f0 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 17 Sep 2018 10:36:39 -0700 Subject: [PATCH 083/120] follow offset distance and direction --- src/main/java/baritone/Settings.java | 17 +++++++++++++++++ .../java/baritone/behavior/FollowBehavior.java | 8 ++++++-- .../baritone/utils/ExampleBaritoneControl.java | 3 +++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index d9c2ff40..a3fb2b4f 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -358,6 +358,23 @@ public class Settings { */ public Setting internalMiningAirException = new Setting<>(true); + /** + * The actual GoalNear is set this distance away from the entity you're following + *

+ * For example, set followOffsetDistance to 5 and followRadius to 0 to always stay precisely 5 blocks north of your follow target. + */ + public Setting followOffsetDistance = new Setting<>(0D); + + /** + * The actual GoalNear is set in this direction from the entity you're following + */ + public Setting followOffsetDirection = new Setting<>(0F); + + /** + * The radius (for the GoalNear) of how close to your target position you actually have to be + */ + public Setting followRadius = new Setting<>(3); + public final Map> byLowerName; public final List> allSettings; diff --git a/src/main/java/baritone/behavior/FollowBehavior.java b/src/main/java/baritone/behavior/FollowBehavior.java index 8eb51708..0dd9893d 100644 --- a/src/main/java/baritone/behavior/FollowBehavior.java +++ b/src/main/java/baritone/behavior/FollowBehavior.java @@ -17,9 +17,12 @@ package baritone.behavior; +import baritone.Baritone; import baritone.api.behavior.Behavior; import baritone.api.event.events.TickEvent; import baritone.pathing.goals.GoalNear; +import baritone.pathing.goals.GoalXZ; +import baritone.utils.Helper; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; @@ -28,7 +31,7 @@ import net.minecraft.util.math.BlockPos; * * @author leijurv */ -public final class FollowBehavior extends Behavior { +public final class FollowBehavior extends Behavior implements Helper { public static final FollowBehavior INSTANCE = new FollowBehavior(); @@ -45,7 +48,8 @@ public final class FollowBehavior extends Behavior { return; } // lol this is trashy but it works - PathingBehavior.INSTANCE.setGoal(new GoalNear(new BlockPos(following), 3)); + GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.get(), Baritone.settings().followOffsetDistance.get()); + PathingBehavior.INSTANCE.setGoal(new GoalNear(new BlockPos(g.getX(), following.posY, g.getZ()), Baritone.settings().followRadius.get())); PathingBehavior.INSTANCE.path(); } diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 98964315..016b44f5 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -400,6 +400,9 @@ public class ExampleBaritoneControl extends Behavior implements Helper { if (setting.value.getClass() == Double.class) { setting.value = Double.parseDouble(data[1]); } + if (setting.value.getClass() == Float.class) { + setting.value = Float.parseFloat(data[1]); + } } catch (NumberFormatException e) { logDirect("Unable to parse " + data[1]); event.cancel(); From 043dd80e285fde5dd2c76b1defcef2fd9e2c72d2 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 17 Sep 2018 10:38:37 -0700 Subject: [PATCH 084/120] higher priority --- .../utils/ExampleBaritoneControl.java | 104 +++++++++--------- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 016b44f5..a3301cd2 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -69,6 +69,59 @@ public class ExampleBaritoneControl extends Behavior implements Helper { } msg = msg.substring(1); } + + List> toggleable = Baritone.settings().getAllValuesByType(Boolean.class); + for (Settings.Setting setting : toggleable) { + if (msg.equalsIgnoreCase(setting.getName())) { + setting.value ^= true; + event.cancel(); + logDirect("Toggled " + setting.getName() + " to " + setting.value); + return; + } + } + if (msg.equals("baritone") || msg.equals("settings")) { + for (Settings.Setting setting : Baritone.settings().allSettings) { + logDirect(setting.toString()); + } + event.cancel(); + return; + } + if (msg.contains(" ")) { + String[] data = msg.split(" "); + if (data.length == 2) { + Settings.Setting setting = Baritone.settings().byLowerName.get(data[0]); + if (setting != null) { + try { + if (setting.value.getClass() == Long.class) { + setting.value = Long.parseLong(data[1]); + } + if (setting.value.getClass() == Integer.class) { + setting.value = Integer.parseInt(data[1]); + } + if (setting.value.getClass() == Double.class) { + setting.value = Double.parseDouble(data[1]); + } + if (setting.value.getClass() == Float.class) { + setting.value = Float.parseFloat(data[1]); + } + } catch (NumberFormatException e) { + logDirect("Unable to parse " + data[1]); + event.cancel(); + return; + } + logDirect(setting.toString()); + event.cancel(); + return; + } + } + } + if (Baritone.settings().byLowerName.containsKey(msg)) { + Settings.Setting setting = Baritone.settings().byLowerName.get(msg); + logDirect(setting.toString()); + event.cancel(); + return; + } + if (msg.startsWith("goal")) { event.cancel(); String[] params = msg.substring(4).trim().split(" "); @@ -369,56 +422,5 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - List> toggleable = Baritone.settings().getAllValuesByType(Boolean.class); - for (Settings.Setting setting : toggleable) { - if (msg.equalsIgnoreCase(setting.getName())) { - setting.value ^= true; - event.cancel(); - logDirect("Toggled " + setting.getName() + " to " + setting.value); - return; - } - } - if (msg.equals("baritone") || msg.equals("settings")) { - for (Settings.Setting setting : Baritone.settings().allSettings) { - logDirect(setting.toString()); - } - event.cancel(); - return; - } - if (msg.contains(" ")) { - String[] data = msg.split(" "); - if (data.length == 2) { - Settings.Setting setting = Baritone.settings().byLowerName.get(data[0]); - if (setting != null) { - try { - if (setting.value.getClass() == Long.class) { - setting.value = Long.parseLong(data[1]); - } - if (setting.value.getClass() == Integer.class) { - setting.value = Integer.parseInt(data[1]); - } - if (setting.value.getClass() == Double.class) { - setting.value = Double.parseDouble(data[1]); - } - if (setting.value.getClass() == Float.class) { - setting.value = Float.parseFloat(data[1]); - } - } catch (NumberFormatException e) { - logDirect("Unable to parse " + data[1]); - event.cancel(); - return; - } - logDirect(setting.toString()); - event.cancel(); - return; - } - } - } - if (Baritone.settings().byLowerName.containsKey(msg)) { - Settings.Setting setting = Baritone.settings().byLowerName.get(msg); - logDirect(setting.toString()); - event.cancel(); - return; - } } } From e981bfa34668cba88a7a9c25070f04b698ff40ce Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 17 Sep 2018 10:56:37 -0700 Subject: [PATCH 085/120] follow player by name --- .../baritone/behavior/FollowBehavior.java | 1 + .../java/baritone/behavior/MineBehavior.java | 25 ++++-------------- .../baritone/behavior/PathingBehavior.java | 16 ++++++++++++ .../utils/ExampleBaritoneControl.java | 26 ++++++++++++++----- 4 files changed, 42 insertions(+), 26 deletions(-) diff --git a/src/main/java/baritone/behavior/FollowBehavior.java b/src/main/java/baritone/behavior/FollowBehavior.java index 0dd9893d..2ef25c1a 100644 --- a/src/main/java/baritone/behavior/FollowBehavior.java +++ b/src/main/java/baritone/behavior/FollowBehavior.java @@ -50,6 +50,7 @@ public final class FollowBehavior extends Behavior implements Helper { // lol this is trashy but it works GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.get(), Baritone.settings().followOffsetDistance.get()); PathingBehavior.INSTANCE.setGoal(new GoalNear(new BlockPos(g.getX(), following.posY, g.getZ()), Baritone.settings().followRadius.get())); + PathingBehavior.INSTANCE.revalidateGoal(); PathingBehavior.INSTANCE.path(); } diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 33a8e96d..8b6fa2a1 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -29,7 +29,6 @@ import baritone.pathing.goals.Goal; import baritone.pathing.goals.GoalBlock; import baritone.pathing.goals.GoalComposite; import baritone.pathing.goals.GoalTwoBlocks; -import baritone.pathing.path.IPath; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; import net.minecraft.block.Block; @@ -37,7 +36,10 @@ import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.chunk.EmptyChunk; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; import java.util.stream.Collectors; /** @@ -65,24 +67,7 @@ public final class MineBehavior extends Behavior implements Helper { updateGoal(); } } - if (!Baritone.settings().cancelOnGoalInvalidation.get()) { - return; - } - Optional path = PathingBehavior.INSTANCE.getPath(); - if (!path.isPresent()) { - return; - } - Goal currentGoal = PathingBehavior.INSTANCE.getGoal(); - if (currentGoal == null) { - return; - } - Goal intended = path.get().getGoal(); - BlockPos end = path.get().getDest(); - if (intended.isInGoal(end) && !currentGoal.isInGoal(end)) { - // this path used to end in the goal - // but the goal has changed, so there's no reason to continue... - PathingBehavior.INSTANCE.cancel(); - } + PathingBehavior.INSTANCE.revalidateGoal(); } @Override diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 8d962bd6..3037c4e7 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -338,6 +338,22 @@ public final class PathingBehavior extends Behavior implements Helper { } } + public void revalidateGoal() { + if (!Baritone.settings().cancelOnGoalInvalidation.get()) { + return; + } + if (current == null || goal == null) { + return; + } + Goal intended = current.getPath().getGoal(); + BlockPos end = current.getPath().getDest(); + if (intended.isInGoal(end) && !goal.isInGoal(end)) { + // this path used to end in the goal + // but the goal has changed, so there's no reason to continue... + cancel(); + } + } + @Override public void onRenderPass(RenderEvent event) { // System.out.println("Render passing"); diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index a3301cd2..7bbd8c82 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -38,6 +38,7 @@ import baritone.utils.pathing.BetterBlockPos; import net.minecraft.block.Block; import net.minecraft.client.multiplayer.ChunkProviderClient; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.chunk.Chunk; @@ -236,15 +237,28 @@ public class ExampleBaritoneControl extends Behavior implements Helper { event.cancel(); return; } - if (msg.equals("follow")) { - Optional entity = MovementHelper.whatEntityAmILookingAt(); - if (!entity.isPresent()) { - logDirect("You aren't looking at an entity bruh"); + if (msg.startsWith("follow")) { + String name = msg.substring(6).trim(); + Optional toFollow = Optional.empty(); + if (name.length() == 0) { + toFollow = MovementHelper.whatEntityAmILookingAt(); + } else { + for (EntityPlayer pl : world().playerEntities) { + String theirName = pl.getName().trim().toLowerCase(); + if (!theirName.equals(player().getName().trim().toLowerCase())) { // don't follow ourselves lol + if (theirName.contains(name) || name.contains(theirName)) { + toFollow = Optional.of(pl); + } + } + } + } + if (!toFollow.isPresent()) { + logDirect("Not found"); event.cancel(); return; } - FollowBehavior.INSTANCE.follow(entity.get()); - logDirect("Following " + entity.get()); + FollowBehavior.INSTANCE.follow(toFollow.get()); + logDirect("Following " + toFollow.get()); event.cancel(); return; } From 42e179c4ce43eed4a138dd4a6d46693fe6940ac3 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 17 Sep 2018 13:44:27 -0700 Subject: [PATCH 086/120] loL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 30754ed6..577a6418 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Baritone [![Build Status](https://travis-ci.com/cabaletta/baritone.svg?branch=master)](https://travis-ci.com/cabaletta/baritone) -[![License](https://img.shields.io/github/license/ImpactDevelopment/ClientAPI.svg)](LICENSE) +[![License](https://img.shields.io/github/license/cabaletta/baritone.svg)](LICENSE) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/7150d8ccf6094057b1782aa7a8f92d7d)](https://www.codacy.com/app/leijurv/baritone?utm_source=github.com&utm_medium=referral&utm_content=cabaletta/baritone&utm_campaign=Badge_Grade) A Minecraft bot. This project is an updated version of [Minebot](https://github.com/leijurv/MineBot/), From 71952410eb072a8dea888b7391de832d472e8b52 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 17 Sep 2018 14:22:45 -0700 Subject: [PATCH 087/120] mine quantity --- .../java/baritone/behavior/MineBehavior.java | 25 ++++++++++++++----- .../utils/ExampleBaritoneControl.java | 11 +++++++- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 8b6fa2a1..115232b6 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -33,13 +33,12 @@ import baritone.utils.BlockStateInterface; import baritone.utils.Helper; import net.minecraft.block.Block; import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.chunk.EmptyChunk; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -53,6 +52,7 @@ public final class MineBehavior extends Behavior implements Helper { private List mining; private List locationsCache; + private int quantity; private MineBehavior() {} @@ -61,6 +61,16 @@ public final class MineBehavior extends Behavior implements Helper { if (mining == null) { return; } + if (quantity > 0) { + Item item = mining.get(0).getItemDropped(mining.get(0).getDefaultState(), new Random(), 0); + int curr = player().inventory.mainInventory.stream().filter(stack -> item.equals(stack.getItem())).mapToInt(ItemStack::getCount).sum(); + System.out.println("Currently have " + curr + " " + item); + if (curr >= quantity) { + logDirect("Have " + curr + " " + item.getItemStackDisplayName(new ItemStack(item, 1))); + cancel(); + return; + } + } int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.get(); if (mineGoalUpdateInterval != 0) { if (event.getCount() % mineGoalUpdateInterval == 0) { @@ -93,6 +103,8 @@ public final class MineBehavior extends Behavior implements Helper { locationsCache = locs; PathingBehavior.INSTANCE.setGoal(coalesce(locs)); PathingBehavior.INSTANCE.path(); + + Blocks.DIAMOND_ORE.getItemDropped(Blocks.DIAMOND_ORE.getDefaultState(), new Random(), 0); } public static GoalComposite coalesce(List locs) { @@ -157,8 +169,9 @@ public final class MineBehavior extends Behavior implements Helper { return locs; } - public void mine(String... blocks) { + public void mine(int quantity, String... blocks) { this.mining = blocks == null || blocks.length == 0 ? null : Arrays.stream(blocks).map(ChunkPacker::stringToBlock).collect(Collectors.toList()); + this.quantity = quantity; this.locationsCache = new ArrayList<>(); updateGoal(); } @@ -170,7 +183,7 @@ public final class MineBehavior extends Behavior implements Helper { } public void cancel() { - mine((String[]) null); + mine(0, (String[]) null); PathingBehavior.INSTANCE.cancel(); } } diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 7bbd8c82..47660631 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -289,14 +289,23 @@ public class ExampleBaritoneControl extends Behavior implements Helper { } if (msg.startsWith("mine")) { String[] blockTypes = msg.substring(4).trim().split(" "); + try { + int quantity = Integer.parseInt(blockTypes[1]); + ChunkPacker.stringToBlock(blockTypes[0]).hashCode(); + MineBehavior.INSTANCE.mine(quantity, blockTypes[0]); + logDirect("Will mine " + quantity + " " + blockTypes[0]); + event.cancel(); + return; + } catch (NumberFormatException | ArrayIndexOutOfBoundsException | NullPointerException ex) {} for (String s : blockTypes) { if (ChunkPacker.stringToBlock(s) == null) { logDirect(s + " isn't a valid block name"); event.cancel(); return; } + } - MineBehavior.INSTANCE.mine(blockTypes); + MineBehavior.INSTANCE.mine(0, blockTypes); logDirect("Started mining blocks of type " + Arrays.toString(blockTypes)); event.cancel(); return; From bfdf8d6c8759be25abc1517ef8bd8023f02dc892 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 17 Sep 2018 14:33:14 -0700 Subject: [PATCH 088/120] update readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 577a6418..edd68950 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,15 @@ [![License](https://img.shields.io/github/license/cabaletta/baritone.svg)](LICENSE) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/7150d8ccf6094057b1782aa7a8f92d7d)](https://www.codacy.com/app/leijurv/baritone?utm_source=github.com&utm_medium=referral&utm_content=cabaletta/baritone&utm_campaign=Badge_Grade) -A Minecraft bot. This project is an updated version of [Minebot](https://github.com/leijurv/MineBot/), +A Minecraft pathfinder bot. This project is an updated version of [Minebot](https://github.com/leijurv/MineBot/), the original version of the bot for Minecraft 1.8, rebuilt for 1.12.2. Features Baritone + Impact +Unofficial Jenkins: [![Build Status](http://24.202.239.85:8080/job/baritone/badge/icon)](http://24.202.239.85:8080/job/baritone/lastSuccessfulBuild/) + # Setup ## IntelliJ's Gradle UI From 6b61a00bedaac2704980f1971b4285d2ad2080cb Mon Sep 17 00:00:00 2001 From: Brady Date: Mon, 17 Sep 2018 17:11:40 -0500 Subject: [PATCH 089/120] Change License to GNU Lesser General Public License v3 --- .idea/copyright/Baritone.xml | 2 +- LICENSE | 165 +++++ LICENSE.txt | 674 ------------------ build.gradle | 6 +- settings.gradle | 6 +- .../java/baritone/api/behavior/Behavior.java | 6 +- .../api/event/events/BlockInteractEvent.java | 6 +- .../baritone/api/event/events/ChatEvent.java | 6 +- .../baritone/api/event/events/ChunkEvent.java | 6 +- .../api/event/events/PacketEvent.java | 6 +- .../baritone/api/event/events/PathEvent.java | 6 +- .../api/event/events/PlayerUpdateEvent.java | 6 +- .../api/event/events/RenderEvent.java | 6 +- .../api/event/events/RotationMoveEvent.java | 6 +- .../baritone/api/event/events/TickEvent.java | 6 +- .../baritone/api/event/events/WorldEvent.java | 6 +- .../api/event/events/type/Cancellable.java | 6 +- .../api/event/events/type/EventState.java | 6 +- .../listener/AbstractGameEventListener.java | 23 +- .../event/listener/IGameEventListener.java | 23 +- .../api/utils/interfaces/Toggleable.java | 6 +- .../java/baritone/launch/BaritoneTweaker.java | 6 +- .../baritone/launch/BaritoneTweakerForge.java | 6 +- .../launch/BaritoneTweakerOptifine.java | 6 +- .../launch/mixins/MixinAnvilChunkLoader.java | 23 +- .../baritone/launch/mixins/MixinBlockPos.java | 6 +- .../mixins/MixinChunkProviderServer.java | 23 +- .../baritone/launch/mixins/MixinEntity.java | 6 +- .../launch/mixins/MixinEntityLivingBase.java | 6 +- .../launch/mixins/MixinEntityPlayerSP.java | 6 +- .../launch/mixins/MixinEntityRenderer.java | 6 +- .../launch/mixins/MixinKeyBinding.java | 6 +- .../launch/mixins/MixinMinecraft.java | 6 +- .../mixins/MixinNetHandlerPlayClient.java | 6 +- .../launch/mixins/MixinNetworkManager.java | 6 +- .../launch/mixins/MixinWorldClient.java | 6 +- src/main/java/baritone/Baritone.java | 6 +- src/main/java/baritone/Settings.java | 6 +- .../baritone/behavior/FollowBehavior.java | 6 +- .../behavior/LocationTrackingBehavior.java | 6 +- .../java/baritone/behavior/LookBehavior.java | 6 +- .../baritone/behavior/LookBehaviorUtils.java | 6 +- .../baritone/behavior/MemoryBehavior.java | 6 +- .../java/baritone/behavior/MineBehavior.java | 6 +- .../baritone/behavior/PathingBehavior.java | 6 +- src/main/java/baritone/cache/CachedChunk.java | 6 +- .../java/baritone/cache/CachedRegion.java | 6 +- src/main/java/baritone/cache/CachedWorld.java | 6 +- src/main/java/baritone/cache/ChunkPacker.java | 6 +- src/main/java/baritone/cache/Waypoint.java | 6 +- src/main/java/baritone/cache/Waypoints.java | 6 +- src/main/java/baritone/cache/WorldData.java | 6 +- .../java/baritone/cache/WorldProvider.java | 6 +- .../java/baritone/cache/WorldScanner.java | 6 +- .../java/baritone/event/GameEventHandler.java | 6 +- .../pathing/calc/AStarPathFinder.java | 6 +- .../pathing/calc/AbstractNodeCostSearch.java | 6 +- .../baritone/pathing/calc/IPathFinder.java | 6 +- src/main/java/baritone/pathing/calc/Path.java | 6 +- .../java/baritone/pathing/calc/PathNode.java | 6 +- .../calc/openset/BinaryHeapOpenSet.java | 6 +- .../pathing/calc/openset/IOpenSet.java | 6 +- .../calc/openset/LinkedListOpenSet.java | 6 +- .../java/baritone/pathing/goals/Goal.java | 6 +- .../java/baritone/pathing/goals/GoalAxis.java | 6 +- .../baritone/pathing/goals/GoalBlock.java | 6 +- .../baritone/pathing/goals/GoalComposite.java | 6 +- .../pathing/goals/GoalGetToBlock.java | 6 +- .../java/baritone/pathing/goals/GoalNear.java | 6 +- .../baritone/pathing/goals/GoalRunAway.java | 6 +- .../baritone/pathing/goals/GoalTwoBlocks.java | 6 +- .../java/baritone/pathing/goals/GoalXZ.java | 6 +- .../baritone/pathing/goals/GoalYLevel.java | 6 +- .../pathing/movement/ActionCosts.java | 6 +- ...ButOnlyTheOnesThatMakeMickeyDieInside.java | 6 +- .../pathing/movement/CalculationContext.java | 6 +- .../baritone/pathing/movement/Movement.java | 6 +- .../pathing/movement/MovementHelper.java | 6 +- .../pathing/movement/MovementState.java | 6 +- .../movement/movements/MovementAscend.java | 6 +- .../movement/movements/MovementDescend.java | 6 +- .../movement/movements/MovementDiagonal.java | 6 +- .../movement/movements/MovementDownward.java | 6 +- .../movement/movements/MovementFall.java | 6 +- .../movement/movements/MovementParkour.java | 6 +- .../movement/movements/MovementPillar.java | 6 +- .../movement/movements/MovementTraverse.java | 6 +- .../baritone/pathing/path/CutoffPath.java | 6 +- .../java/baritone/pathing/path/IPath.java | 6 +- .../baritone/pathing/path/PathExecutor.java | 6 +- .../java/baritone/utils/BlockBreakHelper.java | 6 +- .../baritone/utils/BlockStateInterface.java | 6 +- .../utils/ExampleBaritoneControl.java | 6 +- src/main/java/baritone/utils/Helper.java | 6 +- .../baritone/utils/InputOverrideHandler.java | 23 +- .../java/baritone/utils/PathRenderer.java | 6 +- .../java/baritone/utils/RayTraceUtils.java | 6 +- src/main/java/baritone/utils/Rotation.java | 6 +- src/main/java/baritone/utils/ToolSet.java | 6 +- src/main/java/baritone/utils/Utils.java | 6 +- .../utils/accessor/IAnvilChunkLoader.java | 6 +- .../utils/accessor/IChunkProviderServer.java | 6 +- .../utils/interfaces/IGoalRenderPos.java | 6 +- .../utils/pathing/BetterBlockPos.java | 6 +- .../utils/pathing/IBlockTypeAccess.java | 6 +- .../utils/pathing/PathingBlockType.java | 6 +- .../java/baritone/cache/CachedRegionTest.java | 6 +- .../pathing/calc/openset/OpenSetsTest.java | 6 +- .../pathing/goals/GoalGetToBlockTest.java | 6 +- ...nlyTheOnesThatMakeMickeyDieInsideTest.java | 6 +- .../utils/pathing/BetterBlockPosTest.java | 6 +- 111 files changed, 490 insertions(+), 1084 deletions(-) create mode 100644 LICENSE delete mode 100644 LICENSE.txt diff --git a/.idea/copyright/Baritone.xml b/.idea/copyright/Baritone.xml index aaaf59bb..77f2d5b1 100644 --- a/.idea/copyright/Baritone.xml +++ b/.idea/copyright/Baritone.xml @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..153d416d --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index da125cc9..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Baritone Copyright (C) 2018 Cabaletta - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/build.gradle b/build.gradle index 1ab9fe8d..1b31aae8 100755 --- a/build.gradle +++ b/build.gradle @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/settings.gradle b/settings.gradle index c627d750..baa9dfc9 100755 --- a/settings.gradle +++ b/settings.gradle @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/behavior/Behavior.java b/src/api/java/baritone/api/behavior/Behavior.java index 68ca580f..872ce1bd 100644 --- a/src/api/java/baritone/api/behavior/Behavior.java +++ b/src/api/java/baritone/api/behavior/Behavior.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/BlockInteractEvent.java b/src/api/java/baritone/api/event/events/BlockInteractEvent.java index 2c57952c..cc98a6ba 100644 --- a/src/api/java/baritone/api/event/events/BlockInteractEvent.java +++ b/src/api/java/baritone/api/event/events/BlockInteractEvent.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/ChatEvent.java b/src/api/java/baritone/api/event/events/ChatEvent.java index 87a81e70..e103377f 100644 --- a/src/api/java/baritone/api/event/events/ChatEvent.java +++ b/src/api/java/baritone/api/event/events/ChatEvent.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/ChunkEvent.java b/src/api/java/baritone/api/event/events/ChunkEvent.java index 1f8c6c39..5c22d830 100644 --- a/src/api/java/baritone/api/event/events/ChunkEvent.java +++ b/src/api/java/baritone/api/event/events/ChunkEvent.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/PacketEvent.java b/src/api/java/baritone/api/event/events/PacketEvent.java index 77310994..9516db4b 100644 --- a/src/api/java/baritone/api/event/events/PacketEvent.java +++ b/src/api/java/baritone/api/event/events/PacketEvent.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/PathEvent.java b/src/api/java/baritone/api/event/events/PathEvent.java index c134ba96..0eef0665 100644 --- a/src/api/java/baritone/api/event/events/PathEvent.java +++ b/src/api/java/baritone/api/event/events/PathEvent.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/PlayerUpdateEvent.java b/src/api/java/baritone/api/event/events/PlayerUpdateEvent.java index 59bdf702..6ac08bdd 100644 --- a/src/api/java/baritone/api/event/events/PlayerUpdateEvent.java +++ b/src/api/java/baritone/api/event/events/PlayerUpdateEvent.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/RenderEvent.java b/src/api/java/baritone/api/event/events/RenderEvent.java index ef693e2a..b5a77276 100644 --- a/src/api/java/baritone/api/event/events/RenderEvent.java +++ b/src/api/java/baritone/api/event/events/RenderEvent.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/RotationMoveEvent.java b/src/api/java/baritone/api/event/events/RotationMoveEvent.java index 7bedf857..ef6d9b7e 100644 --- a/src/api/java/baritone/api/event/events/RotationMoveEvent.java +++ b/src/api/java/baritone/api/event/events/RotationMoveEvent.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/TickEvent.java b/src/api/java/baritone/api/event/events/TickEvent.java index c765daa9..da8f8878 100644 --- a/src/api/java/baritone/api/event/events/TickEvent.java +++ b/src/api/java/baritone/api/event/events/TickEvent.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/WorldEvent.java b/src/api/java/baritone/api/event/events/WorldEvent.java index 454755fe..c7c7e102 100644 --- a/src/api/java/baritone/api/event/events/WorldEvent.java +++ b/src/api/java/baritone/api/event/events/WorldEvent.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/type/Cancellable.java b/src/api/java/baritone/api/event/events/type/Cancellable.java index 4c26f8f8..331870c6 100644 --- a/src/api/java/baritone/api/event/events/type/Cancellable.java +++ b/src/api/java/baritone/api/event/events/type/Cancellable.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/events/type/EventState.java b/src/api/java/baritone/api/event/events/type/EventState.java index bba516a6..10b633bd 100644 --- a/src/api/java/baritone/api/event/events/type/EventState.java +++ b/src/api/java/baritone/api/event/events/type/EventState.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/listener/AbstractGameEventListener.java b/src/api/java/baritone/api/event/listener/AbstractGameEventListener.java index 5839e6d5..6af8e402 100644 --- a/src/api/java/baritone/api/event/listener/AbstractGameEventListener.java +++ b/src/api/java/baritone/api/event/listener/AbstractGameEventListener.java @@ -2,33 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with Baritone. If not, see . - */ - -/* - * This file is part of Baritone. - * - * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Baritone is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/event/listener/IGameEventListener.java b/src/api/java/baritone/api/event/listener/IGameEventListener.java index 9587376a..b1dda0de 100644 --- a/src/api/java/baritone/api/event/listener/IGameEventListener.java +++ b/src/api/java/baritone/api/event/listener/IGameEventListener.java @@ -2,33 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with Baritone. If not, see . - */ - -/* - * This file is part of Baritone. - * - * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Baritone is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/api/java/baritone/api/utils/interfaces/Toggleable.java b/src/api/java/baritone/api/utils/interfaces/Toggleable.java index bf43220a..359d6ee1 100644 --- a/src/api/java/baritone/api/utils/interfaces/Toggleable.java +++ b/src/api/java/baritone/api/utils/interfaces/Toggleable.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/BaritoneTweaker.java b/src/launch/java/baritone/launch/BaritoneTweaker.java index 9638214c..536ecf95 100644 --- a/src/launch/java/baritone/launch/BaritoneTweaker.java +++ b/src/launch/java/baritone/launch/BaritoneTweaker.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/BaritoneTweakerForge.java b/src/launch/java/baritone/launch/BaritoneTweakerForge.java index c1699058..7623eed5 100644 --- a/src/launch/java/baritone/launch/BaritoneTweakerForge.java +++ b/src/launch/java/baritone/launch/BaritoneTweakerForge.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/BaritoneTweakerOptifine.java b/src/launch/java/baritone/launch/BaritoneTweakerOptifine.java index 8d0872aa..9f4f8380 100644 --- a/src/launch/java/baritone/launch/BaritoneTweakerOptifine.java +++ b/src/launch/java/baritone/launch/BaritoneTweakerOptifine.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinAnvilChunkLoader.java b/src/launch/java/baritone/launch/mixins/MixinAnvilChunkLoader.java index 3133c9cd..4ffb5abc 100644 --- a/src/launch/java/baritone/launch/mixins/MixinAnvilChunkLoader.java +++ b/src/launch/java/baritone/launch/mixins/MixinAnvilChunkLoader.java @@ -2,33 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with Baritone. If not, see . - */ - -/* - * This file is part of Baritone. - * - * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Baritone is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinBlockPos.java b/src/launch/java/baritone/launch/mixins/MixinBlockPos.java index 49e01c96..013980a9 100644 --- a/src/launch/java/baritone/launch/mixins/MixinBlockPos.java +++ b/src/launch/java/baritone/launch/mixins/MixinBlockPos.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinChunkProviderServer.java b/src/launch/java/baritone/launch/mixins/MixinChunkProviderServer.java index 41f90481..246c368e 100644 --- a/src/launch/java/baritone/launch/mixins/MixinChunkProviderServer.java +++ b/src/launch/java/baritone/launch/mixins/MixinChunkProviderServer.java @@ -2,33 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with Baritone. If not, see . - */ - -/* - * This file is part of Baritone. - * - * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Baritone is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinEntity.java b/src/launch/java/baritone/launch/mixins/MixinEntity.java index 22be4154..b96b5b41 100644 --- a/src/launch/java/baritone/launch/mixins/MixinEntity.java +++ b/src/launch/java/baritone/launch/mixins/MixinEntity.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinEntityLivingBase.java b/src/launch/java/baritone/launch/mixins/MixinEntityLivingBase.java index 61f6db7a..e840576e 100644 --- a/src/launch/java/baritone/launch/mixins/MixinEntityLivingBase.java +++ b/src/launch/java/baritone/launch/mixins/MixinEntityLivingBase.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinEntityPlayerSP.java b/src/launch/java/baritone/launch/mixins/MixinEntityPlayerSP.java index 9a45659e..e9a575c5 100644 --- a/src/launch/java/baritone/launch/mixins/MixinEntityPlayerSP.java +++ b/src/launch/java/baritone/launch/mixins/MixinEntityPlayerSP.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinEntityRenderer.java b/src/launch/java/baritone/launch/mixins/MixinEntityRenderer.java index 55adfc83..0fc1b246 100644 --- a/src/launch/java/baritone/launch/mixins/MixinEntityRenderer.java +++ b/src/launch/java/baritone/launch/mixins/MixinEntityRenderer.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinKeyBinding.java b/src/launch/java/baritone/launch/mixins/MixinKeyBinding.java index 4285c14d..c776d228 100644 --- a/src/launch/java/baritone/launch/mixins/MixinKeyBinding.java +++ b/src/launch/java/baritone/launch/mixins/MixinKeyBinding.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java index 2bcc54b9..d5d41f44 100644 --- a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java +++ b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java b/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java index bd4cbb97..498b5aff 100644 --- a/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java +++ b/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java b/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java index d1e6a2d5..f79e007f 100644 --- a/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java +++ b/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/launch/java/baritone/launch/mixins/MixinWorldClient.java b/src/launch/java/baritone/launch/mixins/MixinWorldClient.java index 005dbe16..322239b7 100644 --- a/src/launch/java/baritone/launch/mixins/MixinWorldClient.java +++ b/src/launch/java/baritone/launch/mixins/MixinWorldClient.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index 0d89b730..06bf365a 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index a3fb2b4f..286c06e7 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/behavior/FollowBehavior.java b/src/main/java/baritone/behavior/FollowBehavior.java index 2ef25c1a..a9a829c3 100644 --- a/src/main/java/baritone/behavior/FollowBehavior.java +++ b/src/main/java/baritone/behavior/FollowBehavior.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/behavior/LocationTrackingBehavior.java b/src/main/java/baritone/behavior/LocationTrackingBehavior.java index cf41543c..e48e482e 100644 --- a/src/main/java/baritone/behavior/LocationTrackingBehavior.java +++ b/src/main/java/baritone/behavior/LocationTrackingBehavior.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java index c577588f..d45ad585 100644 --- a/src/main/java/baritone/behavior/LookBehavior.java +++ b/src/main/java/baritone/behavior/LookBehavior.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/behavior/LookBehaviorUtils.java b/src/main/java/baritone/behavior/LookBehaviorUtils.java index bbab90bf..ed7f730e 100644 --- a/src/main/java/baritone/behavior/LookBehaviorUtils.java +++ b/src/main/java/baritone/behavior/LookBehaviorUtils.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/behavior/MemoryBehavior.java b/src/main/java/baritone/behavior/MemoryBehavior.java index 716dfaee..c850c8e5 100644 --- a/src/main/java/baritone/behavior/MemoryBehavior.java +++ b/src/main/java/baritone/behavior/MemoryBehavior.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 115232b6..71674363 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 3037c4e7..98653b24 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/cache/CachedChunk.java b/src/main/java/baritone/cache/CachedChunk.java index 6705ffa5..fbdd42f7 100644 --- a/src/main/java/baritone/cache/CachedChunk.java +++ b/src/main/java/baritone/cache/CachedChunk.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/cache/CachedRegion.java b/src/main/java/baritone/cache/CachedRegion.java index 1805f5ea..f036f264 100644 --- a/src/main/java/baritone/cache/CachedRegion.java +++ b/src/main/java/baritone/cache/CachedRegion.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/cache/CachedWorld.java b/src/main/java/baritone/cache/CachedWorld.java index f866989a..91a70d48 100644 --- a/src/main/java/baritone/cache/CachedWorld.java +++ b/src/main/java/baritone/cache/CachedWorld.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java index 2ed6d596..1df1e9c0 100644 --- a/src/main/java/baritone/cache/ChunkPacker.java +++ b/src/main/java/baritone/cache/ChunkPacker.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/cache/Waypoint.java b/src/main/java/baritone/cache/Waypoint.java index a8f162a5..4fd6c57a 100644 --- a/src/main/java/baritone/cache/Waypoint.java +++ b/src/main/java/baritone/cache/Waypoint.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/cache/Waypoints.java b/src/main/java/baritone/cache/Waypoints.java index 82cf893f..be76e34e 100644 --- a/src/main/java/baritone/cache/Waypoints.java +++ b/src/main/java/baritone/cache/Waypoints.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/cache/WorldData.java b/src/main/java/baritone/cache/WorldData.java index 6637d7b1..7866e9e8 100644 --- a/src/main/java/baritone/cache/WorldData.java +++ b/src/main/java/baritone/cache/WorldData.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/cache/WorldProvider.java b/src/main/java/baritone/cache/WorldProvider.java index 0275301d..2cd0b6dc 100644 --- a/src/main/java/baritone/cache/WorldProvider.java +++ b/src/main/java/baritone/cache/WorldProvider.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index 76118093..bd2690a6 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/event/GameEventHandler.java b/src/main/java/baritone/event/GameEventHandler.java index 7f29968d..934dd532 100644 --- a/src/main/java/baritone/event/GameEventHandler.java +++ b/src/main/java/baritone/event/GameEventHandler.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index 4c47639e..f8b6eeb6 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index 6e8220e1..4a8fe752 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/calc/IPathFinder.java b/src/main/java/baritone/pathing/calc/IPathFinder.java index dceee65d..3723865d 100644 --- a/src/main/java/baritone/pathing/calc/IPathFinder.java +++ b/src/main/java/baritone/pathing/calc/IPathFinder.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/calc/Path.java b/src/main/java/baritone/pathing/calc/Path.java index 1910927c..e94f2fb3 100644 --- a/src/main/java/baritone/pathing/calc/Path.java +++ b/src/main/java/baritone/pathing/calc/Path.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/calc/PathNode.java b/src/main/java/baritone/pathing/calc/PathNode.java index 3d984548..8f9895d8 100644 --- a/src/main/java/baritone/pathing/calc/PathNode.java +++ b/src/main/java/baritone/pathing/calc/PathNode.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/calc/openset/BinaryHeapOpenSet.java b/src/main/java/baritone/pathing/calc/openset/BinaryHeapOpenSet.java index 47d370c6..6758a30a 100644 --- a/src/main/java/baritone/pathing/calc/openset/BinaryHeapOpenSet.java +++ b/src/main/java/baritone/pathing/calc/openset/BinaryHeapOpenSet.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/calc/openset/IOpenSet.java b/src/main/java/baritone/pathing/calc/openset/IOpenSet.java index e43664c8..4d362139 100644 --- a/src/main/java/baritone/pathing/calc/openset/IOpenSet.java +++ b/src/main/java/baritone/pathing/calc/openset/IOpenSet.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/calc/openset/LinkedListOpenSet.java b/src/main/java/baritone/pathing/calc/openset/LinkedListOpenSet.java index e06a9850..6de8290d 100644 --- a/src/main/java/baritone/pathing/calc/openset/LinkedListOpenSet.java +++ b/src/main/java/baritone/pathing/calc/openset/LinkedListOpenSet.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/goals/Goal.java b/src/main/java/baritone/pathing/goals/Goal.java index 4057a733..7f44d3d5 100644 --- a/src/main/java/baritone/pathing/goals/Goal.java +++ b/src/main/java/baritone/pathing/goals/Goal.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/goals/GoalAxis.java b/src/main/java/baritone/pathing/goals/GoalAxis.java index 9e6dc697..bd8f7c69 100644 --- a/src/main/java/baritone/pathing/goals/GoalAxis.java +++ b/src/main/java/baritone/pathing/goals/GoalAxis.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/goals/GoalBlock.java b/src/main/java/baritone/pathing/goals/GoalBlock.java index b85f468a..82515758 100644 --- a/src/main/java/baritone/pathing/goals/GoalBlock.java +++ b/src/main/java/baritone/pathing/goals/GoalBlock.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/goals/GoalComposite.java b/src/main/java/baritone/pathing/goals/GoalComposite.java index bd1e0905..12de4d93 100644 --- a/src/main/java/baritone/pathing/goals/GoalComposite.java +++ b/src/main/java/baritone/pathing/goals/GoalComposite.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/goals/GoalGetToBlock.java b/src/main/java/baritone/pathing/goals/GoalGetToBlock.java index cefed91a..5acca96c 100644 --- a/src/main/java/baritone/pathing/goals/GoalGetToBlock.java +++ b/src/main/java/baritone/pathing/goals/GoalGetToBlock.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/goals/GoalNear.java b/src/main/java/baritone/pathing/goals/GoalNear.java index 1b214c10..11c6cd3f 100644 --- a/src/main/java/baritone/pathing/goals/GoalNear.java +++ b/src/main/java/baritone/pathing/goals/GoalNear.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/goals/GoalRunAway.java b/src/main/java/baritone/pathing/goals/GoalRunAway.java index 15cd2489..0ad49faf 100644 --- a/src/main/java/baritone/pathing/goals/GoalRunAway.java +++ b/src/main/java/baritone/pathing/goals/GoalRunAway.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java b/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java index edc70483..44a33425 100644 --- a/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java +++ b/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/goals/GoalXZ.java b/src/main/java/baritone/pathing/goals/GoalXZ.java index 7b876665..3362149c 100644 --- a/src/main/java/baritone/pathing/goals/GoalXZ.java +++ b/src/main/java/baritone/pathing/goals/GoalXZ.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/goals/GoalYLevel.java b/src/main/java/baritone/pathing/goals/GoalYLevel.java index 97d63311..f90161d2 100644 --- a/src/main/java/baritone/pathing/goals/GoalYLevel.java +++ b/src/main/java/baritone/pathing/goals/GoalYLevel.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/ActionCosts.java b/src/main/java/baritone/pathing/movement/ActionCosts.java index 3be99c9f..cbfcd810 100644 --- a/src/main/java/baritone/pathing/movement/ActionCosts.java +++ b/src/main/java/baritone/pathing/movement/ActionCosts.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java b/src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java index e955c41e..fe589d6f 100644 --- a/src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java +++ b/src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java index bd05ec5e..3149cfe9 100644 --- a/src/main/java/baritone/pathing/movement/CalculationContext.java +++ b/src/main/java/baritone/pathing/movement/CalculationContext.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 7b1bce61..3e0a2f62 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 1d7ca673..27b1b57e 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/MovementState.java b/src/main/java/baritone/pathing/movement/MovementState.java index 057d22bb..0017c438 100644 --- a/src/main/java/baritone/pathing/movement/MovementState.java +++ b/src/main/java/baritone/pathing/movement/MovementState.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java index b802b53a..6f666a71 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDescend.java b/src/main/java/baritone/pathing/movement/movements/MovementDescend.java index 99e6872b..27a3c96d 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDescend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDescend.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java index 121ea7c7..58ba2ae2 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDownward.java b/src/main/java/baritone/pathing/movement/movements/MovementDownward.java index 2ceb3c16..aa5df237 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDownward.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDownward.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementFall.java b/src/main/java/baritone/pathing/movement/movements/MovementFall.java index a82826eb..5e2556fe 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementFall.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementFall.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index ab7a32cc..d113fa0f 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java index 1885f48b..99b3aa50 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index b0efeb79..05f73e58 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/path/CutoffPath.java b/src/main/java/baritone/pathing/path/CutoffPath.java index d55d8652..295f3830 100644 --- a/src/main/java/baritone/pathing/path/CutoffPath.java +++ b/src/main/java/baritone/pathing/path/CutoffPath.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/path/IPath.java b/src/main/java/baritone/pathing/path/IPath.java index f007f899..59cb8cac 100644 --- a/src/main/java/baritone/pathing/path/IPath.java +++ b/src/main/java/baritone/pathing/path/IPath.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 02435502..815d6d1b 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/BlockBreakHelper.java b/src/main/java/baritone/utils/BlockBreakHelper.java index ef12fff2..3ccc56f9 100644 --- a/src/main/java/baritone/utils/BlockBreakHelper.java +++ b/src/main/java/baritone/utils/BlockBreakHelper.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/BlockStateInterface.java b/src/main/java/baritone/utils/BlockStateInterface.java index 6db9a66e..6e0c7297 100644 --- a/src/main/java/baritone/utils/BlockStateInterface.java +++ b/src/main/java/baritone/utils/BlockStateInterface.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 47660631..b6ef2a45 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/Helper.java b/src/main/java/baritone/utils/Helper.java index 0b729014..d808e632 100755 --- a/src/main/java/baritone/utils/Helper.java +++ b/src/main/java/baritone/utils/Helper.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/InputOverrideHandler.java b/src/main/java/baritone/utils/InputOverrideHandler.java index eba6b9c0..9cf7d1da 100755 --- a/src/main/java/baritone/utils/InputOverrideHandler.java +++ b/src/main/java/baritone/utils/InputOverrideHandler.java @@ -2,33 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with Baritone. If not, see . - */ - -/* - * This file is part of Baritone. - * - * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Baritone is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index a05e89bf..86f49e5e 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/RayTraceUtils.java b/src/main/java/baritone/utils/RayTraceUtils.java index 02ae52df..d859ae4c 100644 --- a/src/main/java/baritone/utils/RayTraceUtils.java +++ b/src/main/java/baritone/utils/RayTraceUtils.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/Rotation.java b/src/main/java/baritone/utils/Rotation.java index 762d9cab..ce92d009 100644 --- a/src/main/java/baritone/utils/Rotation.java +++ b/src/main/java/baritone/utils/Rotation.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 1415d9e2..62115f24 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/Utils.java b/src/main/java/baritone/utils/Utils.java index 4aedce6a..8a63347a 100755 --- a/src/main/java/baritone/utils/Utils.java +++ b/src/main/java/baritone/utils/Utils.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/accessor/IAnvilChunkLoader.java b/src/main/java/baritone/utils/accessor/IAnvilChunkLoader.java index 900e3fb4..c243ae0e 100644 --- a/src/main/java/baritone/utils/accessor/IAnvilChunkLoader.java +++ b/src/main/java/baritone/utils/accessor/IAnvilChunkLoader.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/accessor/IChunkProviderServer.java b/src/main/java/baritone/utils/accessor/IChunkProviderServer.java index bb3dcb5e..78a471b2 100644 --- a/src/main/java/baritone/utils/accessor/IChunkProviderServer.java +++ b/src/main/java/baritone/utils/accessor/IChunkProviderServer.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java b/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java index 0aed1ea4..aa4ffa78 100644 --- a/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java +++ b/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/pathing/BetterBlockPos.java b/src/main/java/baritone/utils/pathing/BetterBlockPos.java index f908dd78..e46b27dc 100644 --- a/src/main/java/baritone/utils/pathing/BetterBlockPos.java +++ b/src/main/java/baritone/utils/pathing/BetterBlockPos.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/pathing/IBlockTypeAccess.java b/src/main/java/baritone/utils/pathing/IBlockTypeAccess.java index 2bd29cfd..4e34596a 100644 --- a/src/main/java/baritone/utils/pathing/IBlockTypeAccess.java +++ b/src/main/java/baritone/utils/pathing/IBlockTypeAccess.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/main/java/baritone/utils/pathing/PathingBlockType.java b/src/main/java/baritone/utils/pathing/PathingBlockType.java index 61dbf2fc..80c92dcb 100644 --- a/src/main/java/baritone/utils/pathing/PathingBlockType.java +++ b/src/main/java/baritone/utils/pathing/PathingBlockType.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/test/java/baritone/cache/CachedRegionTest.java b/src/test/java/baritone/cache/CachedRegionTest.java index dc595e2e..19874990 100644 --- a/src/test/java/baritone/cache/CachedRegionTest.java +++ b/src/test/java/baritone/cache/CachedRegionTest.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/test/java/baritone/pathing/calc/openset/OpenSetsTest.java b/src/test/java/baritone/pathing/calc/openset/OpenSetsTest.java index 5ab10d24..aebff976 100644 --- a/src/test/java/baritone/pathing/calc/openset/OpenSetsTest.java +++ b/src/test/java/baritone/pathing/calc/openset/OpenSetsTest.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/test/java/baritone/pathing/goals/GoalGetToBlockTest.java b/src/test/java/baritone/pathing/goals/GoalGetToBlockTest.java index a908a8dd..2fa7f954 100644 --- a/src/test/java/baritone/pathing/goals/GoalGetToBlockTest.java +++ b/src/test/java/baritone/pathing/goals/GoalGetToBlockTest.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/test/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInsideTest.java b/src/test/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInsideTest.java index 50ba6245..15291bbe 100644 --- a/src/test/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInsideTest.java +++ b/src/test/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInsideTest.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ diff --git a/src/test/java/baritone/utils/pathing/BetterBlockPosTest.java b/src/test/java/baritone/utils/pathing/BetterBlockPosTest.java index ff54579b..2f0ab688 100644 --- a/src/test/java/baritone/utils/pathing/BetterBlockPosTest.java +++ b/src/test/java/baritone/utils/pathing/BetterBlockPosTest.java @@ -2,16 +2,16 @@ * This file is part of Baritone. * * Baritone is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Baritone is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with Baritone. If not, see . */ From 63a1083e1970db5c5c75c26940ad154dea14e424 Mon Sep 17 00:00:00 2001 From: Brady Date: Mon, 17 Sep 2018 17:46:23 -0500 Subject: [PATCH 090/120] Let's talk about doors --- .../java/baritone/pathing/movement/MovementHelper.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 27b1b57e..1a442fa6 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -81,10 +81,10 @@ public interface MovementHelper extends ActionCosts, Helper { return false; } if (block instanceof BlockDoor || block instanceof BlockFenceGate) { - if (block == Blocks.IRON_DOOR) { - return false; - } - return true; // we can just open the door + // Because there's no nice method in vanilla to check if a door is openable or not, we just have to assume + // that anything that isn't an iron door isn't openable, ignoring that some doors introduced in mods can't + // be opened by just interacting. + return block != Blocks.IRON_DOOR; } if (block instanceof BlockSnow || block instanceof BlockTrapDoor) { // we've already checked doors From 66e6216b71a372deba7a397e69a022500aadeb7e Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 17 Sep 2018 16:11:54 -0700 Subject: [PATCH 091/120] l --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index edd68950..18031bdd 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ PathingBehavior.INSTANCE.path(); ## Can I use Baritone as a library in my hacked client? -Sure! (As long as usage is in compliance with the GPL 3 License) +Sure! (As long as usage is in compliance with the LGPL 3 License) ## How is it so fast? From dc5514b5b7bc23c0539bdd21393bb8db046aa79e Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 17 Sep 2018 16:15:21 -0700 Subject: [PATCH 092/120] update prebuilt jar --- IMPACT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPACT.md b/IMPACT.md index 369dc664..cec0ed1a 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -2,7 +2,7 @@ Baritone will be in Impact 4.4 with nice integrations with its utility modules, but if you're impatient you can run Baritone on top of Impact 4.3 right now. -You can either build Baritone yourself, or download the "official" jar (as of commit 7d0914b, built on September 13) from here. If you really want the cutting edge latest release, and you trust @Plutie#9079, commits are automatically built on their Jenkins here. +You can either build Baritone yourself, or download the "official" jar (as of commit 66e6216, built on September 17) from here. If you really want the cutting edge latest release, and you trust @Plutie#9079, commits are automatically built on their Jenkins here. To build it yourself, clone and setup Baritone (instructions in main README.md). Then, build the jar. From the command line, it's `./gradlew build` (or `gradlew build` on Windows). In IntelliJ, you can just start the `build` task in the Gradle menu. From f13bcbd49f16e0f29d93f89a2267e1bc2280c93c Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 17 Sep 2018 20:25:52 -0700 Subject: [PATCH 093/120] no more flowing water --- src/main/java/baritone/pathing/movement/MovementHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 1a442fa6..0ac4d7d8 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -432,7 +432,7 @@ public interface MovementHelper extends ActionCosts, Helper { break; } IBlockState ontoBlock = BlockStateInterface.get(onto); - if (BlockStateInterface.isWater(ontoBlock.getBlock())) { + if (ontoBlock.getBlock() == Blocks.WATER) { return new MovementFall(pos, onto); } if (canWalkThrough(onto, ontoBlock)) { From b47b8134629da054287c8eb99927ac53a8aa7070 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 18 Sep 2018 12:23:03 -0700 Subject: [PATCH 094/120] deal with fence gate properly, fixes #172 --- .../pathing/movement/movements/MovementPillar.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java index 99b3aa50..512ff937 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java @@ -67,20 +67,25 @@ public class MovementPillar extends Movement { return COST_INF; } } - double hardness = getTotalHardnessOfBlocksToBreak(context); + BlockPos toBreakPos = src.up(2); + IBlockState toBreak = BlockStateInterface.get(toBreakPos); + Block toBreakBlock = toBreak.getBlock(); + if (toBreakBlock instanceof BlockFenceGate) { + return COST_INF; + } + double hardness = MovementHelper.getMiningDurationTicks(context, toBreakPos, toBreak, true); if (hardness >= COST_INF) { return COST_INF; } if (hardness != 0) { - Block tmp = BlockStateInterface.get(src.up(2)).getBlock(); - if (tmp instanceof BlockLadder || tmp instanceof BlockVine) { + if (toBreakBlock instanceof BlockLadder || toBreakBlock instanceof BlockVine) { hardness = 0; // we won't actually need to break the ladder / vine because we're going to use it } else { BlockPos chkPos = src.up(3); IBlockState check = BlockStateInterface.get(chkPos); if (check.getBlock() instanceof BlockFalling) { // see MovementAscend's identical check for breaking a falling block above our head - if (!(tmp instanceof BlockFalling) || !(BlockStateInterface.get(src.up(1)).getBlock() instanceof BlockFalling)) { + if (!(toBreakBlock instanceof BlockFalling) || !(BlockStateInterface.get(src.up(1)).getBlock() instanceof BlockFalling)) { return COST_INF; } } From 28ebf065ee4d178d3f7ed80cbe64bb7c64f7db21 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 18 Sep 2018 13:14:22 -0700 Subject: [PATCH 095/120] 5x harder to break while sneaking --- .../pathing/movement/movements/MovementPillar.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java index 512ff937..ccb5c280 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java @@ -29,6 +29,7 @@ import baritone.utils.pathing.BetterBlockPos; import net.minecraft.block.*; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; public class MovementPillar extends Movement { @@ -102,7 +103,7 @@ public class MovementPillar extends Movement { return COST_INF; } if (ladder) { - return LADDER_UP_ONE_COST + hardness; + return LADDER_UP_ONE_COST + hardness * 5; } else { return JUMP_ONE_BLOCK_COST + context.placeBlockCost() + hardness; } @@ -205,4 +206,15 @@ public class MovementPillar extends Movement { return state; } + + @Override + protected boolean prepared(MovementState state) { + if (playerFeet().equals(src) || playerFeet().equals(src.down())) { + Block block = BlockStateInterface.getBlock(src.down()); + if (block == Blocks.LADDER || block == Blocks.VINE) { + state.setInput(InputOverrideHandler.Input.SNEAK, true); + } + } + return super.prepared(state); + } } \ No newline at end of file From ef55d869136310684275eae40e4bc8690fe5a894 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 18 Sep 2018 20:59:48 -0700 Subject: [PATCH 096/120] fix follow offset while at large x and z coordinates --- src/main/java/baritone/behavior/FollowBehavior.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/behavior/FollowBehavior.java b/src/main/java/baritone/behavior/FollowBehavior.java index a9a829c3..21ebbbea 100644 --- a/src/main/java/baritone/behavior/FollowBehavior.java +++ b/src/main/java/baritone/behavior/FollowBehavior.java @@ -48,8 +48,14 @@ public final class FollowBehavior extends Behavior implements Helper { return; } // lol this is trashy but it works - GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.get(), Baritone.settings().followOffsetDistance.get()); - PathingBehavior.INSTANCE.setGoal(new GoalNear(new BlockPos(g.getX(), following.posY, g.getZ()), Baritone.settings().followRadius.get())); + BlockPos pos; + if (Baritone.settings().followOffsetDistance.get() == 0) { + pos = following.getPosition(); + } else { + GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.get(), Baritone.settings().followOffsetDistance.get()); + pos = new BlockPos(g.getX(), following.posY, g.getZ()); + } + PathingBehavior.INSTANCE.setGoal(new GoalNear(pos, Baritone.settings().followRadius.get())); PathingBehavior.INSTANCE.revalidateGoal(); PathingBehavior.INSTANCE.path(); } From 2375f1a408be0effb4c271271b62e786d825cfb3 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 19 Sep 2018 14:39:57 -0700 Subject: [PATCH 097/120] better encapsulation of currentlyRunning --- src/main/java/baritone/pathing/calc/AStarPathFinder.java | 5 ----- .../java/baritone/pathing/calc/AbstractNodeCostSearch.java | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index f8b6eeb6..6c5865ca 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -72,7 +72,6 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { } CalculationContext calcContext = new CalculationContext(); HashSet favored = favoredPositions.orElse(null); - currentlyRunning = this; CachedWorld cachedWorld = Optional.ofNullable(WorldProvider.INSTANCE.getCurrentWorld()).map(w -> w.cache).orElse(null); ChunkProviderClient chunkProvider = Minecraft.getMinecraft().world.getChunkProvider(); BlockStateInterface.clearCachedChunk(); @@ -103,7 +102,6 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { BetterBlockPos currentNodePos = currentNode.pos; numNodes++; if (goal.isInGoal(currentNodePos)) { - currentlyRunning = null; logDebug("Took " + (System.nanoTime() / 1000000L - startTime) + "ms, " + numMovementsConsidered + " movements considered"); return Optional.of(new Path(startNode, currentNode, numNodes, goal)); } @@ -177,7 +175,6 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { } } if (cancelRequested) { - currentlyRunning = null; return Optional.empty(); } System.out.println(numMovementsConsidered + " movements considered"); @@ -200,13 +197,11 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { System.out.println("But I'm going to do it anyway, because yolo"); } System.out.println("Path goes for " + Math.sqrt(dist) + " blocks"); - currentlyRunning = null; return Optional.of(new Path(startNode, bestSoFar[i], numNodes, goal)); } } logDebug("Even with a cost coefficient of " + COEFFICIENTS[COEFFICIENTS.length - 1] + ", I couldn't get more than " + Math.sqrt(bestDist) + " blocks"); logDebug("No path found =("); - currentlyRunning = null; return Optional.empty(); } diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index 4a8fe752..20dce981 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -36,7 +36,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { /** * The currently running search task */ - protected static AbstractNodeCostSearch currentlyRunning = null; + private static AbstractNodeCostSearch currentlyRunning = null; protected final BetterBlockPos start; @@ -55,7 +55,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { private volatile boolean isFinished; - protected boolean cancelRequested; + protected volatile boolean cancelRequested; /** * This is really complicated and hard to explain. I wrote a comment in the old version of MineBot but it was so @@ -85,6 +85,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { } this.cancelRequested = false; try { + currentlyRunning = this; Optional path = calculate0(timeout); path.ifPresent(IPath::postprocess); isFinished = true; From 179053442140696433befa0bf254b766276eb287 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 19 Sep 2018 17:16:42 -0700 Subject: [PATCH 098/120] allow swimming up a water column, fixes #174, fixes #129 --- .../movement/movements/MovementPillar.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java index ccb5c280..f87ff302 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java @@ -31,6 +31,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; public class MovementPillar extends Movement { private int numTicks = 0; @@ -74,6 +75,13 @@ public class MovementPillar extends Movement { if (toBreakBlock instanceof BlockFenceGate) { return COST_INF; } + Block srcUp = null; + if (BlockStateInterface.isWater(toBreakBlock) && BlockStateInterface.isWater(fromDown)) { + srcUp = BlockStateInterface.get(dest).getBlock(); + if (BlockStateInterface.isWater(srcUp)) { + return LADDER_UP_ONE_COST; + } + } double hardness = MovementHelper.getMiningDurationTicks(context, toBreakPos, toBreak, true); if (hardness >= COST_INF) { return COST_INF; @@ -86,7 +94,10 @@ public class MovementPillar extends Movement { IBlockState check = BlockStateInterface.get(chkPos); if (check.getBlock() instanceof BlockFalling) { // see MovementAscend's identical check for breaking a falling block above our head - if (!(toBreakBlock instanceof BlockFalling) || !(BlockStateInterface.get(src.up(1)).getBlock() instanceof BlockFalling)) { + if (srcUp == null) { + srcUp = BlockStateInterface.get(dest).getBlock(); + } + if (!(toBreakBlock instanceof BlockFalling) || !(srcUp instanceof BlockFalling)) { return COST_INF; } } @@ -133,6 +144,18 @@ public class MovementPillar extends Movement { } IBlockState fromDown = BlockStateInterface.get(src); + if (BlockStateInterface.isWater(fromDown.getBlock()) && BlockStateInterface.isWater(dest)) { + // stay centered while swimming up a water column + state.setTarget(new MovementState.MovementTarget(Utils.calcRotationFromVec3d(playerHead(), Utils.getBlockPosCenter(dest)), false)); + Vec3d destCenter = Utils.getBlockPosCenter(dest); + if (Math.abs(player().posX - destCenter.x) > 0.2 || Math.abs(player().posZ - destCenter.z) > 0.2) { + state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, true); + } + if (playerFeet().equals(dest)) { + return state.setStatus(MovementState.MovementStatus.SUCCESS); + } + return state; + } boolean ladder = fromDown.getBlock() instanceof BlockLadder || fromDown.getBlock() instanceof BlockVine; boolean vine = fromDown.getBlock() instanceof BlockVine; if (!ladder) { @@ -215,6 +238,9 @@ public class MovementPillar extends Movement { state.setInput(InputOverrideHandler.Input.SNEAK, true); } } + if (BlockStateInterface.isWater(dest.up())) { + return true; + } return super.prepared(state); } } \ No newline at end of file From 2e63ac41d9b22e4ee0a62f2bd29974e43e2071a1 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 19 Sep 2018 19:34:05 -0700 Subject: [PATCH 099/120] possibly fix oscillation problem with a large goal composite --- src/main/java/baritone/pathing/calc/AStarPathFinder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index 6c5865ca..73ca28f6 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -68,7 +68,8 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { bestSoFar = new PathNode[COEFFICIENTS.length];//keep track of the best node by the metric of (estimatedCostToGoal + cost / COEFFICIENTS[i]) double[] bestHeuristicSoFar = new double[COEFFICIENTS.length]; for (int i = 0; i < bestHeuristicSoFar.length; i++) { - bestHeuristicSoFar[i] = Double.MAX_VALUE; + bestHeuristicSoFar[i] = startNode.estimatedCostToGoal; + bestSoFar[i] = startNode; } CalculationContext calcContext = new CalculationContext(); HashSet favored = favoredPositions.orElse(null); From 139d05d93fcd5c5fdbf993a3fbfb9ebeff8ec5ec Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 19 Sep 2018 20:12:27 -0700 Subject: [PATCH 100/120] disable mergeinterfacesaggressively for jit performance --- proguard.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/proguard.pro b/proguard.pro index 86ddc1a2..8880de6e 100644 --- a/proguard.pro +++ b/proguard.pro @@ -9,7 +9,6 @@ -verbose -allowaccessmodification # anything not kept can be changed from public to private and inlined etc --mergeinterfacesaggressively -overloadaggressively -dontusemixedcaseclassnames From caccc3001e1dc7e526b23b0701b1104b5332fb79 Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 19 Sep 2018 22:23:26 -0500 Subject: [PATCH 101/120] Better Impact Install Instructions --- IMPACT.md | 82 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 74 insertions(+), 8 deletions(-) diff --git a/IMPACT.md b/IMPACT.md index cec0ed1a..88daeb66 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -1,16 +1,82 @@ # Integration between Baritone and Impact -Baritone will be in Impact 4.4 with nice integrations with its utility modules, but if you're impatient you can run Baritone on top of Impact 4.3 right now. +## An Introduction +There are some basic steps to getting Baritone setup with Impact. +- Acquiring a build of Baritone +- Placing Baritone in the libraries directory +- Modifying the Impact Profile JSON to run baritone +- How to use Baritone -You can either build Baritone yourself, or download the "official" jar (as of commit 66e6216, built on September 17) from here. If you really want the cutting edge latest release, and you trust @Plutie#9079, commits are automatically built on their Jenkins here. +## Acquiring a build of Baritone +There are 3 methods of acquiring a build of Baritone (While it is still in development) -To build it yourself, clone and setup Baritone (instructions in main README.md). Then, build the jar. From the command line, it's `./gradlew build` (or `gradlew build` on Windows). In IntelliJ, you can just start the `build` task in the Gradle menu. +### Official Build (Not always up to date) +Download the "official" jar (as of commit 2e63ac4, +built on September 19) from here. -Copy the jar into place. If you built it yourself, it should be at `build/libs/baritone-1.0.0.jar` in baritone (otherwise, if you downloaded it, it's in your Downloads). Copy it to your libraries in your Minecraft install. For example, on Mac I do `cp Documents/baritone/build/libs/baritone-1.0.0.jar Library/Application\ Support/minecraft/libraries/cabaletta/baritone/1.0.0/baritone-1.0.0.jar`. The first time you'll need to make the directory `cabaletta/baritone/1.0.0` in libraries first. +### Building Baritone yourself +There are a few steps to this +- Clone this repository +- Setup the project as instructed in the README +- Run the ``build`` gradle task. You can either do this using IntelliJ's gradle UI or through a +command line + - Windows: ``gradlew build`` + - Mac/Linux: ``./gradlew build`` +- The build should be exported into ``/build/libs/baritone-1.0.0.jar`` -Then, we'll need to modify the Impact launch json. Open `minecraft/versions/1.12.2-Impact_4.3/1.12.2-Impact_4.3.json`. Alternatively, copy your existing installation and rename the version folder, json, and id in the json if you want to be able to choose from the Minecraft launcher whether you want Impact or Impact+Baritone. +### Cutting Edge Release +If you want to trust @Plutie#9079, you can download an automatically generated build of the latest commit +from his Jenkins server, found here. -- Add the Baritone tweak class to line 7 "minecraftArguments" like so: `"minecraftArguments": " ... --tweakClass clientapi.load.ClientTweaker --tweakClass baritone.launch.BaritoneTweakerOptifine",`. You need the Optifine tweaker even though there is no Optifine involved, for reasons I don't quite understand. -- Add the Baritone library. Insert `{ "name": "cabaletta:baritone:1.0.0" },` between Impact and ClientAPI, which should be between lines 15 and 16. +## Placing Baritone in the libraries directory +``/libraries`` is a neat directory in your Minecraft Installation Directory +that contains all of the dependencies that are required from the game and some mods. This is where we will be +putting baritone. +- Locate the ``libraries`` folder, it should be in the Minecraft Installation Directory +- Create 3 new subdirectories starting from ``libraries`` + - ``cabaletta`` + - ``baritone`` + - ``1.0.0`` + - Copy the build of Baritone that was acquired earlier, and place it into the ``1.0.0`` folder + - The full path should look like ``/libraries/cabaletta/baritone/1.0.0/baritone-1.0.0.jar`` -Restart the Minecraft launcher, then load Impact 4.3 as normal, and it should now include Baritone. +## Modifying the Impact Profile JSON to run baritone +The final step is "registering" the Baritone library with Impact, so that it loads on launch. +- Ensure your Minecraft launcher is closed +- Navigate back to the Minecraft Installation Directory +- Find the ``profiles`` directory, and open in +- In here there should be a ``1.12.2-Impact_4.3`` folder. + - If you don't have any Impact folder or have a version older than 4.3, you can download Impact here. +- Open the folder and inside there should be a file called ``1.12.2-Impact_4.3.json`` +- Open the JSON file with a text editor that supports your system's line endings + - For example, Notepad on Windows likely will NOT work for this. You should instead use a Text Editor like + Notepad++ if you're on Windows. (For other systems, I'm not sure + what would work the best so you may have to do some research.) +- Find the ``libraries`` array in the JSON. It should look something like this. + ``` + "libraries": [ + { + "name": "net.minecraft:launchwrapper:1.12" + }, + { + "name": "com.github.ImpactDevelopment:Impact:4.3-1.12.2", + "url": "https://impactdevelopment.github.io/maven/" + }, + { + "name": "com.github.ImpactDeveloment:ClientAPI:3.0.2", + "url": "https://impactdevelopment.github.io/maven/" + }, + ... + ``` +- Create a new object in the array, between the ``Impact`` and ``ClientAPI`` dependencies preferably. + ``` + { + "name": "cabaletta:baritone:1.0.0" + }, + ``` +- If you didn't close your launcher for this step, restart it now. +- You can now launch Impact 4.3 as normal, and Baritone should start up + + ## How to use Baritone + Instructions on how to use Baritone are limited, and you may have to read a little bit of code (Really nothing much + just plain English), you can view that here. From ecd8da553bd96d815acb566b2c4429600d174e77 Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 19 Sep 2018 22:28:53 -0500 Subject: [PATCH 102/120] Can't forget the tweaker --- IMPACT.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/IMPACT.md b/IMPACT.md index 88daeb66..40711c0d 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -74,6 +74,10 @@ The final step is "registering" the Baritone library with Impact, so that it loa "name": "cabaletta:baritone:1.0.0" }, ``` +- Now find the ``"minecraftArguments": "..."`` text near the top. +- At the very end of the quotes where it says ``--tweakClass clientapi.load.ClientTweaker"``, add on the following so it looks like: + - ``--tweakClass clientapi.load.ClientTweaker --tweakClass baritone.launch.BaritoneTweakerOptifine"`` + - It should now read something like - If you didn't close your launcher for this step, restart it now. - You can now launch Impact 4.3 as normal, and Baritone should start up From d4f1a127d7a8e7576403c49f759754ee33bcbbd1 Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 19 Sep 2018 22:29:42 -0500 Subject: [PATCH 103/120] iMpAtIeNt --- IMPACT.md | 1 + 1 file changed, 1 insertion(+) diff --git a/IMPACT.md b/IMPACT.md index 40711c0d..7244b98b 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -1,4 +1,5 @@ # Integration between Baritone and Impact +Impact 4.4 will have Baritone included on release, however, if you're impatient, you can install Baritone into Impact 4.3 right now! ## An Introduction There are some basic steps to getting Baritone setup with Impact. From 28a8e7ea634e04bff113f1321518e7ef96d6a28a Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 19 Sep 2018 20:30:17 -0700 Subject: [PATCH 104/120] home should path, not just set goal --- src/main/java/baritone/utils/ExampleBaritoneControl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index b6ef2a45..a4fea03b 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -421,7 +421,8 @@ public class ExampleBaritoneControl extends Behavior implements Helper { } else { Goal goal = new GoalBlock(waypoint.location); PathingBehavior.INSTANCE.setGoal(goal); - logDirect("Set goal to saved home " + goal); + PathingBehavior.INSTANCE.path(); + logDirect("Going to saved home " + goal); } event.cancel(); return; From d3c194c74676e63269e9bfac913b3e860a42084c Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 19 Sep 2018 22:30:21 -0500 Subject: [PATCH 105/120] Brady doesn't know how to remove things that he didn't want to add --- IMPACT.md | 1 - 1 file changed, 1 deletion(-) diff --git a/IMPACT.md b/IMPACT.md index 7244b98b..e7473e7e 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -78,7 +78,6 @@ The final step is "registering" the Baritone library with Impact, so that it loa - Now find the ``"minecraftArguments": "..."`` text near the top. - At the very end of the quotes where it says ``--tweakClass clientapi.load.ClientTweaker"``, add on the following so it looks like: - ``--tweakClass clientapi.load.ClientTweaker --tweakClass baritone.launch.BaritoneTweakerOptifine"`` - - It should now read something like - If you didn't close your launcher for this step, restart it now. - You can now launch Impact 4.3 as normal, and Baritone should start up From 8a03428635cf2d2b54e064778444a5de7ebc8163 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 19 Sep 2018 20:32:06 -0700 Subject: [PATCH 106/120] change url --- IMPACT.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/IMPACT.md b/IMPACT.md index e7473e7e..e55bf743 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -27,7 +27,7 @@ command line ### Cutting Edge Release If you want to trust @Plutie#9079, you can download an automatically generated build of the latest commit -from his Jenkins server, found here. +from his Jenkins server, found here. ## Placing Baritone in the libraries directory ``/libraries`` is a neat directory in your Minecraft Installation Directory diff --git a/README.md b/README.md index 18031bdd..c2c82200 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ the original version of the bot for Minecraft 1.8, rebuilt for 1.12.2. Baritone + Impact -Unofficial Jenkins: [![Build Status](http://24.202.239.85:8080/job/baritone/badge/icon)](http://24.202.239.85:8080/job/baritone/lastSuccessfulBuild/) +Unofficial Jenkins: [![Build Status](https://plutiejenkins.leijurv.com/job/baritone/badge/icon)](https://plutiejenkins.leijurv.com/job/baritone/lastSuccessfulBuild/) # Setup From 01b88caa93b127e16d5965dc958b386505700e0d Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 19 Sep 2018 22:32:19 -0500 Subject: [PATCH 107/120] Consistent Indentation --- IMPACT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IMPACT.md b/IMPACT.md index e55bf743..c7f167aa 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -27,7 +27,7 @@ command line ### Cutting Edge Release If you want to trust @Plutie#9079, you can download an automatically generated build of the latest commit -from his Jenkins server, found here. +from his Jenkins server, found here. ## Placing Baritone in the libraries directory ``/libraries`` is a neat directory in your Minecraft Installation Directory @@ -72,7 +72,7 @@ The final step is "registering" the Baritone library with Impact, so that it loa - Create a new object in the array, between the ``Impact`` and ``ClientAPI`` dependencies preferably. ``` { - "name": "cabaletta:baritone:1.0.0" + "name": "cabaletta:baritone:1.0.0" }, ``` - Now find the ``"minecraftArguments": "..."`` text near the top. From 5bd4dcadf803ef3ce3c2a5d1fda396a059b85e34 Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 19 Sep 2018 22:35:52 -0500 Subject: [PATCH 108/120] gitHUB --- IMPACT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPACT.md b/IMPACT.md index c7f167aa..3b2d61c6 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -27,7 +27,7 @@ command line ### Cutting Edge Release If you want to trust @Plutie#9079, you can download an automatically generated build of the latest commit -from his Jenkins server, found here. +from his Jenkins server, found here. ## Placing Baritone in the libraries directory ``/libraries`` is a neat directory in your Minecraft Installation Directory From 454bc9c6286b517727740cc80f466bb64d1e39c7 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 19 Sep 2018 21:22:57 -0700 Subject: [PATCH 109/120] versions, not profiles --- IMPACT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMPACT.md b/IMPACT.md index 3b2d61c6..357119a1 100644 --- a/IMPACT.md +++ b/IMPACT.md @@ -45,7 +45,7 @@ putting baritone. The final step is "registering" the Baritone library with Impact, so that it loads on launch. - Ensure your Minecraft launcher is closed - Navigate back to the Minecraft Installation Directory -- Find the ``profiles`` directory, and open in +- Find the ``versions`` directory, and open in - In here there should be a ``1.12.2-Impact_4.3`` folder. - If you don't have any Impact folder or have a version older than 4.3, you can download Impact here. - Open the folder and inside there should be a file called ``1.12.2-Impact_4.3.json`` From d0fd370d53b11af181742ecf8d22d8300d4b9d04 Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 20 Sep 2018 11:35:36 -0500 Subject: [PATCH 110/120] Fix issue with WorldScanner where no chunks match exact dist squared --- src/main/java/baritone/cache/WorldScanner.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index bd2690a6..db457744 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -50,12 +50,14 @@ public enum WorldScanner implements Helper { boolean foundWithinY = false; while (true) { boolean allUnloaded = true; + boolean foundChunks = false; for (int xoff = -searchRadiusSq; xoff <= searchRadiusSq; xoff++) { for (int zoff = -searchRadiusSq; zoff <= searchRadiusSq; zoff++) { int distance = xoff * xoff + zoff * zoff; if (distance != searchRadiusSq) { continue; } + foundChunks = true; int chunkX = xoff + playerChunkX; int chunkZ = zoff + playerChunkZ; Chunk chunk = chunkProvider.getLoadedChunk(chunkX, chunkZ); @@ -92,7 +94,7 @@ public enum WorldScanner implements Helper { } } } - if (allUnloaded) { + if (allUnloaded && foundChunks) { return res; } if (res.size() >= max && (searchRadiusSq > 26 || (searchRadiusSq > 1 && foundWithinY))) { From 37f00f3e14de378ad58c91d7265672bdc5dd0f55 Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 20 Sep 2018 12:21:23 -0500 Subject: [PATCH 111/120] Made foundWithinY in WorldScanner an "option" --- src/main/java/baritone/behavior/MineBehavior.java | 2 +- src/main/java/baritone/cache/WorldScanner.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 71674363..84169ea8 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -148,7 +148,7 @@ public final class MineBehavior extends Behavior implements Helper { } if (!uninteresting.isEmpty()) { //long before = System.currentTimeMillis(); - locs.addAll(WorldScanner.INSTANCE.scanLoadedChunks(uninteresting, max)); + locs.addAll(WorldScanner.INSTANCE.scanLoadedChunks(uninteresting, max, 10)); //System.out.println("Scan of loaded chunks took " + (System.currentTimeMillis() - before) + "ms"); } return prune(locs, mining, max); diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index db457744..512661b0 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -32,7 +32,16 @@ import java.util.List; public enum WorldScanner implements Helper { INSTANCE; - public List scanLoadedChunks(List blocks, int max) { + /** + * Scans the world, up to your render distance, for the specified blocks. + * + * @param blocks The blocks to scan for + * @param max The maximum number of blocks to scan before cutoff + * @param yLevelThreshold If a block is found within this Y level, the current result will be + * returned, if the value is negative, then this condition doesn't apply. + * @return The matching block positions + */ + public List scanLoadedChunks(List blocks, int max, int yLevelThreshold) { if (blocks.contains(null)) { throw new IllegalStateException("Invalid block name should have been caught earlier: " + blocks.toString()); } @@ -84,7 +93,7 @@ public enum WorldScanner implements Helper { if (blocks.contains(state.getBlock())) { int yy = yReal | y; res.add(new BlockPos(chunkX | x, yy, chunkZ | z)); - if (Math.abs(yy - playerY) < 10) { + if (Math.abs(yy - playerY) < yLevelThreshold) { foundWithinY = true; } } From 0575e2d6675f5e6dd323cc92ac662665f8009f2d Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 20 Sep 2018 13:52:29 -0500 Subject: [PATCH 112/120] Fix size parameter not being properly recognized by WorldScanner --- src/main/java/baritone/cache/WorldScanner.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index 512661b0..106161f8 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -103,10 +103,10 @@ public enum WorldScanner implements Helper { } } } - if (allUnloaded && foundChunks) { - return res; - } - if (res.size() >= max && (searchRadiusSq > 26 || (searchRadiusSq > 1 && foundWithinY))) { + if ((allUnloaded && foundChunks) + || res.size() >= max + || (searchRadiusSq > 26 || (searchRadiusSq > 1 && foundWithinY)) + ) { return res; } searchRadiusSq++; From 1c2e47c39af8d6085bbbd3e936cddec3924b1161 Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 20 Sep 2018 14:14:59 -0500 Subject: [PATCH 113/120] Add maxSearchRadius parameter to WorldScanner --- src/main/java/baritone/cache/WorldScanner.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index 106161f8..48cb59ba 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -39,9 +39,10 @@ public enum WorldScanner implements Helper { * @param max The maximum number of blocks to scan before cutoff * @param yLevelThreshold If a block is found within this Y level, the current result will be * returned, if the value is negative, then this condition doesn't apply. + * @param maxSearchRadius The maximum chunk search radius * @return The matching block positions */ - public List scanLoadedChunks(List blocks, int max, int yLevelThreshold) { + public List scanLoadedChunks(List blocks, int max, int yLevelThreshold, int maxSearchRadius) { if (blocks.contains(null)) { throw new IllegalStateException("Invalid block name should have been caught earlier: " + blocks.toString()); } @@ -51,6 +52,7 @@ public enum WorldScanner implements Helper { } ChunkProviderClient chunkProvider = world().getChunkProvider(); + int maxSearchRadiusSq = maxSearchRadius * maxSearchRadius; int playerChunkX = playerFeet().getX() >> 4; int playerChunkZ = playerFeet().getZ() >> 4; int playerY = playerFeet().getY(); @@ -105,7 +107,7 @@ public enum WorldScanner implements Helper { } if ((allUnloaded && foundChunks) || res.size() >= max - || (searchRadiusSq > 26 || (searchRadiusSq > 1 && foundWithinY)) + || (searchRadiusSq > maxSearchRadiusSq || (searchRadiusSq > 1 && foundWithinY)) ) { return res; } From ddf7b3739a1d43df5ba265cb5da69e304cea8851 Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 20 Sep 2018 14:29:37 -0500 Subject: [PATCH 114/120] Fix compiler error --- src/main/java/baritone/behavior/MineBehavior.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 84169ea8..f7271966 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -148,7 +148,7 @@ public final class MineBehavior extends Behavior implements Helper { } if (!uninteresting.isEmpty()) { //long before = System.currentTimeMillis(); - locs.addAll(WorldScanner.INSTANCE.scanLoadedChunks(uninteresting, max, 10)); + locs.addAll(WorldScanner.INSTANCE.scanLoadedChunks(uninteresting, max, 10, 26)); //System.out.println("Scan of loaded chunks took " + (System.currentTimeMillis() - before) + "ms"); } return prune(locs, mining, max); From e3434115acfa2bd17538dd38856957251cb07519 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 20 Sep 2018 13:29:26 -0700 Subject: [PATCH 115/120] logger --- src/main/java/baritone/Settings.java | 8 ++++++++ src/main/java/baritone/utils/Helper.java | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 286c06e7..4545faa8 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -17,11 +17,14 @@ package baritone; +import baritone.utils.Helper; import net.minecraft.init.Blocks; import net.minecraft.item.Item; +import net.minecraft.util.text.ITextComponent; import java.lang.reflect.Field; import java.util.*; +import java.util.function.Consumer; /** * Baritone's settings @@ -375,6 +378,11 @@ public class Settings { */ public Setting followRadius = new Setting<>(3); + /** + * Instead of Baritone logging to chat, set a custom consumer. + */ + public Setting> logger = new Setting<>(new Helper() {}::addToChat); + public final Map> byLowerName; public final List> allSettings; diff --git a/src/main/java/baritone/utils/Helper.java b/src/main/java/baritone/utils/Helper.java index d808e632..9924d0bf 100755 --- a/src/main/java/baritone/utils/Helper.java +++ b/src/main/java/baritone/utils/Helper.java @@ -96,6 +96,11 @@ public interface Helper { ITextComponent component = MESSAGE_PREFIX.createCopy(); component.getStyle().setColor(TextFormatting.GRAY); component.appendSibling(new TextComponentString(" " + message)); - mc.ingameGUI.getChatGUI().printChatMessage(component); + Baritone.settings().logger.get().accept(component); } + + default void addToChat(ITextComponent msg) { + mc.ingameGUI.getChatGUI().printChatMessage(msg); + } + } From 4513a537dbf732048026b8f1402c4b1fe9d473a0 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 20 Sep 2018 14:08:56 -0700 Subject: [PATCH 116/120] fix logic in minebehavior --- src/main/java/baritone/behavior/MineBehavior.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index f7271966..56aa5738 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -119,11 +119,11 @@ public final class MineBehavior extends Behavior implements Helper { if (noDown) { return new GoalTwoBlocks(loc); } else { - return new GoalBlock(loc.down()); + return new GoalBlock(loc); } } else { if (noDown) { - return new GoalBlock(loc); + return new GoalBlock(loc.down()); } else { return new GoalTwoBlocks(loc); } From 2cac115211eed57f206e6cf9e5a20818adbdd3d0 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 20 Sep 2018 14:09:13 -0700 Subject: [PATCH 117/120] fix scan logic --- src/main/java/baritone/cache/WorldScanner.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index 48cb59ba..d6b466ef 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -35,8 +35,8 @@ public enum WorldScanner implements Helper { /** * Scans the world, up to your render distance, for the specified blocks. * - * @param blocks The blocks to scan for - * @param max The maximum number of blocks to scan before cutoff + * @param blocks The blocks to scan for + * @param max The maximum number of blocks to scan before cutoff * @param yLevelThreshold If a block is found within this Y level, the current result will be * returned, if the value is negative, then this condition doesn't apply. * @param maxSearchRadius The maximum chunk search radius @@ -106,8 +106,8 @@ public enum WorldScanner implements Helper { } } if ((allUnloaded && foundChunks) - || res.size() >= max - || (searchRadiusSq > maxSearchRadiusSq || (searchRadiusSq > 1 && foundWithinY)) + || (res.size() >= max + && (searchRadiusSq > maxSearchRadiusSq || (searchRadiusSq > 1 && foundWithinY))) ) { return res; } From 21568f593a41a0da191d5f3eb2cb3a6e30bdf67d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 20 Sep 2018 21:27:25 -0700 Subject: [PATCH 118/120] fix goal offset logic --- src/main/java/baritone/behavior/MineBehavior.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 56aa5738..c5fd1534 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -113,16 +113,16 @@ public final class MineBehavior extends Behavior implements Helper { return new GoalTwoBlocks(loc); } - boolean noUp = locs.contains(loc.up()) && !(Baritone.settings().internalMiningAirException.get() && BlockStateInterface.getBlock(loc.up()) == Blocks.AIR); - boolean noDown = locs.contains(loc.down()) && !(Baritone.settings().internalMiningAirException.get() && BlockStateInterface.getBlock(loc.up()) == Blocks.AIR); - if (noUp) { - if (noDown) { + boolean upwardGoal = locs.contains(loc.up()) || (Baritone.settings().internalMiningAirException.get() && BlockStateInterface.getBlock(loc.up()) == Blocks.AIR); + boolean downwardGoal = locs.contains(loc.down()) || (Baritone.settings().internalMiningAirException.get() && BlockStateInterface.getBlock(loc.up()) == Blocks.AIR); + if (upwardGoal) { + if (downwardGoal) { return new GoalTwoBlocks(loc); } else { return new GoalBlock(loc); } } else { - if (noDown) { + if (downwardGoal) { return new GoalBlock(loc.down()); } else { return new GoalTwoBlocks(loc); From ae59e94a6c807661853d27bf2f2d06759bc08b2c Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 21 Sep 2018 08:49:49 -0700 Subject: [PATCH 119/120] lmao wtf --- src/main/java/baritone/behavior/MineBehavior.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index c5fd1534..3073c0f8 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -103,8 +103,6 @@ public final class MineBehavior extends Behavior implements Helper { locationsCache = locs; PathingBehavior.INSTANCE.setGoal(coalesce(locs)); PathingBehavior.INSTANCE.path(); - - Blocks.DIAMOND_ORE.getItemDropped(Blocks.DIAMOND_ORE.getDefaultState(), new Random(), 0); } public static GoalComposite coalesce(List locs) { From 9661ab3b4215c3cfbe97938b52ad7a0e677ce8d1 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 21 Sep 2018 09:30:37 -0700 Subject: [PATCH 120/120] more info on cancelOnGoalInvalidation --- src/main/java/baritone/Settings.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 4545faa8..87bd1812 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -339,7 +339,17 @@ public class Settings { public Setting mineGoalUpdateInterval = new Setting<>(5); /** - * Cancel the current path if the goal has changed, and the path originally ended in the goal but doesn't anymore + * Cancel the current path if the goal has changed, and the path originally ended in the goal but doesn't anymore. + *

+ * Currently only runs when either MineBehavior or FollowBehavior is active. + *

+ * For example, if Baritone is doing "mine iron_ore", the instant it breaks the ore (and it becomes air), that location + * is no longer a goal. This means that if this setting is true, it will stop there. If this setting were off, it would + * continue with its path, and walk into that location. The tradeoff is if this setting is true, it mines ores much faster + * since it doesn't waste any time getting into locations that no longer contain ores, but on the other hand, it misses + * some drops, and continues on without ever picking them up. + *

+ * Also on cosmic prisons this should be set to true since you don't actually mine the ore it just gets replaced with stone. */ public Setting cancelOnGoalInvalidation = new Setting<>(true);