diff --git a/README.md b/README.md index 7668981c..2a198c40 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,6 @@ Quick start example: `thisway 1000` or `goal 70` to set the goal, `path` to actu BaritoneAPI.getSettings().allowSprint.value = true; BaritoneAPI.getSettings().pathTimeoutMS.value = 2000L; -// Note that at this moment in time the Goal implementations are not exposed in the API BaritoneAPI.getPathingBehavior().setGoal(new GoalXZ(10000, 20000)); BaritoneAPI.getPathingBehavior().path(); ``` diff --git a/src/main/java/baritone/pathing/goals/GoalAxis.java b/src/api/java/baritone/api/pathing/goals/GoalAxis.java similarity index 78% rename from src/main/java/baritone/pathing/goals/GoalAxis.java rename to src/api/java/baritone/api/pathing/goals/GoalAxis.java index 1882a7e3..d8811cf9 100644 --- a/src/main/java/baritone/pathing/goals/GoalAxis.java +++ b/src/api/java/baritone/api/pathing/goals/GoalAxis.java @@ -15,10 +15,9 @@ * along with Baritone. If not, see . */ -package baritone.pathing.goals; +package baritone.api.pathing.goals; -import baritone.Baritone; -import baritone.api.pathing.goals.Goal; +import baritone.api.BaritoneAPI; public class GoalAxis implements Goal { @@ -26,7 +25,7 @@ public class GoalAxis implements Goal { @Override public boolean isInGoal(int x, int y, int z) { - return y == Baritone.settings().axisHeight.get() && (x == 0 || z == 0 || Math.abs(x) == Math.abs(z)); + return y == BaritoneAPI.getSettings().axisHeight.get() && (x == 0 || z == 0 || Math.abs(x) == Math.abs(z)); } @Override @@ -40,7 +39,7 @@ public class GoalAxis implements Goal { 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); + return flatAxisDistance * BaritoneAPI.getSettings().costHeuristic.get() + GoalYLevel.calculate(BaritoneAPI.getSettings().axisHeight.get(), y); } @Override diff --git a/src/main/java/baritone/pathing/goals/GoalBlock.java b/src/api/java/baritone/api/pathing/goals/GoalBlock.java similarity index 95% rename from src/main/java/baritone/pathing/goals/GoalBlock.java rename to src/api/java/baritone/api/pathing/goals/GoalBlock.java index ea28c057..e0a60b59 100644 --- a/src/main/java/baritone/pathing/goals/GoalBlock.java +++ b/src/api/java/baritone/api/pathing/goals/GoalBlock.java @@ -15,10 +15,9 @@ * along with Baritone. If not, see . */ -package baritone.pathing.goals; +package baritone.api.pathing.goals; -import baritone.api.pathing.goals.Goal; -import baritone.utils.interfaces.IGoalRenderPos; +import baritone.api.utils.interfaces.IGoalRenderPos; import net.minecraft.util.math.BlockPos; /** diff --git a/src/main/java/baritone/pathing/goals/GoalComposite.java b/src/api/java/baritone/api/pathing/goals/GoalComposite.java similarity index 96% rename from src/main/java/baritone/pathing/goals/GoalComposite.java rename to src/api/java/baritone/api/pathing/goals/GoalComposite.java index a4dafa45..2926b852 100644 --- a/src/main/java/baritone/pathing/goals/GoalComposite.java +++ b/src/api/java/baritone/api/pathing/goals/GoalComposite.java @@ -15,9 +15,8 @@ * along with Baritone. If not, see . */ -package baritone.pathing.goals; +package baritone.api.pathing.goals; -import baritone.api.pathing.goals.Goal; import net.minecraft.util.math.BlockPos; import java.util.Arrays; diff --git a/src/main/java/baritone/pathing/goals/GoalGetToBlock.java b/src/api/java/baritone/api/pathing/goals/GoalGetToBlock.java similarity index 89% rename from src/main/java/baritone/pathing/goals/GoalGetToBlock.java rename to src/api/java/baritone/api/pathing/goals/GoalGetToBlock.java index 8f249ed0..959b6fcc 100644 --- a/src/main/java/baritone/pathing/goals/GoalGetToBlock.java +++ b/src/api/java/baritone/api/pathing/goals/GoalGetToBlock.java @@ -15,11 +15,9 @@ * along with Baritone. If not, see . */ -package baritone.pathing.goals; +package baritone.api.pathing.goals; -import baritone.api.pathing.goals.Goal; -import baritone.utils.interfaces.IGoalRenderPos; -import baritone.utils.pathing.BetterBlockPos; +import baritone.api.utils.interfaces.IGoalRenderPos; import net.minecraft.util.math.BlockPos; @@ -42,7 +40,7 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos { @Override public BlockPos getGoalPos() { - return new BetterBlockPos(x, y, z); + return new BlockPos(x, y, z); } @Override diff --git a/src/main/java/baritone/pathing/goals/GoalNear.java b/src/api/java/baritone/api/pathing/goals/GoalNear.java similarity index 93% rename from src/main/java/baritone/pathing/goals/GoalNear.java rename to src/api/java/baritone/api/pathing/goals/GoalNear.java index f312c9ee..6befda6b 100644 --- a/src/main/java/baritone/pathing/goals/GoalNear.java +++ b/src/api/java/baritone/api/pathing/goals/GoalNear.java @@ -15,10 +15,9 @@ * along with Baritone. If not, see . */ -package baritone.pathing.goals; +package baritone.api.pathing.goals; -import baritone.api.pathing.goals.Goal; -import baritone.utils.interfaces.IGoalRenderPos; +import baritone.api.utils.interfaces.IGoalRenderPos; import net.minecraft.util.math.BlockPos; public class GoalNear implements Goal, IGoalRenderPos { diff --git a/src/main/java/baritone/pathing/goals/GoalRunAway.java b/src/api/java/baritone/api/pathing/goals/GoalRunAway.java similarity index 96% rename from src/main/java/baritone/pathing/goals/GoalRunAway.java rename to src/api/java/baritone/api/pathing/goals/GoalRunAway.java index 9ca74711..cb7a000e 100644 --- a/src/main/java/baritone/pathing/goals/GoalRunAway.java +++ b/src/api/java/baritone/api/pathing/goals/GoalRunAway.java @@ -15,9 +15,8 @@ * along with Baritone. If not, see . */ -package baritone.pathing.goals; +package baritone.api.pathing.goals; -import baritone.api.pathing.goals.Goal; import net.minecraft.util.math.BlockPos; import java.util.Arrays; diff --git a/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java b/src/api/java/baritone/api/pathing/goals/GoalTwoBlocks.java similarity index 94% rename from src/main/java/baritone/pathing/goals/GoalTwoBlocks.java rename to src/api/java/baritone/api/pathing/goals/GoalTwoBlocks.java index c5036c35..4ed1bf5e 100644 --- a/src/main/java/baritone/pathing/goals/GoalTwoBlocks.java +++ b/src/api/java/baritone/api/pathing/goals/GoalTwoBlocks.java @@ -15,10 +15,9 @@ * along with Baritone. If not, see . */ -package baritone.pathing.goals; +package baritone.api.pathing.goals; -import baritone.api.pathing.goals.Goal; -import baritone.utils.interfaces.IGoalRenderPos; +import baritone.api.utils.interfaces.IGoalRenderPos; import net.minecraft.util.math.BlockPos; /** diff --git a/src/main/java/baritone/pathing/goals/GoalXZ.java b/src/api/java/baritone/api/pathing/goals/GoalXZ.java similarity index 90% rename from src/main/java/baritone/pathing/goals/GoalXZ.java rename to src/api/java/baritone/api/pathing/goals/GoalXZ.java index 8053ee04..636c649f 100644 --- a/src/main/java/baritone/pathing/goals/GoalXZ.java +++ b/src/api/java/baritone/api/pathing/goals/GoalXZ.java @@ -15,11 +15,9 @@ * along with Baritone. If not, see . */ -package baritone.pathing.goals; +package baritone.api.pathing.goals; -import baritone.Baritone; -import baritone.api.pathing.goals.Goal; -import baritone.utils.Utils; +import baritone.api.BaritoneAPI; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; @@ -82,11 +80,11 @@ public class GoalXZ implements Goal { diagonal = z; } diagonal *= SQRT_2; - return (diagonal + straight) * Baritone.settings().costHeuristic.get(); // big TODO tune + return (diagonal + straight) * BaritoneAPI.getSettings().costHeuristic.get(); // big TODO tune } public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) { - float theta = (float) Utils.degToRad(yaw); + float theta = (float) Math.toRadians(yaw); double x = origin.x - MathHelper.sin(theta) * distance; double z = origin.z + MathHelper.cos(theta) * distance; return new GoalXZ((int) x, (int) z); diff --git a/src/main/java/baritone/pathing/goals/GoalYLevel.java b/src/api/java/baritone/api/pathing/goals/GoalYLevel.java similarity index 81% rename from src/main/java/baritone/pathing/goals/GoalYLevel.java rename to src/api/java/baritone/api/pathing/goals/GoalYLevel.java index fa4af522..d9ae4597 100644 --- a/src/main/java/baritone/pathing/goals/GoalYLevel.java +++ b/src/api/java/baritone/api/pathing/goals/GoalYLevel.java @@ -15,10 +15,9 @@ * along with Baritone. If not, see . */ -package baritone.pathing.goals; +package baritone.api.pathing.goals; -import baritone.api.pathing.goals.Goal; -import baritone.pathing.movement.ActionCostsButOnlyTheOnesThatMakeMickeyDieInside; +import baritone.api.pathing.movement.ActionCostsButOnlyTheOnesThatMakeMickeyDieInside; /** * Useful for mining (getting to diamond / iron level) @@ -49,11 +48,11 @@ public class GoalYLevel implements Goal, ActionCostsButOnlyTheOnesThatMakeMickey public static double calculate(int goalY, int currentY) { if (currentY > goalY) { // need to descend - return FALL_N_BLOCKS_COST[2] / 2 * (currentY - goalY); + return ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.FALL_N_BLOCKS_COST[2] / 2 * (currentY - goalY); } if (currentY < goalY) { // need to ascend - return (goalY - currentY) * JUMP_ONE_BLOCK_COST; + return (goalY - currentY) * ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.JUMP_ONE_BLOCK_COST; } return 0; } diff --git a/src/main/java/baritone/pathing/movement/ActionCosts.java b/src/api/java/baritone/api/pathing/movement/ActionCosts.java similarity index 93% rename from src/main/java/baritone/pathing/movement/ActionCosts.java rename to src/api/java/baritone/api/pathing/movement/ActionCosts.java index cbfcd810..e31682aa 100644 --- a/src/main/java/baritone/pathing/movement/ActionCosts.java +++ b/src/api/java/baritone/api/pathing/movement/ActionCosts.java @@ -15,7 +15,9 @@ * along with Baritone. If not, see . */ -package baritone.pathing.movement; +package baritone.api.pathing.movement; + +import baritone.api.pathing.movement.ActionCostsButOnlyTheOnesThatMakeMickeyDieInside; public interface ActionCosts extends ActionCostsButOnlyTheOnesThatMakeMickeyDieInside { diff --git a/src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java b/src/api/java/baritone/api/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java similarity index 98% rename from src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java rename to src/api/java/baritone/api/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java index fe589d6f..e492b21c 100644 --- a/src/main/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java +++ b/src/api/java/baritone/api/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.java @@ -15,7 +15,7 @@ * along with Baritone. If not, see . */ -package baritone.pathing.movement; +package baritone.api.pathing.movement; public interface ActionCostsButOnlyTheOnesThatMakeMickeyDieInside { double[] FALL_N_BLOCKS_COST = generateFallNBlocksCost(); diff --git a/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java b/src/api/java/baritone/api/utils/interfaces/IGoalRenderPos.java similarity index 95% rename from src/main/java/baritone/utils/interfaces/IGoalRenderPos.java rename to src/api/java/baritone/api/utils/interfaces/IGoalRenderPos.java index aa4ffa78..5bbbc007 100644 --- a/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java +++ b/src/api/java/baritone/api/utils/interfaces/IGoalRenderPos.java @@ -15,7 +15,7 @@ * along with Baritone. If not, see . */ -package baritone.utils.interfaces; +package baritone.api.utils.interfaces; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/baritone/behavior/FollowBehavior.java b/src/main/java/baritone/behavior/FollowBehavior.java index 7fd76675..83ca5135 100644 --- a/src/main/java/baritone/behavior/FollowBehavior.java +++ b/src/main/java/baritone/behavior/FollowBehavior.java @@ -20,8 +20,8 @@ package baritone.behavior; import baritone.Baritone; import baritone.api.behavior.IFollowBehavior; import baritone.api.event.events.TickEvent; -import baritone.pathing.goals.GoalNear; -import baritone.pathing.goals.GoalXZ; +import baritone.api.pathing.goals.GoalNear; +import baritone.api.pathing.goals.GoalXZ; import baritone.utils.Helper; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 2de6167a..0f1a6b34 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -26,9 +26,9 @@ import baritone.cache.CachedChunk; import baritone.cache.ChunkPacker; import baritone.cache.WorldProvider; import baritone.cache.WorldScanner; -import baritone.pathing.goals.GoalBlock; -import baritone.pathing.goals.GoalComposite; -import baritone.pathing.goals.GoalTwoBlocks; +import baritone.api.pathing.goals.GoalBlock; +import baritone.api.pathing.goals.GoalComposite; +import baritone.api.pathing.goals.GoalTwoBlocks; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; import net.minecraft.block.Block; diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 660ddca1..377af7f3 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -27,7 +27,7 @@ import baritone.api.pathing.goals.Goal; import baritone.pathing.calc.AStarPathFinder; import baritone.pathing.calc.AbstractNodeCostSearch; import baritone.pathing.calc.IPathFinder; -import baritone.pathing.goals.GoalXZ; +import baritone.api.pathing.goals.GoalXZ; import baritone.pathing.movement.MovementHelper; import baritone.pathing.path.IPath; import baritone.pathing.path.PathExecutor; @@ -35,7 +35,7 @@ import baritone.utils.BlockBreakHelper; import baritone.utils.BlockStateInterface; import baritone.utils.Helper; import baritone.utils.PathRenderer; -import baritone.utils.interfaces.IGoalRenderPos; +import baritone.api.utils.interfaces.IGoalRenderPos; import baritone.utils.pathing.BetterBlockPos; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index 43207ee3..bdeb2563 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -20,7 +20,7 @@ package baritone.pathing.calc; import baritone.Baritone; import baritone.api.pathing.goals.Goal; import baritone.pathing.calc.openset.BinaryHeapOpenSet; -import baritone.pathing.movement.ActionCosts; +import baritone.api.pathing.movement.ActionCosts; import baritone.pathing.movement.CalculationContext; import baritone.pathing.movement.Moves; import baritone.pathing.path.IPath; diff --git a/src/main/java/baritone/pathing/calc/PathNode.java b/src/main/java/baritone/pathing/calc/PathNode.java index 6d4142aa..8e42d564 100644 --- a/src/main/java/baritone/pathing/calc/PathNode.java +++ b/src/main/java/baritone/pathing/calc/PathNode.java @@ -18,7 +18,7 @@ package baritone.pathing.calc; import baritone.api.pathing.goals.Goal; -import baritone.pathing.movement.ActionCosts; +import baritone.api.pathing.movement.ActionCosts; /** * A node in the path, containing the cost and steps to get to it. diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index e173e766..1b53011a 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -18,6 +18,7 @@ package baritone.pathing.movement; import baritone.Baritone; +import baritone.api.pathing.movement.ActionCosts; import baritone.api.utils.Rotation; import baritone.behavior.LookBehaviorUtils; import baritone.pathing.movement.MovementState.MovementTarget; diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 144b787f..e8e74c7d 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -19,6 +19,7 @@ package baritone.pathing.path; import baritone.Baritone; import baritone.api.event.events.TickEvent; +import baritone.api.pathing.movement.ActionCosts; import baritone.pathing.movement.*; import baritone.pathing.movement.movements.*; import baritone.utils.BlockStateInterface; diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index bd1ac0f1..ee58fd60 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -21,7 +21,8 @@ import baritone.Baritone; import baritone.api.Settings; import baritone.api.cache.IWaypoint; import baritone.api.event.events.ChatEvent; -import baritone.api.pathing.goals.Goal; +import baritone.api.pathing.goals.*; +import baritone.api.pathing.movement.ActionCosts; import baritone.behavior.Behavior; import baritone.behavior.FollowBehavior; import baritone.behavior.MineBehavior; @@ -30,7 +31,6 @@ import baritone.cache.ChunkPacker; import baritone.cache.Waypoint; import baritone.cache.WorldProvider; import baritone.pathing.calc.AbstractNodeCostSearch; -import baritone.pathing.goals.*; import baritone.pathing.movement.*; import net.minecraft.block.Block; import net.minecraft.client.multiplayer.ChunkProviderClient; diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index e5c35650..a66bc0ae 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -19,11 +19,11 @@ package baritone.utils; import baritone.Baritone; import baritone.api.pathing.goals.Goal; -import baritone.pathing.goals.GoalComposite; -import baritone.pathing.goals.GoalTwoBlocks; -import baritone.pathing.goals.GoalXZ; +import baritone.api.pathing.goals.GoalComposite; +import baritone.api.pathing.goals.GoalTwoBlocks; +import baritone.api.pathing.goals.GoalXZ; import baritone.pathing.path.IPath; -import baritone.utils.interfaces.IGoalRenderPos; +import baritone.api.utils.interfaces.IGoalRenderPos; import baritone.utils.pathing.BetterBlockPos; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; diff --git a/src/main/java/baritone/utils/pathing/MoveResult.java b/src/main/java/baritone/utils/pathing/MoveResult.java index 1ec96f76..8478a617 100644 --- a/src/main/java/baritone/utils/pathing/MoveResult.java +++ b/src/main/java/baritone/utils/pathing/MoveResult.java @@ -17,7 +17,7 @@ package baritone.utils.pathing; -import static baritone.pathing.movement.ActionCosts.COST_INF; +import static baritone.api.pathing.movement.ActionCosts.COST_INF; /** * The result of a calculated movement, with destination x, y, z, and the cost of performing the movement diff --git a/src/test/java/baritone/pathing/goals/GoalGetToBlockTest.java b/src/test/java/baritone/pathing/goals/GoalGetToBlockTest.java index 2fa7f954..6234e050 100644 --- a/src/test/java/baritone/pathing/goals/GoalGetToBlockTest.java +++ b/src/test/java/baritone/pathing/goals/GoalGetToBlockTest.java @@ -17,6 +17,7 @@ package baritone.pathing.goals; +import baritone.api.pathing.goals.GoalGetToBlock; import net.minecraft.util.math.BlockPos; import org.junit.Test; diff --git a/src/test/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInsideTest.java b/src/test/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInsideTest.java index 15291bbe..bbc640fb 100644 --- a/src/test/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInsideTest.java +++ b/src/test/java/baritone/pathing/movement/ActionCostsButOnlyTheOnesThatMakeMickeyDieInsideTest.java @@ -19,7 +19,7 @@ package baritone.pathing.movement; import org.junit.Test; -import static baritone.pathing.movement.ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.*; +import static baritone.api.pathing.movement.ActionCostsButOnlyTheOnesThatMakeMickeyDieInside.*; import static org.junit.Assert.assertEquals; public class ActionCostsButOnlyTheOnesThatMakeMickeyDieInsideTest {