fix parkour and multithread farm

This commit is contained in:
Leijurv 2019-07-11 12:46:24 -07:00
parent 01658286af
commit ce4b1e09ed
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 11 additions and 4 deletions

View File

@ -226,7 +226,7 @@ public class MovementParkour extends Movement {
state.setStatus(MovementStatus.SUCCESS);
}
} else if (!ctx.playerFeet().equals(src)) {
if (ctx.playerFeet().equals(src.offset(direction)) || ctx.player().posY - ctx.playerFeet().getY() > 0.0001) {
if (ctx.playerFeet().equals(src.offset(direction)) || ctx.player().posY - src.y > 0.0001) {
if (!MovementHelper.canWalkOn(ctx, dest.down()) && !ctx.player().onGround && MovementHelper.attemptToPlaceABlock(state, baritone, dest.down(), true) == PlaceResult.READY_TO_PLACE) {
// go in the opposite order to check DOWN before all horizontals -- down is preferable because you don't have to look to the side while in midair, which could mess up the trajectory
state.setInput(Input.CLICK_RIGHT, true);

View File

@ -54,6 +54,9 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
private boolean active;
private List<BlockPos> locations;
private int tickCount;
private static final List<Item> FARMLAND_PLANTABLE = Arrays.asList(
Items.BEETROOT_SEEDS,
Items.MELON_SEEDS,
@ -93,6 +96,7 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
@Override
public void farm() {
active = true;
locations = null;
}
private enum Harvest {
@ -164,9 +168,12 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
if (Baritone.settings().replantNetherWart.value) {
scan.add(Blocks.SOUL_SAND);
}
List<BlockPos> locations = WorldScanner.INSTANCE.scanChunkRadius(ctx, scan, 256, 10, 4);
if (Baritone.settings().mineGoalUpdateInterval.value != 0 && tickCount++ % Baritone.settings().mineGoalUpdateInterval.value == 0) {
Baritone.getExecutor().execute(() -> locations = WorldScanner.INSTANCE.scanChunkRadius(ctx, scan, 256, 10, 10));
}
if (locations == null) {
return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
}
List<BlockPos> toBreak = new ArrayList<>();
List<BlockPos> openFarmland = new ArrayList<>();
List<BlockPos> bonemealable = new ArrayList<>();