Merge branch 'master' into builder
This commit is contained in:
@@ -179,8 +179,8 @@ public final class CachedWorld implements ICachedWorld, Helper {
|
||||
if (region == null) {
|
||||
continue;
|
||||
}
|
||||
int distX = (region.getX() * 512 + 256) - pruneCenter.getX();
|
||||
int distZ = (region.getZ() * 512 + 256) - pruneCenter.getZ();
|
||||
int distX = (region.getX() << 9 + 256) - pruneCenter.getX();
|
||||
int distZ = (region.getZ() << 9 + 256) - pruneCenter.getZ();
|
||||
double dist = Math.sqrt(distX * distX + distZ * distZ);
|
||||
if (dist > 1024) {
|
||||
logDebug("Deleting cached region " + region.getX() + "," + region.getZ() + " from ram");
|
||||
@@ -215,7 +215,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
|
||||
if (mostRecentlyModified == null) {
|
||||
return new BlockPos(0, 0, 0);
|
||||
}
|
||||
return new BlockPos(mostRecentlyModified.x * 16 + 8, 0, mostRecentlyModified.z * 16 + 8);
|
||||
return new BlockPos(mostRecentlyModified.x << 4 + 8, 0, mostRecentlyModified.z << 4 + 8);
|
||||
}
|
||||
|
||||
private synchronized List<CachedRegion> allRegions() {
|
||||
|
||||
@@ -132,7 +132,9 @@ class Path extends PathBase {
|
||||
Movement move = moves.apply0(context, src);
|
||||
if (move.getDest().equals(dest)) {
|
||||
// have to calculate the cost at calculation time so we can accurately judge whether a cost increase happened between cached calculation and real execution
|
||||
move.override(cost);
|
||||
// however, taking into account possible favoring that could skew the node cost, we really want the stricter limit of the two
|
||||
// so we take the minimum of the path node cost difference, and the calculated cost
|
||||
move.override(Math.min(move.calculateCost(context), cost));
|
||||
return move;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import java.util.Optional;
|
||||
|
||||
public abstract class Movement implements IMovement, MovementHelper {
|
||||
|
||||
protected static final EnumFacing[] HORIZONTALS = {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST};
|
||||
protected static final EnumFacing[] HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP = {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.DOWN};
|
||||
|
||||
protected final IBaritone baritone;
|
||||
@@ -85,7 +84,7 @@ public abstract class Movement implements IMovement, MovementHelper {
|
||||
return cost;
|
||||
}
|
||||
|
||||
protected abstract double calculateCost(CalculationContext context);
|
||||
public abstract double calculateCost(CalculationContext context);
|
||||
|
||||
@Override
|
||||
public double recalculateCost() {
|
||||
@@ -125,9 +124,6 @@ public abstract class Movement implements IMovement, MovementHelper {
|
||||
rotation,
|
||||
currentState.getTarget().hasToForceRotations()));
|
||||
|
||||
// TODO: calculate movement inputs from latestState.getGoal().position
|
||||
// latestState.getTarget().position.ifPresent(null); NULL CONSUMER REALLY SHOULDN'T BE THE FINAL THING YOU SHOULD REALLY REPLACE THIS WITH ALMOST ACTUALLY ANYTHING ELSE JUST PLEASE DON'T LEAVE IT AS IT IS THANK YOU KANYE
|
||||
|
||||
currentState.getInputStates().forEach((input, forced) -> {
|
||||
baritone.getInputOverrideHandler().setInputForceState(input, forced);
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ public class MovementAscend extends Movement {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
public double calculateCost(CalculationContext context) {
|
||||
return cost(context, src.x, src.y, src.z, dest.x, dest.z);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class MovementDescend extends Movement {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
public double calculateCost(CalculationContext context) {
|
||||
MutableMoveResult result = new MutableMoveResult();
|
||||
cost(context, src.x, src.y, src.z, dest.x, dest.z, result);
|
||||
if (result.y != dest.y) {
|
||||
|
||||
@@ -54,7 +54,7 @@ public class MovementDiagonal extends Movement {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
public double calculateCost(CalculationContext context) {
|
||||
MutableMoveResult result = new MutableMoveResult();
|
||||
cost(context, src.x, src.y, src.z, dest.x, dest.z, result);
|
||||
if (result.y != dest.y) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class MovementDownward extends Movement {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
public double calculateCost(CalculationContext context) {
|
||||
return cost(context, src.x, src.y, src.z);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class MovementFall extends Movement {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
public double calculateCost(CalculationContext context) {
|
||||
MutableMoveResult result = new MutableMoveResult();
|
||||
MovementDescend.cost(context, src.x, src.y, src.z, dest.x, dest.z, result);
|
||||
if (result.y != dest.y) {
|
||||
|
||||
@@ -168,7 +168,7 @@ public class MovementParkour extends Movement {
|
||||
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
public double calculateCost(CalculationContext context) {
|
||||
MutableMoveResult res = new MutableMoveResult();
|
||||
cost(context, src.x, src.y, src.z, direction, res);
|
||||
if (res.x != dest.x || res.z != dest.z) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class MovementPillar extends Movement {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
public double calculateCost(CalculationContext context) {
|
||||
return cost(context, src.x, src.y, src.z);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MovementTraverse extends Movement {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
public double calculateCost(CalculationContext context) {
|
||||
return cost(context, src.x, src.y, src.z, dest.x, dest.z);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||
return false;
|
||||
}
|
||||
|
||||
//System.out.println("Should be at " + whereShouldIBe + " actually am at " + whereAmI);
|
||||
if (!Blocks.AIR.equals(BlockStateInterface.getBlock(ctx, whereAmI.down()))) {//do not skip if standing on air, because our position isn't stable to skip
|
||||
for (int i = 0; i < pathPosition - 1 && i < path.length(); i++) {//this happens for example when you lag out and get teleported back a couple blocks
|
||||
if (whereAmI.equals(path.positions().get(i))) {
|
||||
|
||||
@@ -57,7 +57,6 @@ public final class FollowProcess extends BaritoneProcessHelper implements IFollo
|
||||
}
|
||||
|
||||
private Goal towards(Entity following) {
|
||||
// lol this is trashy but it works
|
||||
BlockPos pos;
|
||||
if (Baritone.settings().followOffsetDistance.get() == 0) {
|
||||
pos = new BlockPos(following);
|
||||
|
||||
@@ -64,8 +64,7 @@ public class PathingControlManager implements IPathingControlManager {
|
||||
command = null;
|
||||
for (IBaritoneProcess proc : processes) {
|
||||
proc.onLostControl();
|
||||
if (proc.isActive() && !proc.isTemporary()) { // it's okay for a temporary thing (like combat pause) to maintain control even if you say to cancel
|
||||
// but not for a non temporary thing
|
||||
if (proc.isActive() && !proc.isTemporary()) { // it's okay only for a temporary thing (like combat pause) to maintain control even if you say to cancel
|
||||
throw new IllegalStateException(proc.displayName());
|
||||
}
|
||||
}
|
||||
@@ -175,7 +174,7 @@ public class PathingControlManager implements IPathingControlManager {
|
||||
boolean found = false;
|
||||
boolean cancelOthers = false;
|
||||
PathingCommand exec = null;
|
||||
for (int i = inContention.size() - 1; i >= 0; i--) { // truly a gamer moment
|
||||
for (int i = inContention.size() - 1; i >= 0; --i) { // truly a gamer moment
|
||||
IBaritoneProcess proc = inContention.get(i);
|
||||
if (found) {
|
||||
if (cancelOthers) {
|
||||
|
||||
@@ -180,7 +180,7 @@ public class ToolSet {
|
||||
speed *= 0.09;
|
||||
break;
|
||||
case 2:
|
||||
speed *= 0.0027;
|
||||
speed *= 0.0027; // you might think that 0.09*0.3 = 0.027 so that should be next, that would make too much sense. it's 0.0027.
|
||||
break;
|
||||
default:
|
||||
speed *= 0.00081;
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public abstract class PathBase implements IPath {
|
||||
@Override
|
||||
public PathBase cutoffAtLoadedChunks(Object bsi0) {
|
||||
public PathBase cutoffAtLoadedChunks(Object bsi0) { // <-- cursed cursed cursed
|
||||
BlockStateInterface bsi = (BlockStateInterface) bsi0;
|
||||
for (int i = 0; i < positions().size(); i++) {
|
||||
BlockPos pos = positions().get(i);
|
||||
|
||||
Reference in New Issue
Block a user