Merge branch 'master' into builder

This commit is contained in:
Leijurv
2019-02-21 11:28:13 -08:00
9 changed files with 38 additions and 13 deletions

View File

@@ -109,7 +109,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
// If we have antiCheatCompatibility on, we're going to use the target value later in onPlayerUpdate()
// Also the type has to be MOTION_UPDATE because that is called after JUMP
if (!Baritone.settings().antiCheatCompatibility.get() && event.getType() == RotationMoveEvent.Type.MOTION_UPDATE) {
if (!Baritone.settings().antiCheatCompatibility.get() && event.getType() == RotationMoveEvent.Type.MOTION_UPDATE && !this.force) {
this.target = null;
}
}

View File

@@ -168,7 +168,13 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
}
private Goal createGoal(BlockPos pos) {
return walkIntoInsteadOfAdjacent(gettingTo) ? new GoalTwoBlocks(pos) : new GoalGetToBlock(pos);
if (walkIntoInsteadOfAdjacent(gettingTo)) {
return new GoalTwoBlocks(pos);
}
if (blockOnTopMustBeRemoved(gettingTo) && baritone.bsi.get0(pos.up()).isBlockNormalCube()) {
return new GoalBlock(pos.up());
}
return new GoalGetToBlock(pos);
}
private boolean rightClick() {
@@ -203,4 +209,12 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
}
return block == Blocks.CRAFTING_TABLE || block == Blocks.FURNACE || block == Blocks.ENDER_CHEST || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST;
}
private boolean blockOnTopMustBeRemoved(Block block) {
if (!rightClickOnArrival(block)) { // only if we plan to actually open it on arrival
return false;
}
// only these chests; you can open a crafting table or furnace even with a block on top
return block == Blocks.ENDER_CHEST || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST;
}
}

View File

@@ -432,7 +432,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
logDirect("Started mining blocks of type " + Arrays.toString(blockTypes));
return true;
}
if (msg.startsWith("thisway")) {
if (msg.startsWith("thisway") || msg.startsWith("forward")) {
try {
Goal goal = GoalXZ.fromDirection(ctx.playerFeetAsVec(), ctx.player().rotationYaw, Double.parseDouble(msg.substring(7).trim()));
customGoalProcess.setGoal(goal);

View File

@@ -61,16 +61,23 @@ public final class InputOverrideHandler extends Behavior implements IInputOverri
@Override
public final Boolean isInputForcedDown(KeyBinding key) {
Input input = Input.getInputForBind(key);
if (input == null || !inControl()) {
if (input == null) {
return null;
}
if (input == Input.CLICK_LEFT) {
if (input == Input.CLICK_LEFT && inControl()) {
// only override left click off when pathing
return false;
}
if (input == Input.CLICK_RIGHT) {
return isInputForcedDown(Input.CLICK_RIGHT);
if (isInputForcedDown(Input.CLICK_RIGHT)) {
// gettoblock and builder can right click even when not pathing; allow them to do so
return true;
} else if (inControl()) {
// but when we are pathing for real, force right click off
return false;
}
}
return null;
return null; // dont force any inputs other than left and right click
}
/**