diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java index 8e2fc518..124e6f10 100644 --- a/src/main/java/baritone/pathing/movement/CalculationContext.java +++ b/src/main/java/baritone/pathing/movement/CalculationContext.java @@ -135,7 +135,7 @@ public class CalculationContext { return get(x, y, z).getBlock(); } - public double costOfPlacingAt(int x, int y, int z) { + public double costOfPlacingAt(int x, int y, int z, IBlockState current) { if (!hasThrowaway) { // only true if allowPlace is true, see constructor return COST_INF; } @@ -149,7 +149,7 @@ public class CalculationContext { return placeBlockCost; } - public double breakCostMultiplierAt(int x, int y, int z) { + public double breakCostMultiplierAt(int x, int y, int z, IBlockState current) { if (!allowBreak) { return COST_INF; } diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index b8739d1c..725a0876 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -376,7 +376,7 @@ public interface MovementHelper extends ActionCosts, Helper { if (block instanceof BlockLiquid) { return COST_INF; } - double mult = context.breakCostMultiplierAt(x, y, z); + double mult = context.breakCostMultiplierAt(x, y, z, state); if (mult >= COST_INF) { return COST_INF; } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java index 66827a35..4f35ef8e 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java @@ -69,7 +69,7 @@ public class MovementAscend extends Movement { IBlockState toPlace = context.get(destX, y, destZ); double additionalPlacementCost = 0; if (!MovementHelper.canWalkOn(context.bsi, destX, y, destZ, toPlace)) { - additionalPlacementCost = context.costOfPlacingAt(destX, y, destZ); + additionalPlacementCost = context.costOfPlacingAt(destX, y, destZ, toPlace); if (additionalPlacementCost >= COST_INF) { return COST_INF; } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 41a183f8..eb032210 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -147,11 +147,11 @@ public class MovementParkour extends Movement { // time 2 pop off with that dank skynet parkour place int destX = x + 4 * xDiff; int destZ = z + 4 * zDiff; - double placeCost = context.costOfPlacingAt(destX, y - 1, destZ); + IBlockState toReplace = context.get(destX, y - 1, destZ); + double placeCost = context.costOfPlacingAt(destX, y - 1, destZ, toReplace); if (placeCost >= COST_INF) { return; } - IBlockState toReplace = context.get(destX, y - 1, destZ); if (!MovementHelper.isReplaceable(destX, y - 1, destZ, toReplace, context.bsi)) { return; } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java index c444422e..d28ff32c 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java @@ -57,7 +57,8 @@ public class MovementPillar extends Movement { } public static double cost(CalculationContext context, int x, int y, int z) { - Block from = context.get(x, y, z).getBlock(); + IBlockState fromState = context.get(x, y, z); + Block from = fromState.getBlock(); boolean ladder = from == Blocks.LADDER || from == Blocks.VINE; IBlockState fromDown = context.get(x, y - 1, z); if (!ladder) { @@ -86,7 +87,7 @@ public class MovementPillar extends Movement { double placeCost = 0; if (!ladder) { // we need to place a block where we started to jump on it - placeCost = context.costOfPlacingAt(x, y, z); + placeCost = context.costOfPlacingAt(x, y, z, fromState); if (placeCost >= COST_INF) { return COST_INF; } diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index c1f5ed01..29ac1cec 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -117,7 +117,7 @@ public class MovementTraverse extends Movement { // this happens when assume walk on water is true and this is a traverse in water, which isn't allowed return COST_INF; } - double placeCost = context.costOfPlacingAt(destX, y - 1, destZ); + double placeCost = context.costOfPlacingAt(destX, y - 1, destZ, destOn); if (placeCost >= COST_INF) { return COST_INF; } diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index cd15f283..687e6c98 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -791,11 +791,11 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil } @Override - public double costOfPlacingAt(int x, int y, int z) { + public double costOfPlacingAt(int x, int y, int z, IBlockState current) { if (isPossiblyProtected(x, y, z) || !worldBorder.canPlaceAt(x, z)) { // make calculation fail properly if we can't build return COST_INF; } - IBlockState sch = getSchematic(x, y, z, bsi.get0(x, y, z)); + IBlockState sch = getSchematic(x, y, z, current); if (sch != null) { // TODO this can return true even when allowPlace is off.... is that an issue? if (sch.getBlock() == Blocks.AIR) { @@ -825,11 +825,11 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil } @Override - public double breakCostMultiplierAt(int x, int y, int z) { + public double breakCostMultiplierAt(int x, int y, int z, IBlockState current) { if (!allowBreak || isPossiblyProtected(x, y, z)) { return COST_INF; } - IBlockState sch = getSchematic(x, y, z, bsi.get0(x, y, z)); + IBlockState sch = getSchematic(x, y, z, current); if (sch != null) { if (sch.getBlock() == Blocks.AIR) { // it should be air