Merge branch 'master' into builder
This commit is contained in:
commit
306bd18a40
@ -9,6 +9,7 @@ install:
|
|||||||
- travis_retry docker build -t cabaletta/baritone .
|
- travis_retry docker build -t cabaletta/baritone .
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- docker run --rm cabaletta/baritone ./gradlew javadoc
|
||||||
- docker run --name baritone cabaletta/baritone /bin/sh -c "set -e; /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 128x128x24 -ac +extension GLX +render; DISPLAY=:99 BARITONE_AUTO_TEST=true ./gradlew runClient"
|
- docker run --name baritone cabaletta/baritone /bin/sh -c "set -e; /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 128x128x24 -ac +extension GLX +render; DISPLAY=:99 BARITONE_AUTO_TEST=true ./gradlew runClient"
|
||||||
- docker cp baritone:/code/dist dist
|
- docker cp baritone:/code/dist dist
|
||||||
- ls dist
|
- ls dist
|
||||||
|
@ -20,9 +20,6 @@
|
|||||||
[![WWE integration](https://img.shields.io/badge/WWE%20%22integration%22-v1.0.0%3F%3F%20smh%20license%20violations-orange.svg)](https://wweclient.com/)
|
[![WWE integration](https://img.shields.io/badge/WWE%20%22integration%22-v1.0.0%3F%3F%20smh%20license%20violations-orange.svg)](https://wweclient.com/)
|
||||||
[![Future integration](https://img.shields.io/badge/Future%20integration-Soon™%3F%3F%3F-red.svg)](https://futureclient.net/)
|
[![Future integration](https://img.shields.io/badge/Future%20integration-Soon™%3F%3F%3F-red.svg)](https://futureclient.net/)
|
||||||
[![ForgeHax integration](https://img.shields.io/badge/ForgeHax%20integration-Soon™-red.svg)](https://github.com/fr1kin/ForgeHax)
|
[![ForgeHax integration](https://img.shields.io/badge/ForgeHax%20integration-Soon™-red.svg)](https://github.com/fr1kin/ForgeHax)
|
||||||
[![forthebadge](https://forthebadge.com/images/badges/built-with-swag.svg)](http://forthebadge.com)
|
|
||||||
[![forthebadge](https://forthebadge.com/images/badges/mom-made-pizza-rolls.svg)](http://forthebadge.com)
|
|
||||||
|
|
||||||
|
|
||||||
A Minecraft pathfinder bot.
|
A Minecraft pathfinder bot.
|
||||||
|
|
||||||
@ -39,6 +36,8 @@ Here are some links to help to get started:
|
|||||||
|
|
||||||
- [Installation](INSTALL.md)
|
- [Installation](INSTALL.md)
|
||||||
|
|
||||||
|
- [Javadocs](https://baritone.leijurv.com/)
|
||||||
|
|
||||||
# Chat control
|
# Chat control
|
||||||
[Defined Here](src/main/java/baritone/utils/ExampleBaritoneControl.java)
|
[Defined Here](src/main/java/baritone/utils/ExampleBaritoneControl.java)
|
||||||
|
|
||||||
@ -48,7 +47,7 @@ Quick start example: `thisway 1000` or `goal 70` to set the goal, `path` to actu
|
|||||||
|
|
||||||
```
|
```
|
||||||
BaritoneAPI.getSettings().allowSprint.value = true;
|
BaritoneAPI.getSettings().allowSprint.value = true;
|
||||||
BaritoneAPI.getSettings().pathTimeoutMS.value = 2000L;
|
BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L;
|
||||||
|
|
||||||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ(10000, 20000));
|
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ(10000, 20000));
|
||||||
```
|
```
|
||||||
|
@ -99,8 +99,10 @@ mixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
source = sourceSets.api.allJava
|
options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error
|
||||||
classpath = sourceSets.api.compileClasspath
|
options.linkSource true
|
||||||
|
source += sourceSets.api.allJava
|
||||||
|
classpath += sourceSets.api.compileClasspath
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
@ -33,67 +33,67 @@ import java.util.function.Consumer;
|
|||||||
*
|
*
|
||||||
* @author leijurv
|
* @author leijurv
|
||||||
*/
|
*/
|
||||||
public class Settings {
|
public final class Settings {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow Baritone to break blocks
|
* Allow Baritone to break blocks
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowBreak = new Setting<>(true);
|
public final Setting<Boolean> allowBreak = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow Baritone to sprint
|
* Allow Baritone to sprint
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowSprint = new Setting<>(true);
|
public final Setting<Boolean> allowSprint = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow Baritone to place blocks
|
* Allow Baritone to place blocks
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowPlace = new Setting<>(true);
|
public final Setting<Boolean> allowPlace = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow Baritone to move items in your inventory to your hotbar
|
* Allow Baritone to move items in your inventory to your hotbar
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowInventory = new Setting<>(false);
|
public final Setting<Boolean> allowInventory = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It doesn't actually take twenty ticks to place a block, this cost is so high
|
* It doesn't actually take twenty ticks to place a block, this cost is so high
|
||||||
* because we want to generally conserve blocks which might be limited
|
* because we want to generally conserve blocks which might be limited
|
||||||
*/
|
*/
|
||||||
public Setting<Double> blockPlacementPenalty = new Setting<>(20D);
|
public final Setting<Double> blockPlacementPenalty = new Setting<>(20D);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is just a tiebreaker to make it less likely to break blocks if it can avoid it.
|
* This is just a tiebreaker to make it less likely to break blocks if it can avoid it.
|
||||||
* For example, fire has a break cost of 0, this makes it nonzero, so all else being equal
|
* For example, fire has a break cost of 0, this makes it nonzero, so all else being equal
|
||||||
* it will take an otherwise equivalent route that doesn't require it to put out fire.
|
* it will take an otherwise equivalent route that doesn't require it to put out fire.
|
||||||
*/
|
*/
|
||||||
public Setting<Double> blockBreakAdditionalPenalty = new Setting<>(2D);
|
public final Setting<Double> blockBreakAdditionalPenalty = new Setting<>(2D);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional penalty for hitting the space bar (ascend, pillar, or parkour) beacuse it uses hunger
|
* Additional penalty for hitting the space bar (ascend, pillar, or parkour) because it uses hunger
|
||||||
*/
|
*/
|
||||||
public Setting<Double> jumpPenalty = new Setting<>(2D);
|
public final Setting<Double> jumpPenalty = new Setting<>(2D);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Walking on water uses up hunger really quick, so penalize it
|
* Walking on water uses up hunger really quick, so penalize it
|
||||||
*/
|
*/
|
||||||
public Setting<Double> walkOnWaterOnePenalty = new Setting<>(5D);
|
public final Setting<Double> walkOnWaterOnePenalty = new Setting<>(5D);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow Baritone to fall arbitrary distances and place a water bucket beneath it.
|
* Allow Baritone to fall arbitrary distances and place a water bucket beneath it.
|
||||||
* Reliability: questionable.
|
* Reliability: questionable.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowWaterBucketFall = new Setting<>(true);
|
public final Setting<Boolean> allowWaterBucketFall = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow Baritone to assume it can walk on still water just like any other block.
|
* Allow Baritone to assume it can walk on still water just like any other block.
|
||||||
* This functionality is assumed to be provided by a separate library that might have imported Baritone.
|
* This functionality is assumed to be provided by a separate library that might have imported Baritone.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> assumeWalkOnWater = new Setting<>(false);
|
public final Setting<Boolean> assumeWalkOnWater = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assume step functionality; don't jump on an Ascend.
|
* Assume step functionality; don't jump on an Ascend.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> assumeStep = new Setting<>(false);
|
public final Setting<Boolean> assumeStep = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assume safe walk functionality; don't sneak on a backplace traverse.
|
* Assume safe walk functionality; don't sneak on a backplace traverse.
|
||||||
@ -102,14 +102,14 @@ public class Settings {
|
|||||||
* it won't sneak right click, it'll just right click, which means it'll open the chest instead of placing
|
* 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.
|
* against it. That's why this defaults to off.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> assumeSafeWalk = new Setting<>(false);
|
public final Setting<Boolean> assumeSafeWalk = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If true, parkour is allowed to make jumps when standing on blocks at the maximum height, so player feet is y=256
|
* If true, parkour is allowed to make jumps when standing on blocks at the maximum height, so player feet is y=256
|
||||||
* <p>
|
* <p>
|
||||||
* Defaults to false because this fails on NCP
|
* Defaults to false because this fails on constantiam
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowJumpAt256 = new Setting<>(false);
|
public final Setting<Boolean> allowJumpAt256 = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow descending diagonally
|
* Allow descending diagonally
|
||||||
@ -118,12 +118,12 @@ public class Settings {
|
|||||||
* <p>
|
* <p>
|
||||||
* For a generic "take some risks" mode I'd turn on this one, parkour, and parkour place.
|
* For a generic "take some risks" mode I'd turn on this one, parkour, and parkour place.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowDiagonalDescend = new Setting<>(false);
|
public final Setting<Boolean> allowDiagonalDescend = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blocks that Baritone is allowed to place (as throwaway, for sneak bridging, pillaring, etc.)
|
* Blocks that Baritone is allowed to place (as throwaway, for sneak bridging, pillaring, etc.)
|
||||||
*/
|
*/
|
||||||
public Setting<List<Item>> acceptableThrowawayItems = new Setting<>(new ArrayList<>(Arrays.asList(
|
public final Setting<List<Item>> acceptableThrowawayItems = new Setting<>(new ArrayList<>(Arrays.asList(
|
||||||
Item.getItemFromBlock(Blocks.DIRT),
|
Item.getItemFromBlock(Blocks.DIRT),
|
||||||
Item.getItemFromBlock(Blocks.COBBLESTONE),
|
Item.getItemFromBlock(Blocks.COBBLESTONE),
|
||||||
Item.getItemFromBlock(Blocks.NETHERRACK)
|
Item.getItemFromBlock(Blocks.NETHERRACK)
|
||||||
@ -132,31 +132,37 @@ public class Settings {
|
|||||||
/**
|
/**
|
||||||
* Enables some more advanced vine features. They're honestly just gimmicks and won't ever be needed in real
|
* Enables some more advanced vine features. They're honestly just gimmicks and won't ever be needed in real
|
||||||
* pathing scenarios. And they can cause Baritone to get trapped indefinitely in a strange scenario.
|
* pathing scenarios. And they can cause Baritone to get trapped indefinitely in a strange scenario.
|
||||||
|
* <p>
|
||||||
|
* Never turn this on lol
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowVines = new Setting<>(false);
|
public final Setting<Boolean> allowVines = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Slab behavior is complicated, disable this for higher path reliability. Leave enabled if you have bottom slabs
|
* Slab behavior is complicated, disable this for higher path reliability. Leave enabled if you have bottom slabs
|
||||||
* everywhere in your base.
|
* everywhere in your base.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowWalkOnBottomSlab = new Setting<>(true);
|
public final Setting<Boolean> allowWalkOnBottomSlab = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You know what it is
|
* You know what it is
|
||||||
* <p>
|
* <p>
|
||||||
* But it's very unreliable and falls off when cornering like all the time so.
|
* But it's very unreliable and falls off when cornering like all the time so.
|
||||||
|
* <p>
|
||||||
|
* It also overshoots the landing pretty much always (making contact with the next block over), so be careful
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowParkour = new Setting<>(false);
|
public final Setting<Boolean> allowParkour = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like parkour, but even more unreliable!
|
* Actually pretty reliable.
|
||||||
|
* <p>
|
||||||
|
* Doesn't make it any more dangerous compared to just normal allowParkour th
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowParkourPlace = new Setting<>(false);
|
public final Setting<Boolean> allowParkourPlace = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For example, if you have Mining Fatigue or Haste, adjust the costs of breaking blocks accordingly.
|
* For example, if you have Mining Fatigue or Haste, adjust the costs of breaking blocks accordingly.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> considerPotionEffects = new Setting<>(true);
|
public final Setting<Boolean> considerPotionEffects = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the big A* setting.
|
* This is the big A* setting.
|
||||||
@ -173,131 +179,137 @@ public class Settings {
|
|||||||
* <p>
|
* <p>
|
||||||
* Finding the optimal path is worth it, so it's the default.
|
* Finding the optimal path is worth it, so it's the default.
|
||||||
*/
|
*/
|
||||||
public Setting<Double> costHeuristic = new Setting<>(3.563);
|
public final Setting<Double> costHeuristic = new Setting<>(3.563);
|
||||||
|
|
||||||
// a bunch of obscure internal A* settings that you probably don't want to change
|
// a bunch of obscure internal A* settings that you probably don't want to change
|
||||||
/**
|
/**
|
||||||
* The maximum number of times it will fetch outside loaded or cached chunks before assuming that
|
* The maximum number of times it will fetch outside loaded or cached chunks before assuming that
|
||||||
* pathing has reached the end of the known area, and should therefore stop.
|
* pathing has reached the end of the known area, and should therefore stop.
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> pathingMaxChunkBorderFetch = new Setting<>(50);
|
public final Setting<Integer> pathingMaxChunkBorderFetch = new Setting<>(50);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set to 1.0 to effectively disable this feature
|
* Set to 1.0 to effectively disable this feature
|
||||||
*
|
*
|
||||||
* @see <a href="https://github.com/cabaletta/baritone/issues/18">Issue #18</a>
|
* @see <a href="https://github.com/cabaletta/baritone/issues/18">Issue #18</a>
|
||||||
*/
|
*/
|
||||||
public Setting<Double> backtrackCostFavoringCoefficient = new Setting<>(0.5);
|
public final Setting<Double> backtrackCostFavoringCoefficient = new Setting<>(0.5);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle the following 4 settings
|
* Toggle the following 4 settings
|
||||||
* <p>
|
* <p>
|
||||||
* They have a noticable performance impact, so they default off
|
* They have a noticeable performance impact, so they default off
|
||||||
|
* <p>
|
||||||
|
* Specifically, building up the avoidance map on the main thread before pathing starts actually takes a noticeable
|
||||||
|
* amount of time, especially when there are a lot of mobs around, and your game jitters for like 200ms while doing so
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> avoidance = new Setting<>(false);
|
public final Setting<Boolean> avoidance = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set to 1.0 to effectively disable this feature
|
* Set to 1.0 to effectively disable this feature
|
||||||
* <p>
|
* <p>
|
||||||
* Set below 1.0 to go out of your way to walk near mob spawners
|
* Set below 1.0 to go out of your way to walk near mob spawners
|
||||||
*/
|
*/
|
||||||
public Setting<Double> mobSpawnerAvoidanceCoefficient = new Setting<>(2.0);
|
public final Setting<Double> mobSpawnerAvoidanceCoefficient = new Setting<>(2.0);
|
||||||
|
|
||||||
public Setting<Integer> mobSpawnerAvoidanceRadius = new Setting<>(16);
|
public final Setting<Integer> mobSpawnerAvoidanceRadius = new Setting<>(16);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set to 1.0 to effectively disable this feature
|
* Set to 1.0 to effectively disable this feature
|
||||||
* <p>
|
* <p>
|
||||||
* Set below 1.0 to go out of your way to walk near mobs
|
* Set below 1.0 to go out of your way to walk near mobs
|
||||||
*/
|
*/
|
||||||
public Setting<Double> mobAvoidanceCoefficient = new Setting<>(1.5);
|
public final Setting<Double> mobAvoidanceCoefficient = new Setting<>(1.5);
|
||||||
|
|
||||||
public Setting<Integer> mobAvoidanceRadius = new Setting<>(8);
|
public final Setting<Integer> mobAvoidanceRadius = new Setting<>(8);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When running a goto towards a container block (chest, ender chest, furnace, etc),
|
* When running a goto towards a container block (chest, ender chest, furnace, etc),
|
||||||
* right click and open it once you arrive.
|
* right click and open it once you arrive.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> rightClickContainerOnArrival = new Setting<>(true);
|
public final Setting<Boolean> rightClickContainerOnArrival = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When running a goto towards a nether portal block, walk all the way into the portal
|
* When running a goto towards a nether portal block, walk all the way into the portal
|
||||||
* instead of stopping one block before.
|
* instead of stopping one block before.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> enterPortal = new Setting<>(true);
|
public final Setting<Boolean> enterPortal = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Don't repropagate cost improvements below 0.01 ticks. They're all just floating point inaccuracies,
|
* Don't repropagate cost improvements below 0.01 ticks. They're all just floating point inaccuracies,
|
||||||
* and there's no point.
|
* and there's no point.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> minimumImprovementRepropagation = new Setting<>(true);
|
public final Setting<Boolean> minimumImprovementRepropagation = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After calculating a path (potentially through cached chunks), artificially cut it off to just the part that is
|
* 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.
|
* entirely within currently loaded chunks. Improves path safety because cached chunks are heavily simplified.
|
||||||
|
* <p>
|
||||||
|
* This is much safer to leave off now, and makes pathing more efficient. More explanation in the issue.
|
||||||
*
|
*
|
||||||
* @see <a href="https://github.com/cabaletta/baritone/issues/144">Issue #144</a>
|
* @see <a href="https://github.com/cabaletta/baritone/issues/114">Issue #114</a>
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> cutoffAtLoadBoundary = new Setting<>(false);
|
public final Setting<Boolean> cutoffAtLoadBoundary = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a movement's cost increases by more than this amount between calculation and execution (due to changes
|
* 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
|
* in the environment / world), cancel and recalculate
|
||||||
*/
|
*/
|
||||||
public Setting<Double> maxCostIncrease = new Setting<>(10D);
|
public final Setting<Double> maxCostIncrease = new Setting<>(10D);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop 5 movements before anything that made the path COST_INF.
|
* 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
|
* For example, if lava has spread across the path, don't walk right up to it then recalculate, it might
|
||||||
* still be spreading lol
|
* still be spreading lol
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> costVerificationLookahead = new Setting<>(5);
|
public final Setting<Integer> costVerificationLookahead = new Setting<>(5);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static cutoff factor. 0.9 means cut off the last 10% of all paths, regardless of chunk load state
|
* Static cutoff factor. 0.9 means cut off the last 10% of all paths, regardless of chunk load state
|
||||||
*/
|
*/
|
||||||
public Setting<Double> pathCutoffFactor = new Setting<>(0.9);
|
public final Setting<Double> pathCutoffFactor = new Setting<>(0.9);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only apply static cutoff for paths of at least this length (in terms of number of movements)
|
* Only apply static cutoff for paths of at least this length (in terms of number of movements)
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> pathCutoffMinimumLength = new Setting<>(30);
|
public final Setting<Integer> pathCutoffMinimumLength = new Setting<>(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start planning the next path once the remaining movements tick estimates sum up to less than this value
|
* Start planning the next path once the remaining movements tick estimates sum up to less than this value
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> planningTickLookAhead = new Setting<>(150);
|
public final Setting<Integer> planningTickLookAhead = new Setting<>(150);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default size of the Long2ObjectOpenHashMap used in pathing
|
* Default size of the Long2ObjectOpenHashMap used in pathing
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> pathingMapDefaultSize = new Setting<>(1024);
|
public final Setting<Integer> pathingMapDefaultSize = new Setting<>(1024);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load factor coefficient for the Long2ObjectOpenHashMap used in pathing
|
* Load factor coefficient for the Long2ObjectOpenHashMap used in pathing
|
||||||
* <p>
|
* <p>
|
||||||
* Decrease for faster map operations, but higher memory usage
|
* Decrease for faster map operations, but higher memory usage
|
||||||
*/
|
*/
|
||||||
public Setting<Float> pathingMapLoadFactor = new Setting<>(0.75f);
|
public final Setting<Float> pathingMapLoadFactor = new Setting<>(0.75f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How far are you allowed to fall onto solid ground (without a water bucket)?
|
* How far are you allowed to fall onto solid ground (without a water bucket)?
|
||||||
* 3 won't deal any damage. But if you just want to get down the mountain quickly and you have
|
* 3 won't deal any damage. But if you just want to get down the mountain quickly and you have
|
||||||
* Feather Falling IV, you might set it a bit higher, like 4 or 5.
|
* Feather Falling IV, you might set it a bit higher, like 4 or 5.
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> maxFallHeightNoWater = new Setting<>(3);
|
public final Setting<Integer> maxFallHeightNoWater = new Setting<>(3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How far are you allowed to fall onto solid ground (with a water bucket)?
|
* How far are you allowed to fall onto solid ground (with a water bucket)?
|
||||||
* It's not that reliable, so I've set it below what would kill an unarmored player (23)
|
* It's not that reliable, so I've set it below what would kill an unarmored player (23)
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> maxFallHeightBucket = new Setting<>(20);
|
public final Setting<Integer> maxFallHeightBucket = new Setting<>(20);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is it okay to sprint through a descend followed by a diagonal?
|
* Is it okay to sprint through a descend followed by a diagonal?
|
||||||
* The player overshoots the landing, but not enough to fall off. And the diagonal ensures that there isn't
|
* The player overshoots the landing, but not enough to fall off. And the diagonal ensures that there isn't
|
||||||
* lava or anything that's !canWalkInto in that space, so it's technically safe, just a little sketchy.
|
* lava or anything that's !canWalkInto in that space, so it's technically safe, just a little sketchy.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> allowOvershootDiagonalDescend = new Setting<>(true);
|
public final Setting<Boolean> allowOvershootDiagonalDescend = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If your goal is a GoalBlock in an unloaded chunk, assume it's far enough away that the Y coord
|
* If your goal is a GoalBlock in an unloaded chunk, assume it's far enough away that the Y coord
|
||||||
@ -306,131 +318,133 @@ public class Settings {
|
|||||||
* of considering the Y coord. The reasoning is that if your X and Z are 10,000 blocks away,
|
* of considering the Y coord. The reasoning is that if your X and Z are 10,000 blocks away,
|
||||||
* your Y coordinate's accuracy doesn't matter at all until you get much much closer.
|
* your Y coordinate's accuracy doesn't matter at all until you get much much closer.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> simplifyUnloadedYCoord = new Setting<>(true);
|
public final Setting<Boolean> simplifyUnloadedYCoord = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a movement takes this many ticks more than its initial cost estimate, cancel it
|
* If a movement takes this many ticks more than its initial cost estimate, cancel it
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> movementTimeoutTicks = new Setting<>(100);
|
public final Setting<Integer> movementTimeoutTicks = new Setting<>(100);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pathing ends after this amount of time, but only if a path has been found
|
* Pathing ends after this amount of time, but only if a path has been found
|
||||||
* <p>
|
* <p>
|
||||||
* If no valid path (length above the minimum) has been found, pathing continues up until the failure timeout
|
* If no valid path (length above the minimum) has been found, pathing continues up until the failure timeout
|
||||||
*/
|
*/
|
||||||
public Setting<Long> primaryTimeoutMS = new Setting<>(500L);
|
public final Setting<Long> primaryTimeoutMS = new Setting<>(500L);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pathing can never take longer than this, even if that means failing to find any path at all
|
* Pathing can never take longer than this, even if that means failing to find any path at all
|
||||||
*/
|
*/
|
||||||
public Setting<Long> failureTimeoutMS = new Setting<>(2000L);
|
public final Setting<Long> failureTimeoutMS = new Setting<>(2000L);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Planning ahead while executing a segment ends after this amount of time, but only if a path has been found
|
* Planning ahead while executing a segment ends after this amount of time, but only if a path has been found
|
||||||
* <p>
|
* <p>
|
||||||
* If no valid path (length above the minimum) has been found, pathing continues up until the failure timeout
|
* If no valid path (length above the minimum) has been found, pathing continues up until the failure timeout
|
||||||
*/
|
*/
|
||||||
public Setting<Long> planAheadPrimaryTimeoutMS = new Setting<>(4000L);
|
public final Setting<Long> planAheadPrimaryTimeoutMS = new Setting<>(4000L);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Planning ahead while executing a segment can never take longer than this, even if that means failing to find any path at all
|
* Planning ahead while executing a segment can never take longer than this, even if that means failing to find any path at all
|
||||||
*/
|
*/
|
||||||
public Setting<Long> planAheadFailureTimeoutMS = new Setting<>(5000L);
|
public final Setting<Long> planAheadFailureTimeoutMS = new Setting<>(5000L);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For debugging, consider nodes much much slower
|
* For debugging, consider nodes much much slower
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> slowPath = new Setting<>(false);
|
public final Setting<Boolean> slowPath = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Milliseconds between each node
|
* Milliseconds between each node
|
||||||
*/
|
*/
|
||||||
public Setting<Long> slowPathTimeDelayMS = new Setting<>(100L);
|
public final Setting<Long> slowPathTimeDelayMS = new Setting<>(100L);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The alternative timeout number when slowPath is on
|
* The alternative timeout number when slowPath is on
|
||||||
*/
|
*/
|
||||||
public Setting<Long> slowPathTimeoutMS = new Setting<>(40000L);
|
public final Setting<Long> slowPathTimeoutMS = new Setting<>(40000L);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The big one. Download all chunks in simplified 2-bit format and save them for better very-long-distance pathing.
|
* The big one. Download all chunks in simplified 2-bit format and save them for better very-long-distance pathing.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> chunkCaching = new Setting<>(true);
|
public final Setting<Boolean> chunkCaching = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On save, delete from RAM any cached regions that are more than 1024 blocks away from the player
|
* On save, delete from RAM any cached regions that are more than 1024 blocks away from the player
|
||||||
* <p>
|
* <p>
|
||||||
* Temporarily disabled, see issue #248
|
* Temporarily disabled
|
||||||
|
*
|
||||||
|
* @see <a href="https://github.com/cabaletta/baritone/issues/248">Issue #248</a>
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> pruneRegionsFromRAM = new Setting<>(false);
|
public final Setting<Boolean> pruneRegionsFromRAM = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print all the debug messages to chat
|
* Print all the debug messages to chat
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> chatDebug = new Setting<>(true);
|
public final Setting<Boolean> chatDebug = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow chat based control of Baritone. Most likely should be disabled when Baritone is imported for use in
|
* Allow chat based control of Baritone. Most likely should be disabled when Baritone is imported for use in
|
||||||
* something else
|
* something else
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> chatControl = new Setting<>(true);
|
public final Setting<Boolean> chatControl = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A second override over chatControl to force it on
|
* A second override over chatControl to force it on
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> removePrefix = new Setting<>(false);
|
public final Setting<Boolean> removePrefix = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the path
|
* Render the path
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> renderPath = new Setting<>(true);
|
public final Setting<Boolean> renderPath = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the goal
|
* Render the goal
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> renderGoal = new Setting<>(true);
|
public final Setting<Boolean> renderGoal = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ignore depth when rendering the goal
|
* Ignore depth when rendering the goal
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> renderGoalIgnoreDepth = new Setting<>(true);
|
public final Setting<Boolean> renderGoalIgnoreDepth = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders X/Z type Goals with the vanilla beacon beam effect. Combining this with
|
* Renders X/Z type Goals with the vanilla beacon beam effect. Combining this with
|
||||||
* {@link #renderGoalIgnoreDepth} will cause strange render clipping.
|
* {@link #renderGoalIgnoreDepth} will cause strange render clipping.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> renderGoalXZBeacon = new Setting<>(false);
|
public final Setting<Boolean> renderGoalXZBeacon = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ignore depth when rendering the selection boxes (to break, to place, to walk into)
|
* Ignore depth when rendering the selection boxes (to break, to place, to walk into)
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> renderSelectionBoxesIgnoreDepth = new Setting<>(true);
|
public final Setting<Boolean> renderSelectionBoxesIgnoreDepth = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ignore depth when rendering the path
|
* Ignore depth when rendering the path
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> renderPathIgnoreDepth = new Setting<>(true);
|
public final Setting<Boolean> renderPathIgnoreDepth = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Line width of the path when rendered, in pixels
|
* Line width of the path when rendered, in pixels
|
||||||
*/
|
*/
|
||||||
public Setting<Float> pathRenderLineWidthPixels = new Setting<>(5F);
|
public final Setting<Float> pathRenderLineWidthPixels = new Setting<>(5F);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Line width of the goal when rendered, in pixels
|
* Line width of the goal when rendered, in pixels
|
||||||
*/
|
*/
|
||||||
public Setting<Float> goalRenderLineWidthPixels = new Setting<>(3F);
|
public final Setting<Float> goalRenderLineWidthPixels = new Setting<>(3F);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start fading out the path at 20 movements ahead, and stop rendering it entirely 30 movements ahead.
|
* Start fading out the path at 20 movements ahead, and stop rendering it entirely 30 movements ahead.
|
||||||
* Improves FPS.
|
* Improves FPS.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> fadePath = new Setting<>(false);
|
public final Setting<Boolean> fadePath = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move without having to force the client-sided rotations
|
* Move without having to force the client-sided rotations
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> freeLook = new Setting<>(true);
|
public final Setting<Boolean> freeLook = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cause some minor behavioral differences to ensure that Baritone works on anticheats.
|
* Will cause some minor behavioral differences to ensure that Baritone works on anticheats.
|
||||||
@ -438,43 +452,43 @@ public class Settings {
|
|||||||
* At the moment this will silently set the player's rotations when using freeLook so you're not sprinting in
|
* At the moment this will silently set the player's rotations when using freeLook so you're not sprinting in
|
||||||
* directions other than forward, which is picken up by more "advanced" anticheats like AAC, but not NCP.
|
* directions other than forward, which is picken up by more "advanced" anticheats like AAC, but not NCP.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> antiCheatCompatibility = new Setting<>(true);
|
public final Setting<Boolean> antiCheatCompatibility = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclusively use cached chunks for pathing
|
* Exclusively use cached chunks for pathing
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> pathThroughCachedOnly = new Setting<>(false);
|
public final Setting<Boolean> pathThroughCachedOnly = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not to use the "#" command prefix
|
* Whether or not to use the "#" command prefix
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> prefix = new Setting<>(false);
|
public final Setting<Boolean> prefix = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Don't stop walking forward when you need to break blocks in your way
|
* Don't stop walking forward when you need to break blocks in your way
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> walkWhileBreaking = new Setting<>(true);
|
public final Setting<Boolean> walkWhileBreaking = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we are more than 500 movements into the current path, discard the oldest segments, as they are no longer useful
|
* If we are more than 300 movements into the current path, discard the oldest segments, as they are no longer useful
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> maxPathHistoryLength = new Setting<>(300);
|
public final Setting<Integer> maxPathHistoryLength = new Setting<>(300);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the current path is too long, cut off this many movements from the beginning.
|
* If the current path is too long, cut off this many movements from the beginning.
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> pathHistoryCutoffAmount = new Setting<>(50);
|
public final Setting<Integer> pathHistoryCutoffAmount = new Setting<>(50);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rescan for the goal once every 5 ticks.
|
* Rescan for the goal once every 5 ticks.
|
||||||
* Set to 0 to disable.
|
* Set to 0 to disable.
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> mineGoalUpdateInterval = new Setting<>(5);
|
public final Setting<Integer> mineGoalUpdateInterval = new Setting<>(5);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While mining, should it also consider dropped items of the correct type as a pathing destination (as well as ore blocks)?
|
* While mining, should it also consider dropped items of the correct type as a pathing destination (as well as ore blocks)?
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> mineScanDroppedItems = new Setting<>(true);
|
public final Setting<Boolean> mineScanDroppedItems = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
@ -489,54 +503,54 @@ public class Settings {
|
|||||||
* <p>
|
* <p>
|
||||||
* Also on cosmic prisons this should be set to true since you don't actually mine the ore it just gets replaced with stone.
|
* 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<Boolean> cancelOnGoalInvalidation = new Setting<>(true);
|
public final Setting<Boolean> cancelOnGoalInvalidation = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The "axis" command (aka GoalAxis) will go to a axis, or diagonal axis, at this Y level.
|
* The "axis" command (aka GoalAxis) will go to a axis, or diagonal axis, at this Y level.
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> axisHeight = new Setting<>(120);
|
public final Setting<Integer> axisHeight = new Setting<>(120);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow MineBehavior to use X-Ray to see where the ores are. Turn this option off to force it to mine "legit"
|
* Disallow MineBehavior from using X-Ray to see where the ores are. Turn this option on to force it to mine "legit"
|
||||||
* where it will only mine an ore once it can actually see it, so it won't do or know anything that a normal player
|
* where it will only mine an ore once it can actually see it, so it won't do or know anything that a normal player
|
||||||
* couldn't. If you don't want it to look like you're X-Raying, turn this off
|
* couldn't. If you don't want it to look like you're X-Raying, turn this on
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> legitMine = new Setting<>(false);
|
public final Setting<Boolean> legitMine = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What Y level to go to for legit strip mining
|
* What Y level to go to for legit strip mining
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> legitMineYLevel = new Setting<>(11);
|
public final Setting<Integer> legitMineYLevel = new Setting<>(11);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When mining block of a certain type, try to mine two at once instead of one.
|
* 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 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
|
* If the block below is also a goal block, set GoalBlock to the position one down instead of GoalTwoBlocks
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> forceInternalMining = new Setting<>(true);
|
public final Setting<Boolean> forceInternalMining = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modification to the previous setting, only has effect if forceInternalMining is 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.
|
* If true, only apply the previous setting if the block adjacent to the goal isn't air.
|
||||||
*/
|
*/
|
||||||
public Setting<Boolean> internalMiningAirException = new Setting<>(true);
|
public final Setting<Boolean> internalMiningAirException = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actual GoalNear is set this distance away from the entity you're following
|
* The actual GoalNear is set this distance away from the entity you're following
|
||||||
* <p>
|
* <p>
|
||||||
* For example, set followOffsetDistance to 5 and followRadius to 0 to always stay precisely 5 blocks north of your follow target.
|
* For example, set followOffsetDistance to 5 and followRadius to 0 to always stay precisely 5 blocks north of your follow target.
|
||||||
*/
|
*/
|
||||||
public Setting<Double> followOffsetDistance = new Setting<>(0D);
|
public final Setting<Double> followOffsetDistance = new Setting<>(0D);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The actual GoalNear is set in this direction from the entity you're following. This value is in degrees.
|
* The actual GoalNear is set in this direction from the entity you're following. This value is in degrees.
|
||||||
*/
|
*/
|
||||||
public Setting<Float> followOffsetDirection = new Setting<>(0F);
|
public final Setting<Float> followOffsetDirection = new Setting<>(0F);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The radius (for the GoalNear) of how close to your target position you actually have to be
|
* The radius (for the GoalNear) of how close to your target position you actually have to be
|
||||||
*/
|
*/
|
||||||
public Setting<Integer> followRadius = new Setting<>(3);
|
public final Setting<Integer> followRadius = new Setting<>(3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached chunks (regardless of if they're in RAM or saved to disk) expire and are deleted after this number of seconds
|
* Cached chunks (regardless of if they're in RAM or saved to disk) expire and are deleted after this number of seconds
|
||||||
@ -558,54 +572,55 @@ public class Settings {
|
|||||||
* has to build up that cache from scratch. But after it's gone through an area just once, the next time will have zero
|
* has to build up that cache from scratch. But after it's gone through an area just once, the next time will have zero
|
||||||
* backtracking, since the entire area is now known and cached.
|
* backtracking, since the entire area is now known and cached.
|
||||||
*/
|
*/
|
||||||
public Setting<Long> cachedChunksExpirySeconds = new Setting<>(-1L);
|
public final Setting<Long> cachedChunksExpirySeconds = new Setting<>(-1L);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function that is called when Baritone will log to chat. This function can be added to
|
* The function that is called when Baritone will log to chat. This function can be added to
|
||||||
* via {@link Consumer#andThen(Consumer)} or it can completely be overriden via setting
|
* via {@link Consumer#andThen(Consumer)} or it can completely be overriden via setting
|
||||||
* {@link Setting#value};
|
* {@link Setting#value};
|
||||||
*/
|
*/
|
||||||
public Setting<Consumer<ITextComponent>> logger = new Setting<>(Minecraft.getMinecraft().ingameGUI.getChatGUI()::printChatMessage);
|
public final Setting<Consumer<ITextComponent>> logger = new Setting<>(Minecraft.getMinecraft().ingameGUI.getChatGUI()::printChatMessage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color of the current path
|
* The color of the current path
|
||||||
*/
|
*/
|
||||||
public Setting<Color> colorCurrentPath = new Setting<>(Color.RED);
|
public final Setting<Color> colorCurrentPath = new Setting<>(Color.RED);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color of the next path
|
* The color of the next path
|
||||||
*/
|
*/
|
||||||
public Setting<Color> colorNextPath = new Setting<>(Color.MAGENTA);
|
public final Setting<Color> colorNextPath = new Setting<>(Color.MAGENTA);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color of the blocks to break
|
* The color of the blocks to break
|
||||||
*/
|
*/
|
||||||
public Setting<Color> colorBlocksToBreak = new Setting<>(Color.RED);
|
public final Setting<Color> colorBlocksToBreak = new Setting<>(Color.RED);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color of the blocks to place
|
* The color of the blocks to place
|
||||||
*/
|
*/
|
||||||
public Setting<Color> colorBlocksToPlace = new Setting<>(Color.GREEN);
|
public final Setting<Color> colorBlocksToPlace = new Setting<>(Color.GREEN);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color of the blocks to walk into
|
* The color of the blocks to walk into
|
||||||
*/
|
*/
|
||||||
public Setting<Color> colorBlocksToWalkInto = new Setting<>(Color.MAGENTA);
|
public final Setting<Color> colorBlocksToWalkInto = new Setting<>(Color.MAGENTA);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color of the best path so far
|
* The color of the best path so far
|
||||||
*/
|
*/
|
||||||
public Setting<Color> colorBestPathSoFar = new Setting<>(Color.BLUE);
|
public final Setting<Color> colorBestPathSoFar = new Setting<>(Color.BLUE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color of the path to the most recent considered node
|
* The color of the path to the most recent considered node
|
||||||
*/
|
*/
|
||||||
public Setting<Color> colorMostRecentConsidered = new Setting<>(Color.CYAN);
|
public final Setting<Color> colorMostRecentConsidered = new Setting<>(Color.CYAN);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color of the goal box
|
* The color of the goal box
|
||||||
*/
|
*/
|
||||||
public Setting<Color> colorGoalBox = new Setting<>(Color.GREEN);
|
public final Setting<Color> colorGoalBox = new Setting<>(Color.GREEN);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A map of lowercase setting field names to their respective setting
|
* A map of lowercase setting field names to their respective setting
|
||||||
|
@ -37,7 +37,13 @@ public interface IPathingBehavior extends IBehavior {
|
|||||||
*
|
*
|
||||||
* @return The estimated remaining ticks in the current segment.
|
* @return The estimated remaining ticks in the current segment.
|
||||||
*/
|
*/
|
||||||
Optional<Double> ticksRemainingInSegment();
|
default Optional<Double> ticksRemainingInSegment() {
|
||||||
|
IPathExecutor current = getCurrent();
|
||||||
|
if (current == null) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
return Optional.of(current.getPath().ticksRemainingFrom(current.getPosition()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The current pathing goal
|
* @return The current pathing goal
|
||||||
@ -47,7 +53,9 @@ public interface IPathingBehavior extends IBehavior {
|
|||||||
/**
|
/**
|
||||||
* @return Whether or not a path is currently being executed.
|
* @return Whether or not a path is currently being executed.
|
||||||
*/
|
*/
|
||||||
boolean isPathing();
|
default boolean isPathing() {
|
||||||
|
return getCurrent() != null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels the pathing behavior or the current path calculation, and all processes that could be controlling path.
|
* Cancels the pathing behavior or the current path calculation, and all processes that could be controlling path.
|
||||||
|
@ -26,4 +26,6 @@ import baritone.api.pathing.calc.IPath;
|
|||||||
public interface IPathExecutor {
|
public interface IPathExecutor {
|
||||||
|
|
||||||
IPath getPath();
|
IPath getPath();
|
||||||
|
|
||||||
|
int getPosition();
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
public class MixinKeyBinding {
|
public class MixinKeyBinding {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public int pressTime;
|
private int pressTime;
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
method = "isKeyDown",
|
method = "isKeyDown",
|
||||||
@ -57,7 +57,7 @@ public class MixinKeyBinding {
|
|||||||
private void isPressed(CallbackInfoReturnable<Boolean> cir) {
|
private void isPressed(CallbackInfoReturnable<Boolean> cir) {
|
||||||
// only the primary baritone forces keys
|
// only the primary baritone forces keys
|
||||||
Boolean force = BaritoneAPI.getProvider().getPrimaryBaritone().getInputOverrideHandler().isInputForcedDown((KeyBinding) (Object) this);
|
Boolean force = BaritoneAPI.getProvider().getPrimaryBaritone().getInputOverrideHandler().isInputForcedDown((KeyBinding) (Object) this);
|
||||||
if (force != null && force == false) { // <-- cursed
|
if (force != null && !force) { // <-- cursed
|
||||||
if (pressTime > 0) {
|
if (pressTime > 0) {
|
||||||
Helper.HELPER.logDirect("You're trying to press this mouse button but I won't let you");
|
Helper.HELPER.logDirect("You're trying to press this mouse button but I won't let you");
|
||||||
pressTime--;
|
pressTime--;
|
||||||
|
@ -31,7 +31,6 @@ import baritone.pathing.calc.AStarPathFinder;
|
|||||||
import baritone.pathing.calc.AbstractNodeCostSearch;
|
import baritone.pathing.calc.AbstractNodeCostSearch;
|
||||||
import baritone.pathing.movement.CalculationContext;
|
import baritone.pathing.movement.CalculationContext;
|
||||||
import baritone.pathing.movement.MovementHelper;
|
import baritone.pathing.movement.MovementHelper;
|
||||||
import baritone.pathing.path.CutoffPath;
|
|
||||||
import baritone.pathing.path.PathExecutor;
|
import baritone.pathing.path.PathExecutor;
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
import baritone.utils.PathRenderer;
|
import baritone.utils.PathRenderer;
|
||||||
@ -133,7 +132,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
next = null;
|
next = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (next != null && !next.getPath().positions().contains(ctx.playerFeet())) {
|
if (next != null && !next.getPath().positions().contains(ctx.playerFeet()) && !next.getPath().positions().contains(pathStart())) { // can contain either one
|
||||||
// if the current path failed, we may not actually be on the next one, so make sure
|
// if the current path failed, we may not actually be on the next one, so make sure
|
||||||
logDebug("Discarding next path as it does not contain current position");
|
logDebug("Discarding next path as it does not contain current position");
|
||||||
// for example if we had a nicely planned ahead path that starts where current ends
|
// for example if we had a nicely planned ahead path that starts where current ends
|
||||||
@ -149,16 +148,27 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
queuePathEvent(PathEvent.CONTINUING_ONTO_PLANNED_NEXT);
|
queuePathEvent(PathEvent.CONTINUING_ONTO_PLANNED_NEXT);
|
||||||
current = next;
|
current = next;
|
||||||
next = null;
|
next = null;
|
||||||
current.onTick();
|
current.onTick(); // don't waste a tick doing nothing, get started right away
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// at this point, current just ended, but we aren't in the goal and have no plan for the future
|
// at this point, current just ended, but we aren't in the goal and have no plan for the future
|
||||||
synchronized (pathCalcLock) {
|
synchronized (pathCalcLock) {
|
||||||
if (inProgress != null) {
|
if (inProgress != null) {
|
||||||
queuePathEvent(PathEvent.PATH_FINISHED_NEXT_STILL_CALCULATING);
|
// we are calculating
|
||||||
// if we aren't calculating right now
|
// are we calculating the right thing though?
|
||||||
return;
|
BetterBlockPos calcFrom = inProgress.getStart();
|
||||||
|
// if current just succeeded, we should be standing in calcFrom, so that's cool and good
|
||||||
|
// but if current just failed, we should discard this calculation since it doesn't start from where we're standing
|
||||||
|
if (calcFrom.equals(ctx.playerFeet()) || calcFrom.equals(pathStart())) {
|
||||||
|
// cool and good
|
||||||
|
queuePathEvent(PathEvent.PATH_FINISHED_NEXT_STILL_CALCULATING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// oh noes
|
||||||
|
inProgress.cancel(); // cancellation doesn't dispatch any events
|
||||||
|
inProgress = null; // this is safe since we hold both locks
|
||||||
}
|
}
|
||||||
|
// we aren't calculating
|
||||||
queuePathEvent(PathEvent.CALC_STARTED);
|
queuePathEvent(PathEvent.CALC_STARTED);
|
||||||
findPathInNewThread(pathStart(), true, context);
|
findPathInNewThread(pathStart(), true, context);
|
||||||
}
|
}
|
||||||
@ -188,11 +198,11 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (goal == null || goal.isInGoal(current.getPath().getDest())) {
|
if (goal == null || goal.isInGoal(current.getPath().getDest())) {
|
||||||
// and this path dosen't get us all the way there
|
// and this path doesn't get us all the way there
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ticksRemainingInSegment().get() < Baritone.settings().planningTickLookAhead.get()) {
|
if (ticksRemainingInSegment().get() < Baritone.settings().planningTickLookAhead.get()) {
|
||||||
// and this path has 5 seconds or less left
|
// and this path has 7.5 seconds or less left
|
||||||
logDebug("Path almost over. Planning ahead...");
|
logDebug("Path almost over. Planning ahead...");
|
||||||
queuePathEvent(PathEvent.NEXT_SEGMENT_CALC_STARTED);
|
queuePathEvent(PathEvent.NEXT_SEGMENT_CALC_STARTED);
|
||||||
findPathInNewThread(current.getPath().getDest(), false, context);
|
findPathInNewThread(current.getPath().getDest(), false, context);
|
||||||
@ -218,14 +228,6 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Double> ticksRemainingInSegment() {
|
|
||||||
if (current == null) {
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
return Optional.of(current.getPath().ticksRemainingFrom(current.getPosition()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void secretInternalSetGoal(Goal goal) {
|
public void secretInternalSetGoal(Goal goal) {
|
||||||
this.goal = goal;
|
this.goal = goal;
|
||||||
}
|
}
|
||||||
@ -279,11 +281,6 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
return Optional.ofNullable(inProgress);
|
return Optional.ofNullable(inProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPathing() {
|
|
||||||
return this.current != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSafeToCancel() {
|
public boolean isSafeToCancel() {
|
||||||
return current == null || safeToCancel;
|
return current == null || safeToCancel;
|
||||||
}
|
}
|
||||||
@ -306,7 +303,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
if (doIt) {
|
if (doIt) {
|
||||||
secretInternalSegmentCancel();
|
secretInternalSegmentCancel();
|
||||||
}
|
}
|
||||||
baritone.getPathingControlManager().cancelEverything();
|
baritone.getPathingControlManager().cancelEverything(); // regardless of if we can stop the current segment, we can still stop the processes
|
||||||
return doIt;
|
return doIt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +339,9 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
public void forceCancel() { // NOT exposed on public api
|
public void forceCancel() { // NOT exposed on public api
|
||||||
cancelEverything();
|
cancelEverything();
|
||||||
secretInternalSegmentCancel();
|
secretInternalSegmentCancel();
|
||||||
inProgress = null;
|
synchronized (pathCalcLock) {
|
||||||
|
inProgress = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void secretCursedFunctionDoNotCall(IPath path) {
|
public void secretCursedFunctionDoNotCall(IPath path) {
|
||||||
@ -440,33 +439,8 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PathCalculationResult calcResult = pathfinder.calculate(primaryTimeout, failureTimeout);
|
PathCalculationResult calcResult = pathfinder.calculate(primaryTimeout, failureTimeout);
|
||||||
Optional<IPath> path = calcResult.getPath();
|
|
||||||
if (Baritone.settings().cutoffAtLoadBoundary.get()) {
|
|
||||||
path = path.map(p -> {
|
|
||||||
IPath result = p.cutoffAtLoadedChunks(context.bsi);
|
|
||||||
|
|
||||||
if (result instanceof CutoffPath) {
|
|
||||||
logDebug("Cutting off path at edge of loaded chunks");
|
|
||||||
logDebug("Length decreased by " + (p.length() - result.length()));
|
|
||||||
} else {
|
|
||||||
logDebug("Path ends within loaded chunks");
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Optional<PathExecutor> executor = path.map(p -> {
|
|
||||||
IPath result = p.staticCutoff(goal);
|
|
||||||
|
|
||||||
if (result instanceof CutoffPath) {
|
|
||||||
logDebug("Static cutoff " + p.length() + " to " + result.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}).map(p -> new PathExecutor(this, p));
|
|
||||||
|
|
||||||
synchronized (pathPlanLock) {
|
synchronized (pathPlanLock) {
|
||||||
|
Optional<PathExecutor> executor = calcResult.getPath().map(p -> new PathExecutor(PathingBehavior.this, p));
|
||||||
if (current == null) {
|
if (current == null) {
|
||||||
if (executor.isPresent()) {
|
if (executor.isPresent()) {
|
||||||
queuePathEvent(PathEvent.CALC_FINISHED_NOW_EXECUTING);
|
queuePathEvent(PathEvent.CALC_FINISHED_NOW_EXECUTING);
|
||||||
|
@ -92,13 +92,25 @@ public abstract class AbstractNodeCostSearch implements IPathFinder {
|
|||||||
cancelRequested = false;
|
cancelRequested = false;
|
||||||
try {
|
try {
|
||||||
IPath path = calculate0(primaryTimeout, failureTimeout).map(IPath::postProcess).orElse(null);
|
IPath path = calculate0(primaryTimeout, failureTimeout).map(IPath::postProcess).orElse(null);
|
||||||
isFinished = true;
|
|
||||||
if (cancelRequested) {
|
if (cancelRequested) {
|
||||||
return new PathCalculationResult(PathCalculationResult.Type.CANCELLATION, path);
|
return new PathCalculationResult(PathCalculationResult.Type.CANCELLATION);
|
||||||
}
|
}
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
return new PathCalculationResult(PathCalculationResult.Type.FAILURE);
|
return new PathCalculationResult(PathCalculationResult.Type.FAILURE);
|
||||||
}
|
}
|
||||||
|
int previousLength = path.length();
|
||||||
|
path = path.cutoffAtLoadedChunks(context.bsi);
|
||||||
|
if (path.length() < previousLength) {
|
||||||
|
Helper.HELPER.logDebug("Cutting off path at edge of loaded chunks");
|
||||||
|
Helper.HELPER.logDebug("Length decreased by " + (previousLength - path.length()));
|
||||||
|
} else {
|
||||||
|
Helper.HELPER.logDebug("Path ends within loaded chunks");
|
||||||
|
}
|
||||||
|
previousLength = path.length();
|
||||||
|
path = path.staticCutoff(goal);
|
||||||
|
if (path.length() < previousLength) {
|
||||||
|
Helper.HELPER.logDebug("Static cutoff " + previousLength + " to " + path.length());
|
||||||
|
}
|
||||||
if (goal.isInGoal(path.getDest())) {
|
if (goal.isInGoal(path.getDest())) {
|
||||||
return new PathCalculationResult(PathCalculationResult.Type.SUCCESS_TO_GOAL, path);
|
return new PathCalculationResult(PathCalculationResult.Type.SUCCESS_TO_GOAL, path);
|
||||||
} else {
|
} else {
|
||||||
@ -163,7 +175,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<IPath> bestPathSoFar() {
|
public Optional<IPath> bestPathSoFar() { // TODO cleanup code duplication between here and AStarPathFinder
|
||||||
if (startNode == null || bestSoFar == null) {
|
if (startNode == null || bestSoFar == null) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
@ -189,4 +201,8 @@ public abstract class AbstractNodeCostSearch implements IPathFinder {
|
|||||||
public final Goal getGoal() {
|
public final Goal getGoal() {
|
||||||
return goal;
|
return goal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BetterBlockPos getStart() {
|
||||||
|
return new BetterBlockPos(startX, startY, startZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ public abstract class Movement implements IMovement, MovementHelper {
|
|||||||
baritone.getLookBehavior().updateTarget(
|
baritone.getLookBehavior().updateTarget(
|
||||||
rotation,
|
rotation,
|
||||||
currentState.getTarget().hasToForceRotations()));
|
currentState.getTarget().hasToForceRotations()));
|
||||||
|
baritone.getInputOverrideHandler().clearAllKeys();
|
||||||
currentState.getInputStates().forEach((input, forced) -> {
|
currentState.getInputStates().forEach((input, forced) -> {
|
||||||
baritone.getInputOverrideHandler().setInputForceState(input, forced);
|
baritone.getInputOverrideHandler().setInputForceState(input, forced);
|
||||||
});
|
});
|
||||||
|
@ -137,7 +137,7 @@ public class MovementDescend extends Movement {
|
|||||||
IBlockState ontoBlock = context.get(destX, newY, destZ);
|
IBlockState ontoBlock = context.get(destX, newY, destZ);
|
||||||
int unprotectedFallHeight = fallHeight - (y - effectiveStartHeight); // equal to fallHeight - y + effectiveFallHeight, which is equal to -newY + effectiveFallHeight, which is equal to effectiveFallHeight - newY
|
int unprotectedFallHeight = fallHeight - (y - effectiveStartHeight); // equal to fallHeight - y + effectiveFallHeight, which is equal to -newY + effectiveFallHeight, which is equal to effectiveFallHeight - newY
|
||||||
double tentativeCost = WALK_OFF_BLOCK_COST + FALL_N_BLOCKS_COST[unprotectedFallHeight] + frontBreak + costSoFar;
|
double tentativeCost = WALK_OFF_BLOCK_COST + FALL_N_BLOCKS_COST[unprotectedFallHeight] + frontBreak + costSoFar;
|
||||||
if (ontoBlock.getBlock() == Blocks.WATER && context.getBlock(destX, newY + 1, destZ) != Blocks.WATERLILY) {
|
if ((ontoBlock.getBlock() == Blocks.WATER || ontoBlock.getBlock() == Blocks.FLOWING_WATER) && context.getBlock(destX, newY + 1, destZ) != Blocks.WATERLILY) {
|
||||||
// lilypads are canWalkThrough, but we can't end a fall that should be broken by water if it's covered by a lilypad
|
// lilypads are canWalkThrough, but we can't end a fall that should be broken by water if it's covered by a lilypad
|
||||||
// however, don't return impossible in the lilypad scenario, because we could still jump right on it (water that's below a lilypad is canWalkOn so it works)
|
// however, don't return impossible in the lilypad scenario, because we could still jump right on it (water that's below a lilypad is canWalkOn so it works)
|
||||||
if (context.assumeWalkOnWater) {
|
if (context.assumeWalkOnWater) {
|
||||||
@ -157,9 +157,6 @@ public class MovementDescend extends Movement {
|
|||||||
res.cost = tentativeCost;// TODO incorporate water swim up cost?
|
res.cost = tentativeCost;// TODO incorporate water swim up cost?
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ontoBlock.getBlock() == Blocks.FLOWING_WATER) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (unprotectedFallHeight <= 11 && (ontoBlock.getBlock() == Blocks.VINE || ontoBlock.getBlock() == Blocks.LADDER)) {
|
if (unprotectedFallHeight <= 11 && (ontoBlock.getBlock() == Blocks.VINE || ontoBlock.getBlock() == Blocks.LADDER)) {
|
||||||
// if fall height is greater than or equal to 11, we don't actually grab on to vines or ladders. the more you know
|
// if fall height is greater than or equal to 11, we don't actually grab on to vines or ladders. the more you know
|
||||||
// this effectively "resets" our falling speed
|
// this effectively "resets" our falling speed
|
||||||
@ -177,13 +174,6 @@ public class MovementDescend extends Movement {
|
|||||||
if (MovementHelper.isBottomSlab(ontoBlock)) {
|
if (MovementHelper.isBottomSlab(ontoBlock)) {
|
||||||
return false; // falling onto a half slab is really glitchy, and can cause more fall damage than we'd expect
|
return false; // falling onto a half slab is really glitchy, and can cause more fall damage than we'd expect
|
||||||
}
|
}
|
||||||
if (context.hasWaterBucket && unprotectedFallHeight <= context.maxFallHeightBucket + 1) {
|
|
||||||
res.x = destX;
|
|
||||||
res.y = newY + 1;// this is the block we're falling onto, so dest is +1
|
|
||||||
res.z = destZ;
|
|
||||||
res.cost = tentativeCost + context.placeBucketCost();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (unprotectedFallHeight <= context.maxFallHeightNoWater + 1) {
|
if (unprotectedFallHeight <= context.maxFallHeightNoWater + 1) {
|
||||||
// fallHeight = 4 means onto.up() is 3 blocks down, which is the max
|
// fallHeight = 4 means onto.up() is 3 blocks down, which is the max
|
||||||
res.x = destX;
|
res.x = destX;
|
||||||
@ -191,6 +181,13 @@ public class MovementDescend extends Movement {
|
|||||||
res.z = destZ;
|
res.z = destZ;
|
||||||
res.cost = tentativeCost;
|
res.cost = tentativeCost;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (context.hasWaterBucket && unprotectedFallHeight <= context.maxFallHeightBucket + 1) {
|
||||||
|
res.x = destX;
|
||||||
|
res.y = newY + 1;// this is the block we're falling onto, so dest is +1
|
||||||
|
res.z = destZ;
|
||||||
|
res.cost = tentativeCost + context.placeBucketCost();
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -235,8 +232,7 @@ public class MovementDescend extends Movement {
|
|||||||
if (numTicks++ < 20) {
|
if (numTicks++ < 20) {
|
||||||
MovementHelper.moveTowards(ctx, state, fakeDest);
|
MovementHelper.moveTowards(ctx, state, fakeDest);
|
||||||
if (fromStart > 1.25) {
|
if (fromStart > 1.25) {
|
||||||
state.setInput(Input.MOVE_FORWARD, false);
|
state.getTarget().rotation = new Rotation(state.getTarget().rotation.getYaw() + 180F, state.getTarget().rotation.getPitch());
|
||||||
state.setInput(Input.MOVE_BACK, true);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MovementHelper.moveTowards(ctx, state, dest);
|
MovementHelper.moveTowards(ctx, state, dest);
|
||||||
|
@ -30,6 +30,7 @@ import baritone.pathing.movement.MovementHelper;
|
|||||||
import baritone.pathing.movement.MovementState;
|
import baritone.pathing.movement.MovementState;
|
||||||
import baritone.pathing.movement.MovementState.MovementTarget;
|
import baritone.pathing.movement.MovementState.MovementTarget;
|
||||||
import baritone.utils.pathing.MutableMoveResult;
|
import baritone.utils.pathing.MutableMoveResult;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockLadder;
|
import net.minecraft.block.BlockLadder;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
@ -79,7 +80,9 @@ public class MovementFall extends Movement {
|
|||||||
BlockPos playerFeet = ctx.playerFeet();
|
BlockPos playerFeet = ctx.playerFeet();
|
||||||
Rotation toDest = RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest));
|
Rotation toDest = RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest));
|
||||||
Rotation targetRotation = null;
|
Rotation targetRotation = null;
|
||||||
if (!MovementHelper.isWater(ctx, dest) && willPlaceBucket() && !playerFeet.equals(dest)) {
|
Block destBlock = ctx.world().getBlockState(dest).getBlock();
|
||||||
|
boolean isWater = destBlock == Blocks.WATER || destBlock == Blocks.FLOWING_WATER;
|
||||||
|
if (!isWater && willPlaceBucket() && !playerFeet.equals(dest)) {
|
||||||
if (!InventoryPlayer.isHotbar(ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER)) || ctx.world().provider.isNether()) {
|
if (!InventoryPlayer.isHotbar(ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER)) || ctx.world().provider.isNether()) {
|
||||||
return state.setStatus(MovementStatus.UNREACHABLE);
|
return state.setStatus(MovementStatus.UNREACHABLE);
|
||||||
}
|
}
|
||||||
@ -100,8 +103,8 @@ public class MovementFall extends Movement {
|
|||||||
} else {
|
} else {
|
||||||
state.setTarget(new MovementTarget(toDest, false));
|
state.setTarget(new MovementTarget(toDest, false));
|
||||||
}
|
}
|
||||||
if (playerFeet.equals(dest) && (ctx.player().posY - playerFeet.getY() < 0.094 || MovementHelper.isWater(ctx, dest))) { // 0.094 because lilypads
|
if (playerFeet.equals(dest) && (ctx.player().posY - playerFeet.getY() < 0.094 || isWater)) { // 0.094 because lilypads
|
||||||
if (MovementHelper.isWater(ctx, dest)) {
|
if (isWater) { // only match water, not flowing water (which we cannot pick up with a bucket)
|
||||||
if (InventoryPlayer.isHotbar(ctx.player().inventory.getSlotFor(STACK_BUCKET_EMPTY))) {
|
if (InventoryPlayer.isHotbar(ctx.player().inventory.getSlotFor(STACK_BUCKET_EMPTY))) {
|
||||||
ctx.player().inventory.currentItem = ctx.player().inventory.getSlotFor(STACK_BUCKET_EMPTY);
|
ctx.player().inventory.currentItem = ctx.player().inventory.getSlotFor(STACK_BUCKET_EMPTY);
|
||||||
if (ctx.player().motionY >= 0) {
|
if (ctx.player().motionY >= 0) {
|
||||||
@ -132,7 +135,7 @@ public class MovementFall extends Movement {
|
|||||||
double dist = Math.abs(avoid.getX() * (destCenter.x - avoid.getX() / 2.0 - ctx.player().posX)) + Math.abs(avoid.getZ() * (destCenter.z - avoid.getZ() / 2.0 - ctx.player().posZ));
|
double dist = Math.abs(avoid.getX() * (destCenter.x - avoid.getX() / 2.0 - ctx.player().posX)) + Math.abs(avoid.getZ() * (destCenter.z - avoid.getZ() / 2.0 - ctx.player().posZ));
|
||||||
if (dist < 0.6) {
|
if (dist < 0.6) {
|
||||||
state.setInput(Input.MOVE_FORWARD, true);
|
state.setInput(Input.MOVE_FORWARD, true);
|
||||||
} else {
|
} else if (!ctx.player().onGround) {
|
||||||
state.setInput(Input.SNEAK, false);
|
state.setInput(Input.SNEAK, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,6 +272,9 @@ public class PathExecutor implements IPathExecutor, Helper {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
sprintNextTick = shouldSprintNextTick();
|
sprintNextTick = shouldSprintNextTick();
|
||||||
|
if (!sprintNextTick) {
|
||||||
|
ctx.player().setSprinting(false); // letting go of control doesn't make you stop sprinting actually
|
||||||
|
}
|
||||||
ticksOnCurrent++;
|
ticksOnCurrent++;
|
||||||
if (ticksOnCurrent > currentMovementOriginalCostEstimate + Baritone.settings().movementTimeoutTicks.get()) {
|
if (ticksOnCurrent > currentMovementOriginalCostEstimate + Baritone.settings().movementTimeoutTicks.get()) {
|
||||||
// only cancel if the total time has exceeded the initial estimate
|
// only cancel if the total time has exceeded the initial estimate
|
||||||
@ -391,29 +394,32 @@ public class PathExecutor implements IPathExecutor, Helper {
|
|||||||
|
|
||||||
// however, descend doesn't request sprinting, beceause it doesn't know the context of what movement comes after it
|
// however, descend doesn't request sprinting, beceause it doesn't know the context of what movement comes after it
|
||||||
IMovement current = path.movements().get(pathPosition);
|
IMovement current = path.movements().get(pathPosition);
|
||||||
if (current instanceof MovementDescend && pathPosition < path.length() - 2) {
|
if (current instanceof MovementDescend) {
|
||||||
|
|
||||||
if (((MovementDescend) current).safeMode()) {
|
if (((MovementDescend) current).safeMode()) {
|
||||||
logDebug("Sprinting would be unsafe");
|
logDebug("Sprinting would be unsafe");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMovement next = path.movements().get(pathPosition + 1);
|
if (pathPosition < path.length() - 2) {
|
||||||
if (next instanceof MovementAscend && current.getDirection().up().equals(next.getDirection().down())) {
|
IMovement next = path.movements().get(pathPosition + 1);
|
||||||
// a descend then an ascend in the same direction
|
if (next instanceof MovementAscend && current.getDirection().up().equals(next.getDirection().down())) {
|
||||||
pathPosition++;
|
// a descend then an ascend in the same direction
|
||||||
// okay to skip clearKeys and / or onChangeInPathPosition here since this isn't possible to repeat, since it's asymmetric
|
|
||||||
logDebug("Skipping descend to straight ascend");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (canSprintInto(ctx, current, next)) {
|
|
||||||
if (ctx.playerFeet().equals(current.getDest())) {
|
|
||||||
pathPosition++;
|
pathPosition++;
|
||||||
onChangeInPathPosition();
|
// okay to skip clearKeys and / or onChangeInPathPosition here since this isn't possible to repeat, since it's asymmetric
|
||||||
|
logDebug("Skipping descend to straight ascend");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
if (canSprintInto(ctx, current, next)) {
|
||||||
|
if (ctx.playerFeet().equals(current.getDest())) {
|
||||||
|
pathPosition++;
|
||||||
|
onChangeInPathPosition();
|
||||||
|
onTick();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//logDebug("Turning off sprinting " + movement + " " + next + " " + movement.getDirection() + " " + next.getDirection().down() + " " + next.getDirection().down().equals(movement.getDirection()));
|
||||||
}
|
}
|
||||||
//logDebug("Turning off sprinting " + movement + " " + next + " " + movement.getDirection() + " " + next.getDirection().down() + " " + next.getDirection().down().equals(movement.getDirection()));
|
|
||||||
}
|
}
|
||||||
if (current instanceof MovementAscend && pathPosition != 0) {
|
if (current instanceof MovementAscend && pathPosition != 0) {
|
||||||
IMovement prev = path.movements().get(pathPosition - 1);
|
IMovement prev = path.movements().get(pathPosition - 1);
|
||||||
@ -455,6 +461,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
|||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getPosition() {
|
public int getPosition() {
|
||||||
return pathPosition;
|
return pathPosition;
|
||||||
}
|
}
|
||||||
|
@ -94,14 +94,14 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
if (Baritone.settings().legitMine.get()) {
|
if (Baritone.settings().legitMine.get()) {
|
||||||
addNearby();
|
addNearby();
|
||||||
}
|
}
|
||||||
Goal goal = updateGoal();
|
PathingCommand command = updateGoal();
|
||||||
if (goal == null) {
|
if (command == null) {
|
||||||
// none in range
|
// none in range
|
||||||
// maybe say something in chat? (ahem impact)
|
// maybe say something in chat? (ahem impact)
|
||||||
cancel();
|
cancel();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new PathingCommand(goal, PathingCommandType.FORCE_REVALIDATE_GOAL_AND_PATH);
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -114,17 +114,18 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
return "Mine " + mining;
|
return "Mine " + mining;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Goal updateGoal() {
|
private PathingCommand updateGoal() {
|
||||||
|
boolean legit = Baritone.settings().legitMine.get();
|
||||||
List<BlockPos> locs = knownOreLocations;
|
List<BlockPos> locs = knownOreLocations;
|
||||||
if (!locs.isEmpty()) {
|
if (!locs.isEmpty()) {
|
||||||
List<BlockPos> locs2 = prune(new CalculationContext(baritone), new ArrayList<>(locs), mining, ORE_LOCATIONS_COUNT);
|
List<BlockPos> locs2 = prune(new CalculationContext(baritone), new ArrayList<>(locs), mining, ORE_LOCATIONS_COUNT);
|
||||||
// can't reassign locs, gotta make a new var locs2, because we use it in a lambda right here, and variables you use in a lambda must be effectively final
|
// can't reassign locs, gotta make a new var locs2, because we use it in a lambda right here, and variables you use in a lambda must be effectively final
|
||||||
Goal goal = new GoalComposite(locs2.stream().map(loc -> coalesce(ctx, loc, locs2)).toArray(Goal[]::new));
|
Goal goal = new GoalComposite(locs2.stream().map(loc -> coalesce(ctx, loc, locs2)).toArray(Goal[]::new));
|
||||||
knownOreLocations = locs2;
|
knownOreLocations = locs2;
|
||||||
return goal;
|
return new PathingCommand(goal, legit ? PathingCommandType.FORCE_REVALIDATE_GOAL_AND_PATH : PathingCommandType.REVALIDATE_GOAL_AND_PATH);
|
||||||
}
|
}
|
||||||
// we don't know any ore locations at the moment
|
// we don't know any ore locations at the moment
|
||||||
if (!Baritone.settings().legitMine.get()) {
|
if (!legit) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// only in non-Xray mode (aka legit mode) do we do this
|
// only in non-Xray mode (aka legit mode) do we do this
|
||||||
@ -149,7 +150,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return branchPointRunaway;
|
return new PathingCommand(branchPointRunaway, PathingCommandType.REVALIDATE_GOAL_AND_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rescan(List<BlockPos> already, CalculationContext context) {
|
private void rescan(List<BlockPos> already, CalculationContext context) {
|
||||||
|
@ -104,7 +104,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean runCommand(String msg0) {
|
public boolean runCommand(String msg0) { // you may think this can be private, but impcat calls it from .b =)
|
||||||
String msg = msg0.toLowerCase(Locale.US).trim(); // don't reassign the argument LOL
|
String msg = msg0.toLowerCase(Locale.US).trim(); // don't reassign the argument LOL
|
||||||
PathingBehavior pathingBehavior = baritone.getPathingBehavior();
|
PathingBehavior pathingBehavior = baritone.getPathingBehavior();
|
||||||
CustomGoalProcess customGoalProcess = baritone.getCustomGoalProcess();
|
CustomGoalProcess customGoalProcess = baritone.getCustomGoalProcess();
|
||||||
|
@ -135,6 +135,7 @@ public class ToolSet {
|
|||||||
* Calculates how long would it take to mine the specified block given the best tool
|
* Calculates how long would it take to mine the specified block given the best tool
|
||||||
* in this toolset is used. A negative value is returned if the specified block is unbreakable.
|
* in this toolset is used. A negative value is returned if the specified block is unbreakable.
|
||||||
*
|
*
|
||||||
|
* @param item the item to mine it with
|
||||||
* @param state the blockstate to be mined
|
* @param state the blockstate to be mined
|
||||||
* @return how long it would take in ticks
|
* @return how long it would take in ticks
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
package baritone.utils.pathing;
|
package baritone.utils.pathing;
|
||||||
|
|
||||||
|
import baritone.Baritone;
|
||||||
import baritone.api.BaritoneAPI;
|
import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.pathing.calc.IPath;
|
import baritone.api.pathing.calc.IPath;
|
||||||
import baritone.api.pathing.goals.Goal;
|
import baritone.api.pathing.goals.Goal;
|
||||||
@ -27,6 +28,9 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
public abstract class PathBase implements IPath {
|
public abstract class PathBase implements IPath {
|
||||||
@Override
|
@Override
|
||||||
public PathBase cutoffAtLoadedChunks(Object bsi0) { // <-- cursed cursed cursed
|
public PathBase cutoffAtLoadedChunks(Object bsi0) { // <-- cursed cursed cursed
|
||||||
|
if (!Baritone.settings().cutoffAtLoadBoundary.get()) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
BlockStateInterface bsi = (BlockStateInterface) bsi0;
|
BlockStateInterface bsi = (BlockStateInterface) bsi0;
|
||||||
for (int i = 0; i < positions().size(); i++) {
|
for (int i = 0; i < positions().size(); i++) {
|
||||||
BlockPos pos = positions().get(i);
|
BlockPos pos = positions().get(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user