From 63b04df95da2ca369a15060c882161055124b311 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 6 Sep 2018 07:48:27 -0700 Subject: [PATCH 1/8] parkour --- FEATURES.md | 4 +- src/main/java/baritone/Settings.java | 5 + .../pathing/calc/AStarPathFinder.java | 6 +- .../baritone/pathing/movement/Movement.java | 4 + .../pathing/movement/MovementHelper.java | 34 ++++ .../movement/movements/MovementParkour.java | 151 ++++++++++++++++++ .../utils/pathing/BetterBlockPos.java | 6 + 7 files changed, 207 insertions(+), 3 deletions(-) create mode 100644 src/main/java/baritone/pathing/movement/movements/MovementParkour.java diff --git a/FEATURES.md b/FEATURES.md index 998b546a7..98bae9e22 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -9,6 +9,7 @@ - **Slabs and stairs** - **Falling blocks** Baritone understands the costs of breaking blocks with falling blocks on top, and includes all of their break costs. Additionally, since it avoids breaking any blocks touching a liquid, it won't break the bottom of a gravel stack below a lava lake (anymore). - **Avoiding dangerous blocks** Obviously, it knows not to walk through fire or on magma, not to corner over lava (that deals some damage), not to break any blocks touching a liquid (it might drown), etc. +- **Parkour** Sprint jumping over 1, 2, or 3 block gaps # Pathing method Baritone uses a modified version of A*. @@ -41,8 +42,7 @@ Things it doesn't have yet See issues for more. Things it may not ever have, from most likely to least likely =( -- Parkour (jumping over gaps of any length) -- Boats - Pigs +- Boats - Horses (2x3 path instead of 1x2) - Elytra diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 1eed43334..5bb575495 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -83,6 +83,11 @@ public class Settings { */ public Setting allowWalkOnBottomSlab = new Setting<>(true); + /** + * You know what it is + */ + public Setting allowParkour = new Setting<>(true); // disable in release because its sketchy af lol + /** * For example, if you have Mining Fatigue or Haste, adjust the costs of breaking blocks accordingly. */ diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index 73442998f..893d9686d 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -233,7 +233,11 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { new MovementDiagonal(pos, EnumFacing.NORTH, EnumFacing.EAST), new MovementDiagonal(pos, EnumFacing.SOUTH, EnumFacing.WEST), new MovementDiagonal(pos, EnumFacing.SOUTH, EnumFacing.EAST), - new MovementPillar(pos, new BetterBlockPos(x, y + 1, z)) + new MovementPillar(pos, new BetterBlockPos(x, y + 1, z)), + MovementParkour.calculate(pos, EnumFacing.NORTH), + MovementParkour.calculate(pos, EnumFacing.SOUTH), + MovementParkour.calculate(pos, EnumFacing.EAST), + MovementParkour.calculate(pos, EnumFacing.WEST), }; } diff --git a/src/main/java/baritone/pathing/movement/Movement.java b/src/main/java/baritone/pathing/movement/Movement.java index 5eba39aba..76871934d 100644 --- a/src/main/java/baritone/pathing/movement/Movement.java +++ b/src/main/java/baritone/pathing/movement/Movement.java @@ -84,6 +84,10 @@ public abstract class Movement implements Helper, MovementHelper { return getCost(null); } + protected void override(double cost) { + this.cost = cost; + } + public double calculateCostWithoutCaching() { return calculateCost(new CalculationContext()); } diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 6897d5a4d..7c9a8c36f 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -70,6 +70,9 @@ public interface MovementHelper extends ActionCosts, Helper { static boolean canWalkThrough(BlockPos pos, IBlockState state) { Block block = state.getBlock(); + if (block == Blocks.AIR) { + return true; + } if (block instanceof BlockFire || block instanceof BlockTripWire || block instanceof BlockWeb @@ -106,6 +109,37 @@ public interface MovementHelper extends ActionCosts, Helper { return block.isPassable(mc.world, pos); } + /** + * canWalkThrough but also won't impede movement at all. so not including doors or fence gates (we'd have to right click), + * not including water, and not including ladders or vines or cobwebs (they slow us down) + * + * @return + */ + static boolean fullyPassable(BlockPos pos) { + return fullyPassable(pos, BlockStateInterface.get(pos)); + } + + static boolean fullyPassable(BlockPos pos, IBlockState state) { + Block block = state.getBlock(); + if (block == Blocks.AIR) { + return true; + } + if (block == Blocks.FIRE + || block == Blocks.TRIPWIRE + || block == Blocks.WEB + || block == Blocks.VINE + || block == Blocks.LADDER + || block instanceof BlockDoor + || block instanceof BlockFenceGate + || block instanceof BlockSnow + || block instanceof BlockLiquid + || block instanceof BlockTrapDoor + || block instanceof BlockEndPortal) { + return false; + } + return block.isPassable(mc.world, pos); + } + static boolean isReplacable(BlockPos pos, IBlockState state) { // for MovementTraverse and MovementAscend // block double plant defaults to true when the block doesn't match, so don't need to check that case diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java new file mode 100644 index 000000000..3749e6ec2 --- /dev/null +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -0,0 +1,151 @@ +/* + * 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.movement.movements; + +import baritone.Baritone; +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 net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; + +public class MovementParkour extends Movement { + + final EnumFacing direction; + final int dist; + + private MovementParkour(BlockPos src, int dist, EnumFacing dir) { + super(src, src.offset(dir, dist), new BlockPos[]{}); + this.direction = dir; + this.dist = dist; + super.override(costFromJumpDistance(dist)); + } + + public static MovementParkour calculate(BlockPos src, EnumFacing dir) { + if (!Baritone.settings().allowParkour.get()) { + return null; + } + IBlockState standingOn = BlockStateInterface.get(src.down()); + if (standingOn.getBlock() == Blocks.VINE || standingOn.getBlock() == Blocks.LADDER || MovementHelper.isBottomSlab(standingOn)) { + return null; + } + BlockPos adjBlock = src.down().offset(dir); + IBlockState adj = BlockStateInterface.get(adjBlock); + if (MovementHelper.avoidWalkingInto(adj.getBlock())) { // magma sucks + return null; + } + if (MovementHelper.canWalkOn(adjBlock, adj)) { // don't parkour if we could just traverse (for now) + return null; + } + + if (!MovementHelper.fullyPassable(src.offset(dir))) { + return null; + } + if (!MovementHelper.fullyPassable(src.up().offset(dir))) { + return null; + } + for (int i = 2; i <= 4; i++) { + BlockPos dest = src.offset(dir, i); + if (!MovementHelper.fullyPassable(dest)) { + return null; + } + if (!MovementHelper.fullyPassable(dest.up())) { + return null; + } + if (MovementHelper.canWalkOn(dest.down())) { + return new MovementParkour(src, i, dir); + } + } + return null; + } + + private static double costFromJumpDistance(int dist) { + switch (dist) { + case 2: + return WALK_ONE_BLOCK_COST * 2; // IDK LOL + case 3: + return WALK_ONE_BLOCK_COST * 3; + case 4: + return SPRINT_ONE_BLOCK_COST * 3; + } + throw new IllegalStateException("LOL"); + } + + + @Override + protected double calculateCost(CalculationContext context) { + if (!MovementHelper.canWalkOn(dest.down())) { + return COST_INF; + } + if (MovementHelper.avoidWalkingInto(BlockStateInterface.get(src.down().offset(direction)).getBlock())) { + return COST_INF; + } + for (int i = 1; i <= 4; i++) { + BlockPos d = src.offset(direction, i); + if (!MovementHelper.fullyPassable(d)) { + return COST_INF; + } + if (!MovementHelper.fullyPassable(d.up())) { + return COST_INF; + } + if (d.equals(dest)) { + return costFromJumpDistance(i); + } + } + throw new IllegalStateException("invalid jump distance?"); + } + + @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 (dist >= 4) { + state.setInput(InputOverrideHandler.Input.SPRINT, true); + } + MovementHelper.moveTowards(state, dest); + if (playerFeet().equals(dest)) { + if (player().posY - playerFeet().getY() < 0.01) { + state.setStatus(MovementState.MovementStatus.SUCCESS); + } + } else if (!playerFeet().equals(src)) { + if (playerFeet().equals(src.offset(direction)) || player().posY - playerFeet().getY() > 0.0001) { + state.setInput(InputOverrideHandler.Input.JUMP, true); + } else { + state.setInput(InputOverrideHandler.Input.SPRINT, false); + if (playerFeet().equals(src.offset(direction, -1))) { + MovementHelper.moveTowards(state, src); + } else { + MovementHelper.moveTowards(state, src.offset(direction, -1)); + } + } + } + return state; + } +} \ No newline at end of file diff --git a/src/main/java/baritone/utils/pathing/BetterBlockPos.java b/src/main/java/baritone/utils/pathing/BetterBlockPos.java index ec8891f4d..6a05c109a 100644 --- a/src/main/java/baritone/utils/pathing/BetterBlockPos.java +++ b/src/main/java/baritone/utils/pathing/BetterBlockPos.java @@ -119,4 +119,10 @@ public final class BetterBlockPos extends BlockPos { Vec3i vec = dir.getDirectionVec(); return new BetterBlockPos(x + vec.getX(), y + vec.getY(), z + vec.getZ()); } + + @Override + public BlockPos offset(EnumFacing dir, int dist) { + Vec3i vec = dir.getDirectionVec(); + return new BetterBlockPos(x + vec.getX() * dist, y + vec.getY() * dist, z + vec.getZ() * dist); + } } From 915b03a44e4d0c46b9f45a438c1f68b82b25bb34 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 6 Sep 2018 07:54:12 -0700 Subject: [PATCH 2/8] lol --- .../baritone/pathing/movement/movements/MovementParkour.java | 2 +- 1 file changed, 1 insertion(+), 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 3749e6ec2..05a88ded0 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -86,7 +86,7 @@ public class MovementParkour extends Movement { case 3: return WALK_ONE_BLOCK_COST * 3; case 4: - return SPRINT_ONE_BLOCK_COST * 3; + return SPRINT_ONE_BLOCK_COST * 4; } throw new IllegalStateException("LOL"); } From b746e56631adf7ddf5048f31643277d830c29a76 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 6 Sep 2018 10:13:50 -0700 Subject: [PATCH 3/8] lol you can't jump with a ceiling above you --- .../movement/movements/MovementParkour.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 05a88ded0..edae2abfc 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -66,11 +66,10 @@ public class MovementParkour extends Movement { } for (int i = 2; i <= 4; i++) { BlockPos dest = src.offset(dir, i); - if (!MovementHelper.fullyPassable(dest)) { - return null; - } - if (!MovementHelper.fullyPassable(dest.up())) { - return null; + for (int y = 0; y < 3; y++) { + if (!MovementHelper.fullyPassable(dest.up(y))) { + return null; + } } if (MovementHelper.canWalkOn(dest.down())) { return new MovementParkour(src, i, dir); @@ -102,11 +101,10 @@ public class MovementParkour extends Movement { } for (int i = 1; i <= 4; i++) { BlockPos d = src.offset(direction, i); - if (!MovementHelper.fullyPassable(d)) { - return COST_INF; - } - if (!MovementHelper.fullyPassable(d.up())) { - return COST_INF; + for (int y = 0; y < 3; y++) { + if (!MovementHelper.fullyPassable(d.up(y))) { + return COST_INF; + } } if (d.equals(dest)) { return costFromJumpDistance(i); From 9757422626984e78cc7dd81258d724c7582a03ec Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 6 Sep 2018 10:14:41 -0700 Subject: [PATCH 4/8] also check where we might hit our head --- .../baritone/pathing/movement/movements/MovementParkour.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index edae2abfc..40f9b5a35 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -66,7 +66,8 @@ public class MovementParkour extends Movement { } for (int i = 2; i <= 4; i++) { BlockPos dest = src.offset(dir, i); - for (int y = 0; y < 3; y++) { + // TODO perhaps dest.up(3) doesn't need to be fullyPassable, just canWalkThrough, possibly? + for (int y = 0; y < 4; y++) { if (!MovementHelper.fullyPassable(dest.up(y))) { return null; } @@ -101,7 +102,7 @@ public class MovementParkour extends Movement { } for (int i = 1; i <= 4; i++) { BlockPos d = src.offset(direction, i); - for (int y = 0; y < 3; y++) { + for (int y = 0; y < 4; y++) { if (!MovementHelper.fullyPassable(d.up(y))) { return COST_INF; } From 2d969b55ef36ba2f98ffd18a2ff57730b9de2aa9 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 7 Sep 2018 18:23:05 -0700 Subject: [PATCH 5/8] fix world scanner radius --- src/main/java/baritone/chunk/WorldScanner.java | 12 ++++++------ .../baritone/utils/interfaces/IGoalRenderPos.java | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 src/main/java/baritone/utils/interfaces/IGoalRenderPos.java diff --git a/src/main/java/baritone/chunk/WorldScanner.java b/src/main/java/baritone/chunk/WorldScanner.java index 09edd1e56..27345670e 100644 --- a/src/main/java/baritone/chunk/WorldScanner.java +++ b/src/main/java/baritone/chunk/WorldScanner.java @@ -47,13 +47,13 @@ public enum WorldScanner implements Helper { int playerChunkX = playerFeet().getX() >> 4; int playerChunkZ = playerFeet().getZ() >> 4; - int searchRadius = 2; + int searchRadiusSq = 0; while (true) { boolean allUnloaded = true; - for (int xoff = -searchRadius; xoff <= searchRadius; xoff++) { - for (int zoff = -searchRadius; zoff <= searchRadius; zoff++) { + for (int xoff = -searchRadiusSq; xoff <= searchRadiusSq; xoff++) { + for (int zoff = -searchRadiusSq; zoff <= searchRadiusSq; zoff++) { int distance = xoff * xoff + zoff * zoff; - if (distance != searchRadius) { + if (distance != searchRadiusSq) { continue; } int chunkX = xoff + playerChunkX; @@ -91,10 +91,10 @@ public enum WorldScanner implements Helper { if (allUnloaded) { return res; } - if (res.size() >= max) { + if (res.size() >= max && searchRadiusSq < 26) { return res; } - searchRadius++; + searchRadiusSq++; } } } diff --git a/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java b/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java new file mode 100644 index 000000000..cdc7cd00c --- /dev/null +++ b/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java @@ -0,0 +1,4 @@ +package baritone.utils.interfaces; + +public class IGoalRenderPos { +} From 85babda97e3d27dfe1fa427a29bdd2d1779f2c31 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 7 Sep 2018 18:23:32 -0700 Subject: [PATCH 6/8] render more goals, fixes #25 --- .../baritone/pathing/goals/GoalBlock.java | 3 ++- .../pathing/goals/GoalGetToBlock.java | 3 ++- .../java/baritone/pathing/goals/GoalNear.java | 3 ++- .../baritone/pathing/goals/GoalTwoBlocks.java | 5 +++-- .../pathing/movement/MovementHelper.java | 1 + .../java/baritone/utils/PathRenderer.java | 13 ++++++----- .../utils/interfaces/IGoalRenderPos.java | 22 ++++++++++++++++++- 7 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/main/java/baritone/pathing/goals/GoalBlock.java b/src/main/java/baritone/pathing/goals/GoalBlock.java index 78d7b87df..9e6ea5569 100644 --- a/src/main/java/baritone/pathing/goals/GoalBlock.java +++ b/src/main/java/baritone/pathing/goals/GoalBlock.java @@ -17,6 +17,7 @@ package baritone.pathing.goals; +import baritone.utils.interfaces.IGoalRenderPos; import net.minecraft.util.math.BlockPos; /** @@ -24,7 +25,7 @@ import net.minecraft.util.math.BlockPos; * * @author leijurv */ -public class GoalBlock implements Goal { +public class GoalBlock implements Goal, IGoalRenderPos { /** * The X block position of this goal diff --git a/src/main/java/baritone/pathing/goals/GoalGetToBlock.java b/src/main/java/baritone/pathing/goals/GoalGetToBlock.java index 309377720..4e81018ba 100644 --- a/src/main/java/baritone/pathing/goals/GoalGetToBlock.java +++ b/src/main/java/baritone/pathing/goals/GoalGetToBlock.java @@ -17,6 +17,7 @@ package baritone.pathing.goals; +import baritone.utils.interfaces.IGoalRenderPos; import baritone.utils.pathing.BetterBlockPos; import net.minecraft.util.math.BlockPos; @@ -26,7 +27,7 @@ import net.minecraft.util.math.BlockPos; * * @author avecowa */ -public class GoalGetToBlock implements Goal { +public class GoalGetToBlock implements Goal, IGoalRenderPos { private final int x; private final int y; diff --git a/src/main/java/baritone/pathing/goals/GoalNear.java b/src/main/java/baritone/pathing/goals/GoalNear.java index 2ec6bf1d8..e78788acd 100644 --- a/src/main/java/baritone/pathing/goals/GoalNear.java +++ b/src/main/java/baritone/pathing/goals/GoalNear.java @@ -17,9 +17,10 @@ package baritone.pathing.goals; +import baritone.utils.interfaces.IGoalRenderPos; import net.minecraft.util.math.BlockPos; -public class GoalNear implements Goal { +public class GoalNear implements Goal, IGoalRenderPos { final int x; final int y; final int z; diff --git a/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java b/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java index 65571a49a..021103a15 100644 --- a/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java +++ b/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java @@ -17,6 +17,7 @@ package baritone.pathing.goals; +import baritone.utils.interfaces.IGoalRenderPos; import net.minecraft.util.math.BlockPos; /** @@ -25,7 +26,7 @@ import net.minecraft.util.math.BlockPos; * * @author leijurv */ -public class GoalTwoBlocks implements Goal { +public class GoalTwoBlocks implements Goal, IGoalRenderPos { /** * The X block position of this goal @@ -69,7 +70,7 @@ public class GoalTwoBlocks implements Goal { } public BlockPos getGoalPos() { - return new BlockPos(x, y, z); + return new BlockPos(x, y - 1, z); } @Override diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 7c9a8c36f..1369a42fa 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -124,6 +124,7 @@ public interface MovementHelper extends ActionCosts, Helper { if (block == Blocks.AIR) { return true; } + // exceptions - blocks that are isPassasble true, but we can't actually jump through if (block == Blocks.FIRE || block == Blocks.TRIPWIRE || block == Blocks.WEB diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index 6fd3466e1..c4ea81032 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -19,9 +19,10 @@ package baritone.utils; import baritone.Baritone; import baritone.pathing.goals.Goal; -import baritone.pathing.goals.GoalBlock; +import baritone.pathing.goals.GoalComposite; import baritone.pathing.goals.GoalXZ; import baritone.pathing.path.IPath; +import baritone.utils.interfaces.IGoalRenderPos; import baritone.utils.pathing.BetterBlockPos; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -183,13 +184,13 @@ public final class PathRenderer implements Helper { double maxY; double y1; double y2; - if (goal instanceof GoalBlock) { - BlockPos goalPos = ((GoalBlock) goal).getGoalPos(); + if (goal instanceof IGoalRenderPos) { + BlockPos goalPos = ((IGoalRenderPos) goal).getGoalPos(); minX = goalPos.getX() + 0.002 - renderPosX; maxX = goalPos.getX() + 1 - 0.002 - renderPosX; minZ = goalPos.getZ() + 0.002 - renderPosZ; maxZ = goalPos.getZ() + 1 - 0.002 - renderPosZ; - double y = MathHelper.sin((float) (((float) (System.nanoTime() / 1000000L) % 2000L) / 2000F * Math.PI * 2)); + double y = MathHelper.cos((float) (((float) ((System.nanoTime() / 100000L) % 20000L)) / 20000F * Math.PI * 2)); y1 = 1 + y + goalPos.getY() - renderPosY; y2 = 1 - y + goalPos.getY() - renderPosY; minY = goalPos.getY() - renderPosY; @@ -207,7 +208,9 @@ public final class PathRenderer implements Helper { minY = 0 - renderPosY; maxY = 256 - renderPosY; } else { - // TODO GoalComposite + for (Goal g : ((GoalComposite) goal).goals()) { + drawLitDankGoalBox(player, g, partialTicks, color); + } return; } diff --git a/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java b/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java index cdc7cd00c..0aed1ea4a 100644 --- a/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java +++ b/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java @@ -1,4 +1,24 @@ +/* + * 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.utils.interfaces; -public class IGoalRenderPos { +import net.minecraft.util.math.BlockPos; + +public interface IGoalRenderPos { + BlockPos getGoalPos(); } From 6ad9451798621a9b9c61d810c1579d585a7abb36 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 7 Sep 2018 20:43:12 -0700 Subject: [PATCH 7/8] smaller cuter boxes for goaltwoblocks --- src/main/java/baritone/pathing/goals/GoalTwoBlocks.java | 2 +- src/main/java/baritone/utils/PathRenderer.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java b/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java index 021103a15..dcd8d17d9 100644 --- a/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java +++ b/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java @@ -70,7 +70,7 @@ public class GoalTwoBlocks implements Goal, IGoalRenderPos { } public BlockPos getGoalPos() { - return new BlockPos(x, y - 1, z); + return new BlockPos(x, y, z); } @Override diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index c4ea81032..8f3cf37b7 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -20,6 +20,7 @@ package baritone.utils; import baritone.Baritone; import baritone.pathing.goals.Goal; import baritone.pathing.goals.GoalComposite; +import baritone.pathing.goals.GoalTwoBlocks; import baritone.pathing.goals.GoalXZ; import baritone.pathing.path.IPath; import baritone.utils.interfaces.IGoalRenderPos; @@ -191,10 +192,18 @@ public final class PathRenderer implements Helper { minZ = goalPos.getZ() + 0.002 - renderPosZ; maxZ = goalPos.getZ() + 1 - 0.002 - renderPosZ; double y = MathHelper.cos((float) (((float) ((System.nanoTime() / 100000L) % 20000L)) / 20000F * Math.PI * 2)); + if (goal instanceof GoalTwoBlocks) { + y /= 2; + } y1 = 1 + y + goalPos.getY() - renderPosY; y2 = 1 - y + goalPos.getY() - renderPosY; minY = goalPos.getY() - renderPosY; maxY = minY + 2; + if (goal instanceof GoalTwoBlocks) { + y1 -= 0.5; + y2 -= 0.5; + maxY--; + } } else if (goal instanceof GoalXZ) { GoalXZ goalPos = (GoalXZ) goal; From 02ebc1947be5b5b4957a05808fc71984e4c3e837 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 9 Sep 2018 07:18:03 -0700 Subject: [PATCH 8/8] actually disable by default --- src/main/java/baritone/Settings.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 5bb575495..bfab655e8 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -85,8 +85,10 @@ public class Settings { /** * You know what it is + *

+ * But it's very unreliable and falls off when cornering like all the time so. */ - public Setting allowParkour = new Setting<>(true); // disable in release because its sketchy af lol + public Setting allowParkour = new Setting<>(false); /** * For example, if you have Mining Fatigue or Haste, adjust the costs of breaking blocks accordingly.