better strategy
This commit is contained in:
parent
702b916948
commit
c74c01271d
@ -30,17 +30,17 @@ public class GoalBlock implements Goal, IGoalRenderPos {
|
||||
/**
|
||||
* The X block position of this goal
|
||||
*/
|
||||
private final int x;
|
||||
public final int x;
|
||||
|
||||
/**
|
||||
* The Y block position of this goal
|
||||
*/
|
||||
private final int y;
|
||||
public final int y;
|
||||
|
||||
/**
|
||||
* The Z block position of this goal
|
||||
*/
|
||||
private final int z;
|
||||
public final int z;
|
||||
|
||||
public GoalBlock(BlockPos pos) {
|
||||
this(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
@ -65,7 +65,7 @@ public class CalculationContext {
|
||||
public final int maxFallHeightBucket;
|
||||
public final double waterWalkSpeed;
|
||||
public final double breakBlockAdditionalCost;
|
||||
public final double jumpPenalty;
|
||||
public double jumpPenalty;
|
||||
public final double walkOnWaterOnePenalty;
|
||||
public final BetterWorldBorder worldBorder;
|
||||
|
||||
|
@ -275,14 +275,24 @@ public class MovementTraverse extends Movement {
|
||||
double faceX = (dest.getX() + against1.getX() + 1.0D) * 0.5D;
|
||||
double faceY = (dest.getY() + against1.getY()) * 0.5D;
|
||||
double faceZ = (dest.getZ() + against1.getZ() + 1.0D) * 0.5D;
|
||||
state.setTarget(new MovementState.MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), new Vec3d(faceX, faceY, faceZ), ctx.playerRotations()), true));
|
||||
Rotation rot = RotationUtils.calcRotationFromVec3d(ctx.playerHead(), new Vec3d(faceX, faceY, faceZ), ctx.playerRotations());
|
||||
state.setTarget(new MovementState.MovementTarget(rot, true));
|
||||
|
||||
EnumFacing side = ctx.objectMouseOver().sideHit;
|
||||
if (Objects.equals(ctx.getSelectedBlock().orElse(null), against1) && (ctx.player().isSneaking() || Baritone.settings().assumeSafeWalk.get()) && ctx.getSelectedBlock().get().offset(side).equals(positionToPlace)) {
|
||||
return state.setInput(Input.CLICK_RIGHT, true);
|
||||
}
|
||||
if (ctx.playerRotations().isReallyCloseTo(rot)) {
|
||||
double dist = Math.max(Math.abs(ctx.player().posX - (dest.getX() + 0.5D)), Math.abs(ctx.player().posZ - (dest.getZ() + 0.5D)));
|
||||
if (dist > 0.83) {
|
||||
// might need to go forward a bit
|
||||
return state.setInput(Input.MOVE_FORWARD, true);
|
||||
}
|
||||
// don't left click for one tick
|
||||
return state.setInput(Input.CLICK_LEFT, true);
|
||||
}
|
||||
return state;
|
||||
//System.out.println("Trying to look at " + against1 + ", actually looking at" + RayTraceUtils.getSelectedBlock());
|
||||
return state.setInput(Input.CLICK_LEFT, true);
|
||||
}
|
||||
}
|
||||
if (!Baritone.settings().assumeSafeWalk.get()) {
|
||||
|
@ -215,7 +215,7 @@ public class BuilderProcess extends BaritoneProcessHelper {
|
||||
List<IBlockState> approxPlacable = placable();
|
||||
List<BetterBlockPos> placable = incorrectPositions.stream().filter(pos -> bcc.bsi.get0(pos).getBlock() == Blocks.AIR && approxPlacable.contains(bcc.getSchematic(pos.x, pos.y, pos.z))).collect(Collectors.toList());
|
||||
if (!placable.isEmpty()) {
|
||||
return placable.stream().filter(pos -> !placable.contains(pos.down()) && !placable.contains(pos.down(2))).map(BetterBlockPos::up).map(GoalBlock::new).toArray(Goal[]::new);
|
||||
return placable.stream().filter(pos -> !placable.contains(pos.down()) && !placable.contains(pos.down(2))).map(GoalPlace::new).toArray(Goal[]::new);
|
||||
}
|
||||
return incorrectPositions.stream().filter(pos -> bcc.bsi.get0(pos).getBlock() != Blocks.AIR).map(GoalBreak::new).toArray(Goal[]::new);
|
||||
}
|
||||
@ -229,7 +229,7 @@ public class BuilderProcess extends BaritoneProcessHelper {
|
||||
@Override
|
||||
public boolean isInGoal(int x, int y, int z) {
|
||||
// can't stand right on top of a block, that might not work (what if it's unsupported, can't break then)
|
||||
if (x == this.x && y == this.y + 1 && z == this.z) {
|
||||
if (y > this.y) {
|
||||
return false;
|
||||
}
|
||||
// but any other adjacent works for breaking, including inside or below
|
||||
@ -237,6 +237,17 @@ public class BuilderProcess extends BaritoneProcessHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static class GoalPlace extends GoalBlock {
|
||||
public GoalPlace(BlockPos placeAt) {
|
||||
super(placeAt.up());
|
||||
}
|
||||
|
||||
public double heuristic(int x, int y, int z) {
|
||||
// prioritize lower y coordinates
|
||||
return this.y * 100 + super.heuristic(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLostControl() {
|
||||
incorrectPositions = null;
|
||||
@ -290,6 +301,8 @@ public class BuilderProcess extends BaritoneProcessHelper {
|
||||
this.originX = schematicOrigin.getX();
|
||||
this.originY = schematicOrigin.getY();
|
||||
this.originZ = schematicOrigin.getZ();
|
||||
|
||||
this.jumpPenalty += 10;
|
||||
}
|
||||
|
||||
private IBlockState getSchematic(int x, int y, int z) {
|
||||
|
Loading…
Reference in New Issue
Block a user