blocks on top of chests, fixes #299

This commit is contained in:
Leijurv 2019-02-21 11:25:03 -08:00
parent eb9f755b54
commit 16dcd2f44d
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 26 additions and 5 deletions

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

@ -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
}
/**