Apply suggested reordering
This commit is contained in:
parent
f76283ebfe
commit
de5f6d5fce
@ -114,6 +114,7 @@ public class MovementDiagonal extends Movement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IBlockState destInto = context.get(destX, y, destZ);
|
IBlockState destInto = context.get(destX, y, destZ);
|
||||||
|
IBlockState fromDown = context.get(x, y - 1, z);
|
||||||
boolean ascend = false;
|
boolean ascend = false;
|
||||||
IBlockState destWalkOn;
|
IBlockState destWalkOn;
|
||||||
boolean descend = false;
|
boolean descend = false;
|
||||||
@ -126,9 +127,9 @@ public class MovementDiagonal extends Movement {
|
|||||||
destWalkOn = destInto;
|
destWalkOn = destInto;
|
||||||
} else {
|
} else {
|
||||||
destWalkOn = context.get(destX, y - 1, destZ);
|
destWalkOn = context.get(destX, y - 1, destZ);
|
||||||
boolean standingOnABlock = MovementHelper.mustBeSolidToWalkOn(context, x, y-1, z, context.get(x, y-1, z));
|
boolean standingOnABlock = MovementHelper.mustBeSolidToWalkOn(context, x, y - 1, z, fromDown);
|
||||||
frostWalker = standingOnABlock && MovementHelper.canUseFrostWalker(context, destWalkOn);
|
frostWalker = standingOnABlock && MovementHelper.canUseFrostWalker(context, destWalkOn);
|
||||||
if (!MovementHelper.canWalkOn(context, destX, y - 1, destZ, destWalkOn) && !frostWalker) {
|
if (!frostWalker && !MovementHelper.canWalkOn(context, destX, y - 1, destZ, destWalkOn)) {
|
||||||
descend = true;
|
descend = true;
|
||||||
if (!context.allowDiagonalDescend || !MovementHelper.canWalkOn(context, destX, y - 2, destZ) || !MovementHelper.canWalkThrough(context, destX, y - 1, destZ, destWalkOn)) {
|
if (!context.allowDiagonalDescend || !MovementHelper.canWalkOn(context, destX, y - 2, destZ) || !MovementHelper.canWalkThrough(context, destX, y - 1, destZ, destWalkOn)) {
|
||||||
return;
|
return;
|
||||||
@ -145,11 +146,11 @@ public class MovementDiagonal extends Movement {
|
|||||||
} 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 fromDownBlock = fromDown.getBlock();
|
||||||
if (fromDown == Blocks.LADDER || fromDown == Blocks.VINE) {
|
if (fromDownBlock == Blocks.LADDER || fromDownBlock == Blocks.VINE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fromDown == Blocks.SOUL_SAND) {
|
if (fromDownBlock == 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;
|
||||||
}
|
}
|
||||||
Block cuttingOver1 = context.get(x, y - 1, destZ).getBlock();
|
Block cuttingOver1 = context.get(x, y - 1, destZ).getBlock();
|
||||||
|
@ -101,7 +101,7 @@ public class MovementPillar extends Movement {
|
|||||||
// 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
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
if (fromDown.getBlock() instanceof BlockLiquid && (from == Blocks.WATERLILY || from == Blocks.CARPET)) {
|
if ((from == Blocks.WATERLILY || from == Blocks.CARPET) && fromDown.getBlock() instanceof BlockLiquid) {
|
||||||
// to ascend here we'd have to break the block we are standing on
|
// to ascend here we'd have to break the block we are standing on
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
|
@ -71,10 +71,11 @@ public class MovementTraverse extends Movement {
|
|||||||
IBlockState pb0 = context.get(destX, y + 1, destZ);
|
IBlockState pb0 = context.get(destX, y + 1, destZ);
|
||||||
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);
|
IBlockState srcDown = context.get(x, y - 1, z);
|
||||||
boolean standingOnABlock = MovementHelper.mustBeSolidToWalkOn(context, x, y-1, z, context.get(x, y-1, z));
|
Block srcDownBlock = srcDown.getBlock();
|
||||||
|
boolean standingOnABlock = MovementHelper.mustBeSolidToWalkOn(context, x, y-1, z, srcDown);
|
||||||
boolean frostWalker = standingOnABlock && !context.assumeWalkOnWater && MovementHelper.canUseFrostWalker(context, destOn);
|
boolean frostWalker = standingOnABlock && !context.assumeWalkOnWater && MovementHelper.canUseFrostWalker(context, destOn);
|
||||||
if (MovementHelper.canWalkOn(context, destX, y - 1, destZ, destOn) || frostWalker) { //this is a walk, not a bridge
|
if (frostWalker || MovementHelper.canWalkOn(context, 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())) {
|
||||||
@ -88,7 +89,7 @@ public class MovementTraverse extends Movement {
|
|||||||
} else if (destOn.getBlock() == Blocks.WATER) {
|
} else if (destOn.getBlock() == Blocks.WATER) {
|
||||||
WC += context.walkOnWaterOnePenalty;
|
WC += context.walkOnWaterOnePenalty;
|
||||||
}
|
}
|
||||||
if (srcDown == Blocks.SOUL_SAND) {
|
if (srcDownBlock == 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,13 +107,13 @@ public class MovementTraverse extends Movement {
|
|||||||
}
|
}
|
||||||
return WC;
|
return WC;
|
||||||
}
|
}
|
||||||
if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) {
|
if (srcDownBlock == Blocks.LADDER || srcDownBlock == Blocks.VINE) {
|
||||||
hardness1 *= 5;
|
hardness1 *= 5;
|
||||||
hardness2 *= 5;
|
hardness2 *= 5;
|
||||||
}
|
}
|
||||||
return WC + hardness1 + hardness2;
|
return WC + hardness1 + hardness2;
|
||||||
} else {//this is a bridge, so we need to place a block
|
} else {//this is a bridge, so we need to place a block
|
||||||
if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) {
|
if (srcDownBlock == Blocks.LADDER || srcDownBlock == Blocks.VINE) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
if (MovementHelper.isReplaceable(destX, y - 1, destZ, destOn, context.bsi)) {
|
if (MovementHelper.isReplaceable(destX, y - 1, destZ, destOn, context.bsi)) {
|
||||||
@ -143,14 +144,14 @@ public class MovementTraverse extends Movement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 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
|
||||||
if (srcDown == Blocks.SOUL_SAND || (srcDown instanceof BlockSlab && !((BlockSlab) srcDown).isDouble())) {
|
if (srcDownBlock == Blocks.SOUL_SAND || (srcDownBlock instanceof BlockSlab && !((BlockSlab) srcDownBlock).isDouble())) {
|
||||||
return COST_INF; // can't sneak and backplace against soul sand or half slabs (regardless of whether it's top half or bottom half) =/
|
return COST_INF; // can't sneak and backplace against soul sand or half slabs (regardless of whether it's top half or bottom half) =/
|
||||||
}
|
}
|
||||||
if (!standingOnABlock) { // standing on water / swimming
|
if (!standingOnABlock) { // standing on water / swimming
|
||||||
return COST_INF; // this is obviously impossible
|
return COST_INF; // this is obviously impossible
|
||||||
}
|
}
|
||||||
Block blockSrc = context.getBlock(x, y, z);
|
Block blockSrc = context.getBlock(x, y, z);
|
||||||
if (srcDown instanceof BlockLiquid && (blockSrc == Blocks.WATERLILY || blockSrc == Blocks.CARPET)) {
|
if ((blockSrc == Blocks.WATERLILY || blockSrc == Blocks.CARPET) && srcDownBlock instanceof BlockLiquid) {
|
||||||
return COST_INF; // we can stand on these but can't place against them
|
return COST_INF; // we can stand on these but can't place against them
|
||||||
}
|
}
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user