no more stupid wrapper getters
This commit is contained in:
parent
8a4f48f08d
commit
b9b25e7e6b
@ -175,7 +175,7 @@ public final class MemoryBehavior extends Behavior {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BlockPos neighboringConnectedBlock(BlockPos in) {
|
private BlockPos neighboringConnectedBlock(BlockPos in) {
|
||||||
BlockStateInterface bsi = new CalculationContext(baritone).bsi();
|
BlockStateInterface bsi = new CalculationContext(baritone).bsi;
|
||||||
Block block = bsi.get0(in).getBlock();
|
Block block = bsi.get0(in).getBlock();
|
||||||
if (block != Blocks.TRAPPED_CHEST && block != Blocks.CHEST) {
|
if (block != Blocks.TRAPPED_CHEST && block != Blocks.CHEST) {
|
||||||
return null; // other things that have contents, but can be placed adjacent without combining
|
return null; // other things that have contents, but can be placed adjacent without combining
|
||||||
|
@ -433,7 +433,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
Optional<IPath> path = calcResult.getPath();
|
Optional<IPath> path = calcResult.getPath();
|
||||||
if (Baritone.settings().cutoffAtLoadBoundary.get()) {
|
if (Baritone.settings().cutoffAtLoadBoundary.get()) {
|
||||||
path = path.map(p -> {
|
path = path.map(p -> {
|
||||||
IPath result = p.cutoffAtLoadedChunks(context.bsi());
|
IPath result = p.cutoffAtLoadedChunks(context.bsi);
|
||||||
|
|
||||||
if (result instanceof CutoffPath) {
|
if (result instanceof CutoffPath) {
|
||||||
logDebug("Cutting off path at edge of loaded chunks");
|
logDebug("Cutting off path at edge of loaded chunks");
|
||||||
@ -499,7 +499,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
Goal transformed = goal;
|
Goal transformed = goal;
|
||||||
if (Baritone.settings().simplifyUnloadedYCoord.get() && goal instanceof IGoalRenderPos) {
|
if (Baritone.settings().simplifyUnloadedYCoord.get() && goal instanceof IGoalRenderPos) {
|
||||||
BlockPos pos = ((IGoalRenderPos) goal).getGoalPos();
|
BlockPos pos = ((IGoalRenderPos) goal).getGoalPos();
|
||||||
if (context.world().getChunk(pos) instanceof EmptyChunk) {
|
if (context.world.getChunk(pos) instanceof EmptyChunk) {
|
||||||
transformed = new GoalXZ(pos.getX(), pos.getZ());
|
transformed = new GoalXZ(pos.getX(), pos.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public final class AStarPathFinder extends AbstractNodeCostSearch implements Hel
|
|||||||
}
|
}
|
||||||
MutableMoveResult res = new MutableMoveResult();
|
MutableMoveResult res = new MutableMoveResult();
|
||||||
Favoring favored = favoring;
|
Favoring favored = favoring;
|
||||||
BetterWorldBorder worldBorder = new BetterWorldBorder(calcContext.world().getWorldBorder());
|
BetterWorldBorder worldBorder = new BetterWorldBorder(calcContext.world.getWorldBorder());
|
||||||
long startTime = System.nanoTime() / 1000000L;
|
long startTime = System.nanoTime() / 1000000L;
|
||||||
boolean slowPath = Baritone.settings().slowPath.get();
|
boolean slowPath = Baritone.settings().slowPath.get();
|
||||||
if (slowPath) {
|
if (slowPath) {
|
||||||
|
@ -42,29 +42,29 @@ public class CalculationContext {
|
|||||||
|
|
||||||
private static final ItemStack STACK_BUCKET_WATER = new ItemStack(Items.WATER_BUCKET);
|
private static final ItemStack STACK_BUCKET_WATER = new ItemStack(Items.WATER_BUCKET);
|
||||||
|
|
||||||
private final IBaritone baritone;
|
public final IBaritone baritone;
|
||||||
private final EntityPlayerSP player;
|
public final EntityPlayerSP player;
|
||||||
private final World world;
|
public final World world;
|
||||||
private final WorldData worldData;
|
public final WorldData worldData;
|
||||||
private final BlockStateInterface bsi;
|
public final BlockStateInterface bsi;
|
||||||
private final ToolSet toolSet;
|
public final ToolSet toolSet;
|
||||||
private final boolean hasWaterBucket;
|
public final boolean hasWaterBucket;
|
||||||
private final boolean hasThrowaway;
|
public final boolean hasThrowaway;
|
||||||
private final boolean canSprint;
|
public final boolean canSprint;
|
||||||
private final double placeBlockCost;
|
public final double placeBlockCost;
|
||||||
private final boolean allowBreak;
|
public final boolean allowBreak;
|
||||||
private final boolean allowParkour;
|
public final boolean allowParkour;
|
||||||
private final boolean allowParkourPlace;
|
public final boolean allowParkourPlace;
|
||||||
private final boolean allowJumpAt256;
|
public final boolean allowJumpAt256;
|
||||||
private final boolean assumeWalkOnWater;
|
public final boolean assumeWalkOnWater;
|
||||||
private final boolean allowDiagonalDescend;
|
public final boolean allowDiagonalDescend;
|
||||||
private final int maxFallHeightNoWater;
|
public final int maxFallHeightNoWater;
|
||||||
private final int maxFallHeightBucket;
|
public final int maxFallHeightBucket;
|
||||||
private final double waterWalkSpeed;
|
public final double waterWalkSpeed;
|
||||||
private final double breakBlockAdditionalCost;
|
public final double breakBlockAdditionalCost;
|
||||||
private final double jumpPenalty;
|
public final double jumpPenalty;
|
||||||
private final double walkOnWaterOnePenalty;
|
public final double walkOnWaterOnePenalty;
|
||||||
private final BetterWorldBorder worldBorder;
|
public final BetterWorldBorder worldBorder;
|
||||||
|
|
||||||
public CalculationContext(IBaritone baritone) {
|
public CalculationContext(IBaritone baritone) {
|
||||||
this(baritone, false);
|
this(baritone, false);
|
||||||
@ -126,7 +126,7 @@ public class CalculationContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlaceThrowawayAt(int x, int y, int z) {
|
public boolean canPlaceThrowawayAt(int x, int y, int z) {
|
||||||
if (!hasThrowaway()) { // only true if allowPlace is true, see constructor
|
if (!hasThrowaway) { // only true if allowPlace is true, see constructor
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isPossiblyProtected(x, y, z)) {
|
if (isPossiblyProtected(x, y, z)) {
|
||||||
@ -136,7 +136,7 @@ public class CalculationContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBreakAt(int x, int y, int z) {
|
public boolean canBreakAt(int x, int y, int z) {
|
||||||
if (!allowBreak()) {
|
if (!allowBreak) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !isPossiblyProtected(x, y, z);
|
return !isPossiblyProtected(x, y, z);
|
||||||
@ -146,88 +146,4 @@ public class CalculationContext {
|
|||||||
// TODO more protection logic here; see #220
|
// TODO more protection logic here; see #220
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public World world() {
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityPlayerSP player() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockStateInterface bsi() {
|
|
||||||
return bsi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WorldData worldData() {
|
|
||||||
return worldData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ToolSet getToolSet() {
|
|
||||||
return toolSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasWaterBucket() {
|
|
||||||
return hasWaterBucket;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasThrowaway() {
|
|
||||||
return hasThrowaway;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canSprint() {
|
|
||||||
return canSprint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double placeBlockCost() {
|
|
||||||
return placeBlockCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean allowBreak() {
|
|
||||||
return allowBreak;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean allowParkour() {
|
|
||||||
return allowParkour;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean allowParkourPlace() {
|
|
||||||
return allowParkourPlace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean allowJumpAt256() {
|
|
||||||
return allowJumpAt256;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean assumeWalkOnWater() {
|
|
||||||
return assumeWalkOnWater;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean allowDiagonalDescend() {
|
|
||||||
return allowDiagonalDescend;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int maxFallHeightNoWater() {
|
|
||||||
return maxFallHeightNoWater;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int maxFallHeightBucket() {
|
|
||||||
return maxFallHeightBucket;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double waterWalkSpeed() {
|
|
||||||
return waterWalkSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double breakBlockAdditionalCost() {
|
|
||||||
return breakBlockAdditionalCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double jumpPenalty() {
|
|
||||||
return jumpPenalty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double walkOnWaterOnePenalty() {
|
|
||||||
return walkOnWaterOnePenalty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import baritone.utils.BlockStateInterface;
|
|||||||
import net.minecraft.block.BlockLiquid;
|
import net.minecraft.block.BlockLiquid;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.chunk.EmptyChunk;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -231,7 +230,7 @@ public abstract class Movement implements IMovement, MovementHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkLoadedChunk(CalculationContext context) {
|
public void checkLoadedChunk(CalculationContext context) {
|
||||||
calculatedWhileLoaded = !(context.world().getChunk(getDest()) instanceof EmptyChunk);
|
calculatedWhileLoaded = context.bsi.worldContainsLoadedChunk(dest.x, dest.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -340,24 +340,24 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
|
|
||||||
static double getMiningDurationTicks(CalculationContext context, int x, int y, int z, IBlockState state, boolean includeFalling) {
|
static double getMiningDurationTicks(CalculationContext context, int x, int y, int z, IBlockState state, boolean includeFalling) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if (!canWalkThrough(context.bsi(), x, y, z, state)) {
|
if (!canWalkThrough(context.bsi, x, y, z, state)) {
|
||||||
if (!context.canBreakAt(x, y, z)) {
|
if (!context.canBreakAt(x, y, z)) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
if (avoidBreaking(context.bsi(), x, y, z, state)) {
|
if (avoidBreaking(context.bsi, x, y, z, state)) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
if (block instanceof BlockLiquid) {
|
if (block instanceof BlockLiquid) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
double m = Blocks.CRAFTING_TABLE.equals(block) ? 10 : 1; // TODO see if this is still necessary. it's from MineBot when we wanted to penalize breaking its crafting table
|
double m = Blocks.CRAFTING_TABLE.equals(block) ? 10 : 1; // TODO see if this is still necessary. it's from MineBot when we wanted to penalize breaking its crafting table
|
||||||
double strVsBlock = context.getToolSet().getStrVsBlock(state);
|
double strVsBlock = context.toolSet.getStrVsBlock(state);
|
||||||
if (strVsBlock <= 0) {
|
if (strVsBlock <= 0) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
|
|
||||||
double result = m / strVsBlock;
|
double result = m / strVsBlock;
|
||||||
result += context.breakBlockAdditionalCost();
|
result += context.breakBlockAdditionalCost;
|
||||||
if (includeFalling) {
|
if (includeFalling) {
|
||||||
IBlockState above = context.get(x, y + 1, z);
|
IBlockState above = context.get(x, y + 1, z);
|
||||||
if (above.getBlock() instanceof BlockFalling) {
|
if (above.getBlock() instanceof BlockFalling) {
|
||||||
|
@ -59,11 +59,11 @@ public class MovementAscend extends Movement {
|
|||||||
public static double cost(CalculationContext context, int x, int y, int z, int destX, int destZ) {
|
public static double cost(CalculationContext context, int x, int y, int z, int destX, int destZ) {
|
||||||
IBlockState toPlace = context.get(destX, y, destZ);
|
IBlockState toPlace = context.get(destX, y, destZ);
|
||||||
boolean hasToPlace = false;
|
boolean hasToPlace = false;
|
||||||
if (!MovementHelper.canWalkOn(context.bsi(), destX, y, destZ, toPlace)) {
|
if (!MovementHelper.canWalkOn(context.bsi, destX, y, destZ, toPlace)) {
|
||||||
if (!context.canPlaceThrowawayAt(destX, y, destZ)) {
|
if (!context.canPlaceThrowawayAt(destX, y, destZ)) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
if (!MovementHelper.isReplacable(destX, y, destZ, toPlace, context.bsi())) {
|
if (!MovementHelper.isReplacable(destX, y, destZ, toPlace, context.bsi)) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
@ -73,7 +73,7 @@ public class MovementAscend extends Movement {
|
|||||||
if (againstX == x && againstZ == z) { // we might be able to backplace now, but it doesn't matter because it will have been broken by the time we'd need to use it
|
if (againstX == x && againstZ == z) { // we might be able to backplace now, but it doesn't matter because it will have been broken by the time we'd need to use it
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (MovementHelper.canPlaceAgainst(context.bsi(), againstX, againstY, againstZ)) {
|
if (MovementHelper.canPlaceAgainst(context.bsi, againstX, againstY, againstZ)) {
|
||||||
hasToPlace = true;
|
hasToPlace = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ public class MovementAscend extends Movement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
IBlockState srcUp2 = context.get(x, y + 2, z); // used lower down anyway
|
IBlockState srcUp2 = context.get(x, y + 2, z); // used lower down anyway
|
||||||
if (context.get(x, y + 3, z).getBlock() instanceof BlockFalling && (MovementHelper.canWalkThrough(context.bsi(), x, y + 1, z) || !(srcUp2.getBlock() instanceof BlockFalling))) {//it would fall on us and possibly suffocate us
|
if (context.get(x, y + 3, z).getBlock() instanceof BlockFalling && (MovementHelper.canWalkThrough(context.bsi, x, y + 1, z) || !(srcUp2.getBlock() instanceof BlockFalling))) {//it would fall on us and possibly suffocate us
|
||||||
// HOWEVER, we assume that we're standing in the start position
|
// HOWEVER, we assume that we're standing in the start position
|
||||||
// that means that src and src.up(1) are both air
|
// that means that src and src.up(1) are both air
|
||||||
// maybe they aren't now, but they will be by the time this starts
|
// maybe they aren't now, but they will be by the time this starts
|
||||||
@ -115,7 +115,7 @@ public class MovementAscend extends Movement {
|
|||||||
if (jumpingToBottomSlab) {
|
if (jumpingToBottomSlab) {
|
||||||
if (jumpingFromBottomSlab) {
|
if (jumpingFromBottomSlab) {
|
||||||
walk = Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST); // we hit space immediately on entering this action
|
walk = Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST); // we hit space immediately on entering this action
|
||||||
walk += context.jumpPenalty();
|
walk += context.jumpPenalty;
|
||||||
} else {
|
} else {
|
||||||
walk = WALK_ONE_BLOCK_COST; // we don't hit space we just walk into the slab
|
walk = WALK_ONE_BLOCK_COST; // we don't hit space we just walk into the slab
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ public class MovementAscend extends Movement {
|
|||||||
} else {
|
} else {
|
||||||
walk = Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST);
|
walk = Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST);
|
||||||
}
|
}
|
||||||
walk += context.jumpPenalty();
|
walk += context.jumpPenalty;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cracks knuckles
|
// cracks knuckles
|
||||||
@ -134,7 +134,7 @@ public class MovementAscend extends Movement {
|
|||||||
double totalCost = 0;
|
double totalCost = 0;
|
||||||
totalCost += walk;
|
totalCost += walk;
|
||||||
if (hasToPlace) {
|
if (hasToPlace) {
|
||||||
totalCost += context.placeBlockCost();
|
totalCost += context.placeBlockCost;
|
||||||
}
|
}
|
||||||
// start with srcUp2 since we already have its state
|
// start with srcUp2 since we already have its state
|
||||||
// includeFalling isn't needed because of the falling check above -- if srcUp3 is falling we will have already exited with COST_INF if we'd actually have to break it
|
// includeFalling isn't needed because of the falling check above -- if srcUp3 is falling we will have already exited with COST_INF if we'd actually have to break it
|
||||||
|
@ -93,7 +93,7 @@ public class MovementDescend extends Movement {
|
|||||||
//C, D, etc determine the length of the fall
|
//C, D, etc determine the length of the fall
|
||||||
|
|
||||||
IBlockState below = context.get(destX, y - 2, destZ);
|
IBlockState below = context.get(destX, y - 2, destZ);
|
||||||
if (!MovementHelper.canWalkOn(context.bsi(), destX, y - 2, destZ, below)) {
|
if (!MovementHelper.canWalkOn(context.bsi, destX, y - 2, destZ, below)) {
|
||||||
dynamicFallCost(context, x, y, z, destX, destZ, totalCost, below, res);
|
dynamicFallCost(context, x, y, z, destX, destZ, totalCost, below, res);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ public class MovementDescend extends Movement {
|
|||||||
// and potentially replace the water we're going to fall into
|
// and potentially replace the water we're going to fall into
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!MovementHelper.canWalkThrough(context.bsi(), destX, y - 2, destZ, below) && below.getBlock() != Blocks.WATER) {
|
if (!MovementHelper.canWalkThrough(context.bsi, destX, y - 2, destZ, below) && below.getBlock() != Blocks.WATER) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
double costSoFar = 0;
|
double costSoFar = 0;
|
||||||
@ -140,13 +140,13 @@ public class MovementDescend extends Movement {
|
|||||||
if (ontoBlock.getBlock() == Blocks.WATER && context.getBlock(destX, newY + 1, destZ) != Blocks.WATERLILY) {
|
if (ontoBlock.getBlock() == Blocks.WATER && context.getBlock(destX, newY + 1, destZ) != Blocks.WATERLILY) {
|
||||||
// lilypads are canWalkThrough, but we can't end a fall that should be broken by water if it's covered by a lilypad
|
// lilypads are canWalkThrough, but we can't end a fall that should be broken by water if it's covered by a lilypad
|
||||||
// however, don't return impossible in the lilypad scenario, because we could still jump right on it (water that's below a lilypad is canWalkOn so it works)
|
// however, don't return impossible in the lilypad scenario, because we could still jump right on it (water that's below a lilypad is canWalkOn so it works)
|
||||||
if (context.assumeWalkOnWater()) {
|
if (context.assumeWalkOnWater) {
|
||||||
return false; // TODO fix
|
return false; // TODO fix
|
||||||
}
|
}
|
||||||
if (MovementHelper.isFlowing(ontoBlock)) {
|
if (MovementHelper.isFlowing(ontoBlock)) {
|
||||||
return false; // TODO flowing check required here?
|
return false; // TODO flowing check required here?
|
||||||
}
|
}
|
||||||
if (!MovementHelper.canWalkOn(context.bsi(), destX, newY - 1, destZ)) {
|
if (!MovementHelper.canWalkOn(context.bsi, destX, newY - 1, destZ)) {
|
||||||
// we could punch right through the water into something else
|
// we could punch right through the water into something else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -168,23 +168,23 @@ public class MovementDescend extends Movement {
|
|||||||
effectiveStartHeight = newY;
|
effectiveStartHeight = newY;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (MovementHelper.canWalkThrough(context.bsi(), destX, newY, destZ, ontoBlock)) {
|
if (MovementHelper.canWalkThrough(context.bsi, destX, newY, destZ, ontoBlock)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!MovementHelper.canWalkOn(context.bsi(), destX, newY, destZ, ontoBlock)) {
|
if (!MovementHelper.canWalkOn(context.bsi, destX, newY, destZ, ontoBlock)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (MovementHelper.isBottomSlab(ontoBlock)) {
|
if (MovementHelper.isBottomSlab(ontoBlock)) {
|
||||||
return false; // falling onto a half slab is really glitchy, and can cause more fall damage than we'd expect
|
return false; // falling onto a half slab is really glitchy, and can cause more fall damage than we'd expect
|
||||||
}
|
}
|
||||||
if (context.hasWaterBucket() && unprotectedFallHeight <= context.maxFallHeightBucket() + 1) {
|
if (context.hasWaterBucket && unprotectedFallHeight <= context.maxFallHeightBucket + 1) {
|
||||||
res.x = destX;
|
res.x = destX;
|
||||||
res.y = newY + 1;// this is the block we're falling onto, so dest is +1
|
res.y = newY + 1;// this is the block we're falling onto, so dest is +1
|
||||||
res.z = destZ;
|
res.z = destZ;
|
||||||
res.cost = tentativeCost + context.placeBlockCost();
|
res.cost = tentativeCost + context.placeBlockCost;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (unprotectedFallHeight <= context.maxFallHeightNoWater() + 1) {
|
if (unprotectedFallHeight <= context.maxFallHeightNoWater + 1) {
|
||||||
// fallHeight = 4 means onto.up() is 3 blocks down, which is the max
|
// fallHeight = 4 means onto.up() is 3 blocks down, which is the max
|
||||||
res.x = destX;
|
res.x = destX;
|
||||||
res.y = newY + 1;
|
res.y = newY + 1;
|
||||||
|
@ -65,14 +65,14 @@ public class MovementDiagonal extends Movement {
|
|||||||
|
|
||||||
public static void cost(CalculationContext context, int x, int y, int z, int destX, int destZ, MutableMoveResult res) {
|
public static void cost(CalculationContext context, int x, int y, int z, int destX, int destZ, MutableMoveResult res) {
|
||||||
IBlockState destInto = context.get(destX, y, destZ);
|
IBlockState destInto = context.get(destX, y, destZ);
|
||||||
if (!MovementHelper.canWalkThrough(context.bsi(), destX, y, destZ, destInto) || !MovementHelper.canWalkThrough(context.bsi(), destX, y + 1, destZ)) {
|
if (!MovementHelper.canWalkThrough(context.bsi, destX, y, destZ, destInto) || !MovementHelper.canWalkThrough(context.bsi, destX, y + 1, destZ)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IBlockState destWalkOn = context.get(destX, y - 1, destZ);
|
IBlockState destWalkOn = context.get(destX, y - 1, destZ);
|
||||||
boolean descend = false;
|
boolean descend = false;
|
||||||
if (!MovementHelper.canWalkOn(context.bsi(), destX, y - 1, destZ, destWalkOn)) {
|
if (!MovementHelper.canWalkOn(context.bsi, destX, y - 1, destZ, destWalkOn)) {
|
||||||
descend = true;
|
descend = true;
|
||||||
if (!context.allowDiagonalDescend() || !MovementHelper.canWalkOn(context.bsi(), destX, y - 2, destZ) || !MovementHelper.canWalkThrough(context.bsi(), destX, y - 1, destZ, destWalkOn)) {
|
if (!context.allowDiagonalDescend || !MovementHelper.canWalkOn(context.bsi, destX, y - 2, destZ) || !MovementHelper.canWalkThrough(context.bsi, destX, y - 1, destZ, destWalkOn)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ public class MovementDiagonal extends Movement {
|
|||||||
if (destWalkOn.getBlock() == Blocks.SOUL_SAND) {
|
if (destWalkOn.getBlock() == Blocks.SOUL_SAND) {
|
||||||
multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
||||||
} else if (destWalkOn.getBlock() == Blocks.WATER) {
|
} else if (destWalkOn.getBlock() == Blocks.WATER) {
|
||||||
multiplier += context.walkOnWaterOnePenalty() * SQRT_2;
|
multiplier += context.walkOnWaterOnePenalty * SQRT_2;
|
||||||
}
|
}
|
||||||
Block fromDown = context.get(x, y - 1, z).getBlock();
|
Block fromDown = context.get(x, y - 1, z).getBlock();
|
||||||
if (fromDown == Blocks.LADDER || fromDown == Blocks.VINE) {
|
if (fromDown == Blocks.LADDER || fromDown == Blocks.VINE) {
|
||||||
@ -133,7 +133,7 @@ public class MovementDiagonal extends Movement {
|
|||||||
// Ignore previous multiplier
|
// Ignore previous multiplier
|
||||||
// Whatever we were walking on (possibly soul sand) doesn't matter as we're actually floating on water
|
// Whatever we were walking on (possibly soul sand) doesn't matter as we're actually floating on water
|
||||||
// Not even touching the blocks below
|
// Not even touching the blocks below
|
||||||
multiplier = context.waterWalkSpeed();
|
multiplier = context.waterWalkSpeed;
|
||||||
water = true;
|
water = true;
|
||||||
}
|
}
|
||||||
if (optionA != 0 || optionB != 0) {
|
if (optionA != 0 || optionB != 0) {
|
||||||
@ -144,7 +144,7 @@ public class MovementDiagonal extends Movement {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// only can sprint if not edging around
|
// only can sprint if not edging around
|
||||||
if (context.canSprint() && !water) {
|
if (context.canSprint && !water) {
|
||||||
// If we aren't edging around anything, and we aren't in water
|
// If we aren't edging around anything, and we aren't in water
|
||||||
// We can sprint =D
|
// We can sprint =D
|
||||||
// Don't check for soul sand, since we can sprint on that too
|
// Don't check for soul sand, since we can sprint on that too
|
||||||
|
@ -48,7 +48,7 @@ public class MovementDownward extends Movement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double cost(CalculationContext context, int x, int y, int z) {
|
public static double cost(CalculationContext context, int x, int y, int z) {
|
||||||
if (!MovementHelper.canWalkOn(context.bsi(), x, y - 2, z)) {
|
if (!MovementHelper.canWalkOn(context.bsi, x, y - 2, z)) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
IBlockState down = context.get(x, y - 1, z);
|
IBlockState down = context.get(x, y - 1, z);
|
||||||
|
@ -60,10 +60,10 @@ public class MovementParkour extends Movement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void cost(CalculationContext context, int x, int y, int z, EnumFacing dir, MutableMoveResult res) {
|
public static void cost(CalculationContext context, int x, int y, int z, EnumFacing dir, MutableMoveResult res) {
|
||||||
if (!context.allowParkour()) {
|
if (!context.allowParkour) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (y == 256 && !context.allowJumpAt256()) {
|
if (y == 256 && !context.allowJumpAt256) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public class MovementParkour extends Movement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IBlockState adj = context.get(x + xDiff, y - 1, z + zDiff);
|
IBlockState adj = context.get(x + xDiff, y - 1, z + zDiff);
|
||||||
if (MovementHelper.canWalkOn(context.bsi(), x + xDiff, y - 1, z + zDiff, adj)) { // don't parkour if we could just traverse (for now)
|
if (MovementHelper.canWalkOn(context.bsi, x + xDiff, y - 1, z + zDiff, adj)) { // don't parkour if we could just traverse (for now)
|
||||||
// second most common case -- we could just traverse not parkour
|
// second most common case -- we could just traverse not parkour
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ public class MovementParkour extends Movement {
|
|||||||
if (standingOn.getBlock() == Blocks.SOUL_SAND) {
|
if (standingOn.getBlock() == Blocks.SOUL_SAND) {
|
||||||
maxJump = 2; // 1 block gap
|
maxJump = 2; // 1 block gap
|
||||||
} else {
|
} else {
|
||||||
if (context.canSprint()) {
|
if (context.canSprint) {
|
||||||
maxJump = 4;
|
maxJump = 4;
|
||||||
} else {
|
} else {
|
||||||
maxJump = 3;
|
maxJump = 3;
|
||||||
@ -111,18 +111,18 @@ public class MovementParkour extends Movement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MovementHelper.canWalkOn(context.bsi(), x + xDiff * i, y - 1, z + zDiff * i)) {
|
if (MovementHelper.canWalkOn(context.bsi, x + xDiff * i, y - 1, z + zDiff * i)) {
|
||||||
res.x = x + xDiff * i;
|
res.x = x + xDiff * i;
|
||||||
res.y = y;
|
res.y = y;
|
||||||
res.z = z + zDiff * i;
|
res.z = z + zDiff * i;
|
||||||
res.cost = costFromJumpDistance(i) + context.jumpPenalty();
|
res.cost = costFromJumpDistance(i) + context.jumpPenalty;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxJump != 4) {
|
if (maxJump != 4) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!context.allowParkourPlace()) {
|
if (!context.allowParkourPlace) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int destX = x + 4 * xDiff;
|
int destX = x + 4 * xDiff;
|
||||||
@ -131,7 +131,7 @@ public class MovementParkour extends Movement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IBlockState toReplace = context.get(destX, y - 1, destZ);
|
IBlockState toReplace = context.get(destX, y - 1, destZ);
|
||||||
if (!MovementHelper.isReplacable(destX, y - 1, destZ, toReplace, context.bsi())) {
|
if (!MovementHelper.isReplacable(destX, y - 1, destZ, toReplace, context.bsi)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
@ -141,11 +141,11 @@ public class MovementParkour extends Movement {
|
|||||||
if (againstX == x + xDiff * 3 && againstZ == z + zDiff * 3) { // we can't turn around that fast
|
if (againstX == x + xDiff * 3 && againstZ == z + zDiff * 3) { // we can't turn around that fast
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (MovementHelper.canPlaceAgainst(context.bsi(), againstX, againstY, againstZ)) {
|
if (MovementHelper.canPlaceAgainst(context.bsi, againstX, againstY, againstZ)) {
|
||||||
res.x = destX;
|
res.x = destX;
|
||||||
res.y = y;
|
res.y = y;
|
||||||
res.z = destZ;
|
res.z = destZ;
|
||||||
res.cost = costFromJumpDistance(4) + context.placeBlockCost() + context.jumpPenalty();
|
res.cost = costFromJumpDistance(4) + context.placeBlockCost + context.jumpPenalty;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class MovementPillar extends Movement {
|
|||||||
return COST_INF; // can't pillar up from a bottom slab onto a non ladder
|
return COST_INF; // can't pillar up from a bottom slab onto a non ladder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (from instanceof BlockVine && !hasAgainst(context, x, y, z)) { // TODO this vine can't be climbed, but we could place a pillar still since vines are replacable, no? perhaps the pillar jump would be impossible because of the slowdown actually.
|
if (from == Blocks.VINE && !hasAgainst(context, x, y, z)) { // TODO this vine can't be climbed, but we could place a pillar still since vines are replacable, no? perhaps the pillar jump would be impossible because of the slowdown actually.
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
IBlockState toBreak = context.get(x, y + 2, z);
|
IBlockState toBreak = context.get(x, y + 2, z);
|
||||||
@ -76,7 +76,7 @@ public class MovementPillar extends Movement {
|
|||||||
if (!ladder && !context.canPlaceThrowawayAt(x, y, z)) { // we need to place a block where we started to jump on it
|
if (!ladder && !context.canPlaceThrowawayAt(x, y, z)) { // we need to place a block where we started to jump on it
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
if (from instanceof BlockLiquid || (fromDown.getBlock() instanceof BlockLiquid && context.assumeWalkOnWater())) {
|
if (from instanceof BlockLiquid || (fromDown.getBlock() instanceof BlockLiquid && context.assumeWalkOnWater)) {
|
||||||
// otherwise, if we're standing in water, we cannot pillar
|
// otherwise, if we're standing in water, we cannot pillar
|
||||||
// if we're standing on water and assumeWalkOnWater is true, we cannot pillar
|
// if we're standing on water and assumeWalkOnWater is true, we cannot pillar
|
||||||
// if we're standing on water and assumeWalkOnWater is false, we must have ascended to here, or sneak backplaced, so it is possible to pillar again
|
// if we're standing on water and assumeWalkOnWater is false, we must have ascended to here, or sneak backplaced, so it is possible to pillar again
|
||||||
@ -112,7 +112,7 @@ public class MovementPillar extends Movement {
|
|||||||
if (ladder) {
|
if (ladder) {
|
||||||
return LADDER_UP_ONE_COST + hardness * 5;
|
return LADDER_UP_ONE_COST + hardness * 5;
|
||||||
} else {
|
} else {
|
||||||
return JUMP_ONE_BLOCK_COST + context.placeBlockCost() + context.jumpPenalty() + hardness;
|
return JUMP_ONE_BLOCK_COST + context.placeBlockCost + context.jumpPenalty + hardness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +159,8 @@ public class MovementPillar extends Movement {
|
|||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
boolean ladder = fromDown.getBlock() instanceof BlockLadder || fromDown.getBlock() instanceof BlockVine;
|
boolean ladder = fromDown.getBlock() == Blocks.LADDER || fromDown.getBlock() == Blocks.VINE;
|
||||||
boolean vine = fromDown.getBlock() instanceof BlockVine;
|
boolean vine = fromDown.getBlock() == Blocks.VINE;
|
||||||
Rotation rotation = RotationUtils.calcRotationFromVec3d(ctx.player().getPositionEyes(1.0F),
|
Rotation rotation = RotationUtils.calcRotationFromVec3d(ctx.player().getPositionEyes(1.0F),
|
||||||
VecUtils.getBlockPosCenter(positionToPlace),
|
VecUtils.getBlockPosCenter(positionToPlace),
|
||||||
new Rotation(ctx.player().rotationYaw, ctx.player().rotationPitch));
|
new Rotation(ctx.player().rotationYaw, ctx.player().rotationPitch));
|
||||||
|
@ -30,7 +30,10 @@ import baritone.pathing.movement.Movement;
|
|||||||
import baritone.pathing.movement.MovementHelper;
|
import baritone.pathing.movement.MovementHelper;
|
||||||
import baritone.pathing.movement.MovementState;
|
import baritone.pathing.movement.MovementState;
|
||||||
import baritone.utils.BlockStateInterface;
|
import baritone.utils.BlockStateInterface;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockDoor;
|
||||||
|
import net.minecraft.block.BlockFenceGate;
|
||||||
|
import net.minecraft.block.BlockSlab;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@ -66,17 +69,17 @@ public class MovementTraverse extends Movement {
|
|||||||
IBlockState pb1 = context.get(destX, y, destZ);
|
IBlockState pb1 = context.get(destX, y, destZ);
|
||||||
IBlockState destOn = context.get(destX, y - 1, destZ);
|
IBlockState destOn = context.get(destX, y - 1, destZ);
|
||||||
Block srcDown = context.getBlock(x, y - 1, z);
|
Block srcDown = context.getBlock(x, y - 1, z);
|
||||||
if (MovementHelper.canWalkOn(context.bsi(), destX, y - 1, destZ, destOn)) {//this is a walk, not a bridge
|
if (MovementHelper.canWalkOn(context.bsi, destX, y - 1, destZ, destOn)) {//this is a walk, not a bridge
|
||||||
double WC = WALK_ONE_BLOCK_COST;
|
double WC = WALK_ONE_BLOCK_COST;
|
||||||
boolean water = false;
|
boolean water = false;
|
||||||
if (MovementHelper.isWater(pb0.getBlock()) || MovementHelper.isWater(pb1.getBlock())) {
|
if (MovementHelper.isWater(pb0.getBlock()) || MovementHelper.isWater(pb1.getBlock())) {
|
||||||
WC = context.waterWalkSpeed();
|
WC = context.waterWalkSpeed;
|
||||||
water = true;
|
water = true;
|
||||||
} else {
|
} else {
|
||||||
if (destOn.getBlock() == Blocks.SOUL_SAND) {
|
if (destOn.getBlock() == Blocks.SOUL_SAND) {
|
||||||
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
||||||
} else if (destOn.getBlock() == Blocks.WATER) {
|
} else if (destOn.getBlock() == Blocks.WATER) {
|
||||||
WC += context.walkOnWaterOnePenalty();
|
WC += context.walkOnWaterOnePenalty;
|
||||||
}
|
}
|
||||||
if (srcDown == Blocks.SOUL_SAND) {
|
if (srcDown == Blocks.SOUL_SAND) {
|
||||||
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
||||||
@ -88,7 +91,7 @@ public class MovementTraverse extends Movement {
|
|||||||
}
|
}
|
||||||
double hardness2 = MovementHelper.getMiningDurationTicks(context, destX, y + 1, destZ, pb0, true); // only include falling on the upper block to break
|
double hardness2 = MovementHelper.getMiningDurationTicks(context, destX, y + 1, destZ, pb0, true); // only include falling on the upper block to break
|
||||||
if (hardness1 == 0 && hardness2 == 0) {
|
if (hardness1 == 0 && hardness2 == 0) {
|
||||||
if (!water && context.canSprint()) {
|
if (!water && context.canSprint) {
|
||||||
// If there's nothing in the way, and this isn't water, and we aren't sneak placing
|
// If there's nothing in the way, and this isn't water, and we aren't sneak placing
|
||||||
// We can sprint =D
|
// We can sprint =D
|
||||||
// Don't check for soul sand, since we can sprint on that too
|
// Don't check for soul sand, since we can sprint on that too
|
||||||
@ -105,7 +108,7 @@ public class MovementTraverse extends Movement {
|
|||||||
if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) {
|
if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
if (MovementHelper.isReplacable(destX, y - 1, destZ, destOn, context.bsi())) {
|
if (MovementHelper.isReplacable(destX, y - 1, destZ, destOn, context.bsi)) {
|
||||||
boolean throughWater = MovementHelper.isWater(pb0.getBlock()) || MovementHelper.isWater(pb1.getBlock());
|
boolean throughWater = MovementHelper.isWater(pb0.getBlock()) || MovementHelper.isWater(pb1.getBlock());
|
||||||
if (MovementHelper.isWater(destOn.getBlock()) && throughWater) {
|
if (MovementHelper.isWater(destOn.getBlock()) && throughWater) {
|
||||||
// this happens when assume walk on water is true and this is a traverse in water, which isn't allowed
|
// this happens when assume walk on water is true and this is a traverse in water, which isn't allowed
|
||||||
@ -119,7 +122,7 @@ public class MovementTraverse extends Movement {
|
|||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
double hardness2 = MovementHelper.getMiningDurationTicks(context, destX, y + 1, destZ, pb0, true); // only include falling on the upper block to break
|
double hardness2 = MovementHelper.getMiningDurationTicks(context, destX, y + 1, destZ, pb0, true); // only include falling on the upper block to break
|
||||||
double WC = throughWater ? context.waterWalkSpeed() : WALK_ONE_BLOCK_COST;
|
double WC = throughWater ? context.waterWalkSpeed : WALK_ONE_BLOCK_COST;
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
int againstX = destX + HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i].getXOffset();
|
int againstX = destX + HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i].getXOffset();
|
||||||
int againstY = y - 1 + HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i].getYOffset();
|
int againstY = y - 1 + HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i].getYOffset();
|
||||||
@ -127,8 +130,8 @@ public class MovementTraverse extends Movement {
|
|||||||
if (againstX == x && againstZ == z) { // this would be a backplace
|
if (againstX == x && againstZ == z) { // this would be a backplace
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (MovementHelper.canPlaceAgainst(context.bsi(), againstX, againstY, againstZ)) { // found a side place option
|
if (MovementHelper.canPlaceAgainst(context.bsi, againstX, againstY, againstZ)) { // found a side place option
|
||||||
return WC + context.placeBlockCost() + hardness1 + hardness2;
|
return WC + context.placeBlockCost + hardness1 + hardness2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// now that we've checked all possible directions to side place, we actually need to backplace
|
// now that we've checked all possible directions to side place, we actually need to backplace
|
||||||
@ -139,7 +142,7 @@ public class MovementTraverse extends Movement {
|
|||||||
return COST_INF; // this is obviously impossible
|
return COST_INF; // this is obviously impossible
|
||||||
}
|
}
|
||||||
WC = WC * SNEAK_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST;//since we are sneak backplacing, we are sneaking lol
|
WC = WC * SNEAK_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST;//since we are sneak backplacing, we are sneaking lol
|
||||||
return WC + context.placeBlockCost() + hardness1 + hardness2;
|
return WC + context.placeBlockCost + hardness1 + hardness2;
|
||||||
}
|
}
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
@ -183,7 +186,7 @@ public class MovementTraverse extends Movement {
|
|||||||
state.setInput(Input.SNEAK, false);
|
state.setInput(Input.SNEAK, false);
|
||||||
|
|
||||||
Block fd = BlockStateInterface.get(ctx, src.down()).getBlock();
|
Block fd = BlockStateInterface.get(ctx, src.down()).getBlock();
|
||||||
boolean ladder = fd instanceof BlockLadder || fd instanceof BlockVine;
|
boolean ladder = fd == Blocks.LADDER || fd == Blocks.VINE;
|
||||||
IBlockState pb0 = BlockStateInterface.get(ctx, positionsToBreak[0]);
|
IBlockState pb0 = BlockStateInterface.get(ctx, positionsToBreak[0]);
|
||||||
IBlockState pb1 = BlockStateInterface.get(ctx, positionsToBreak[1]);
|
IBlockState pb1 = BlockStateInterface.get(ctx, positionsToBreak[1]);
|
||||||
|
|
||||||
@ -236,7 +239,7 @@ public class MovementTraverse extends Movement {
|
|||||||
state.setInput(Input.SPRINT, true);
|
state.setInput(Input.SPRINT, true);
|
||||||
}
|
}
|
||||||
Block destDown = BlockStateInterface.get(ctx, dest.down()).getBlock();
|
Block destDown = BlockStateInterface.get(ctx, dest.down()).getBlock();
|
||||||
if (whereAmI.getY() != dest.getY() && ladder && (destDown instanceof BlockVine || destDown instanceof BlockLadder)) {
|
if (whereAmI.getY() != dest.getY() && ladder && (destDown == Blocks.VINE || destDown == Blocks.LADDER)) {
|
||||||
new MovementPillar(baritone, dest.down(), dest).updateState(state); // i'm sorry
|
new MovementPillar(baritone, dest.down(), dest).updateState(state); // i'm sorry
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
|||||||
|
|
||||||
private void sprintIfRequested() {
|
private void sprintIfRequested() {
|
||||||
// first and foremost, if allowSprint is off, or if we don't have enough hunger, don't try and sprint
|
// first and foremost, if allowSprint is off, or if we don't have enough hunger, don't try and sprint
|
||||||
if (!new CalculationContext(behavior.baritone).canSprint()) {
|
if (!new CalculationContext(behavior.baritone).canSprint) {
|
||||||
behavior.baritone.getInputOverrideHandler().setInputForceState(Input.SPRINT, false);
|
behavior.baritone.getInputOverrideHandler().setInputForceState(Input.SPRINT, false);
|
||||||
ctx.player().setSprinting(false);
|
ctx.player().setSprinting(false);
|
||||||
return;
|
return;
|
||||||
|
@ -209,7 +209,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
//long b = System.currentTimeMillis();
|
//long b = System.currentTimeMillis();
|
||||||
for (Block m : mining) {
|
for (Block m : mining) {
|
||||||
if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(m)) {
|
if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(m)) {
|
||||||
locs.addAll(ctx.worldData().getCachedWorld().getLocationsOf(ChunkPacker.blockToString(m), 1, ctx.getBaritone().getPlayerContext().playerFeet().getX(), ctx.getBaritone().getPlayerContext().playerFeet().getZ(), 2));
|
locs.addAll(ctx.worldData.getCachedWorld().getLocationsOf(ChunkPacker.blockToString(m), 1, ctx.getBaritone().getPlayerContext().playerFeet().getX(), ctx.getBaritone().getPlayerContext().playerFeet().getZ(), 2));
|
||||||
} else {
|
} else {
|
||||||
uninteresting.add(m);
|
uninteresting.add(m);
|
||||||
}
|
}
|
||||||
@ -248,17 +248,17 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<BlockPos> prune(CalculationContext ctx, List<BlockPos> locs2, List<Block> mining, int max) {
|
public static List<BlockPos> prune(CalculationContext ctx, List<BlockPos> locs2, List<Block> mining, int max) {
|
||||||
List<BlockPos> dropped = droppedItemsScan(mining, ctx.world());
|
List<BlockPos> dropped = droppedItemsScan(mining, ctx.world);
|
||||||
List<BlockPos> locs = locs2
|
List<BlockPos> locs = locs2
|
||||||
.stream()
|
.stream()
|
||||||
.distinct()
|
.distinct()
|
||||||
|
|
||||||
// remove any that are within loaded chunks that aren't actually what we want
|
// remove any that are within loaded chunks that aren't actually what we want
|
||||||
|
|
||||||
.filter(pos -> !ctx.bsi().worldContainsLoadedChunk(pos.getX(), pos.getZ()) || mining.contains(ctx.getBlock(pos.getX(), pos.getY(), pos.getZ())) || dropped.contains(pos))
|
.filter(pos -> !ctx.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ()) || mining.contains(ctx.getBlock(pos.getX(), pos.getY(), pos.getZ())) || dropped.contains(pos))
|
||||||
|
|
||||||
// remove any that are implausible to mine (encased in bedrock, or touching lava)
|
// remove any that are implausible to mine (encased in bedrock, or touching lava)
|
||||||
.filter(pos -> MineProcess.plausibleToBreak(ctx.bsi(), pos))
|
.filter(pos -> MineProcess.plausibleToBreak(ctx.bsi, pos))
|
||||||
|
|
||||||
.sorted(Comparator.comparingDouble(ctx.getBaritone().getPlayerContext().playerFeet()::distanceSq))
|
.sorted(Comparator.comparingDouble(ctx.getBaritone().getPlayerContext().playerFeet()::distanceSq))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
Loading…
Reference in New Issue
Block a user