assumeSafeWalk

This commit is contained in:
Leijurv 2018-09-11 20:50:29 -07:00
parent e82f6b8e35
commit 7f983c92f4
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 16 additions and 2 deletions

View File

@ -67,6 +67,15 @@ public class Settings {
*/ */
public Setting<Boolean> assumeStep = new Setting<>(false); public Setting<Boolean> assumeStep = new Setting<>(false);
/**
* Assume safe walk functionality; don't sneak on a backplace traverse.
* <p>
* Warning: if you do something janky like sneak-backplace from an ender chest, if this is true
* it won't sneak right click, it'll just right click, which means it'll open the chest instead of placing
* against it. That's why this defaults to off.
*/
public Setting<Boolean> assumeSafeWalk = 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.)
*/ */

View File

@ -17,6 +17,7 @@
package baritone.pathing.movement.movements; package baritone.pathing.movement.movements;
import baritone.Baritone;
import baritone.behavior.impl.LookBehaviorUtils; import baritone.behavior.impl.LookBehaviorUtils;
import baritone.pathing.movement.CalculationContext; import baritone.pathing.movement.CalculationContext;
import baritone.pathing.movement.Movement; import baritone.pathing.movement.Movement;
@ -209,7 +210,9 @@ public class MovementTraverse extends Movement {
logDebug("bb pls get me some blocks. dirt or cobble"); logDebug("bb pls get me some blocks. dirt or cobble");
return state.setStatus(MovementState.MovementStatus.UNREACHABLE); return state.setStatus(MovementState.MovementStatus.UNREACHABLE);
} }
if (!Baritone.settings().assumeSafeWalk.get()) {
state.setInput(InputOverrideHandler.Input.SNEAK, true); state.setInput(InputOverrideHandler.Input.SNEAK, true);
}
Block standingOn = BlockStateInterface.get(playerFeet().down()).getBlock(); Block standingOn = BlockStateInterface.get(playerFeet().down()).getBlock();
if (standingOn.equals(Blocks.SOUL_SAND) || standingOn instanceof BlockSlab) { // see issue #118 if (standingOn.equals(Blocks.SOUL_SAND) || standingOn instanceof BlockSlab) { // see issue #118
double dist = Math.max(Math.abs(dest.getX() + 0.5 - player().posX), Math.abs(dest.getZ() + 0.5 - player().posZ)); double dist = Math.max(Math.abs(dest.getX() + 0.5 - player().posX), Math.abs(dest.getZ() + 0.5 - player().posZ));
@ -238,7 +241,9 @@ public class MovementTraverse extends Movement {
return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true); return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true);
} }
} }
if (!Baritone.settings().assumeSafeWalk.get()) {
state.setInput(InputOverrideHandler.Input.SNEAK, true); state.setInput(InputOverrideHandler.Input.SNEAK, true);
}
if (whereAmI.equals(dest)) { if (whereAmI.equals(dest)) {
// If we are in the block that we are trying to get to, we are sneaking over air and we need to place a block beneath us against the one we just walked off of // If we are in the block that we are trying to get to, we are sneaking over air and we need to place a block beneath us against the one we just walked off of
// Out.log(from + " " + to + " " + faceX + "," + faceY + "," + faceZ + " " + whereAmI); // Out.log(from + " " + to + " " + faceX + "," + faceY + "," + faceZ + " " + whereAmI);