vine and ladder fixes
This commit is contained in:
parent
1e6599cc42
commit
a45f291d67
@ -57,15 +57,16 @@ public class MovementTraverse extends Movement {
|
|||||||
IBlockState pb0 = BlockStateInterface.get(positionsToBreak[0]);
|
IBlockState pb0 = BlockStateInterface.get(positionsToBreak[0]);
|
||||||
IBlockState pb1 = BlockStateInterface.get(positionsToBreak[1]);
|
IBlockState pb1 = BlockStateInterface.get(positionsToBreak[1]);
|
||||||
IBlockState destOn = BlockStateInterface.get(positionToPlace);
|
IBlockState destOn = BlockStateInterface.get(positionToPlace);
|
||||||
|
Block srcDown = BlockStateInterface.getBlock(src.down());
|
||||||
if (MovementHelper.canWalkOn(positionToPlace, destOn)) {//this is a walk, not a bridge
|
if (MovementHelper.canWalkOn(positionToPlace, destOn)) {//this is a walk, not a bridge
|
||||||
double WC = WALK_ONE_BLOCK_COST;
|
double WC = WALK_ONE_BLOCK_COST;
|
||||||
if (BlockStateInterface.isWater(pb0.getBlock()) || BlockStateInterface.isWater(pb1.getBlock())) {
|
if (BlockStateInterface.isWater(pb0.getBlock()) || BlockStateInterface.isWater(pb1.getBlock())) {
|
||||||
WC = WALK_ONE_IN_WATER_COST;
|
WC = WALK_ONE_IN_WATER_COST;
|
||||||
} else {
|
} else {
|
||||||
if (Blocks.SOUL_SAND.equals(destOn.getBlock())) {
|
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;
|
||||||
}
|
}
|
||||||
if (Blocks.SOUL_SAND.equals(BlockStateInterface.get(src.down()).getBlock())) {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,9 +83,12 @@ public class MovementTraverse extends Movement {
|
|||||||
}
|
}
|
||||||
return WC;
|
return WC;
|
||||||
}
|
}
|
||||||
|
if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) {
|
||||||
|
hardness1 *= 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
|
||||||
Block srcDown = BlockStateInterface.get(src.down()).getBlock();
|
|
||||||
if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) {
|
if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
@ -130,6 +134,8 @@ public class MovementTraverse extends Movement {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.setInput(InputOverrideHandler.Input.SNEAK, false);
|
||||||
|
|
||||||
Block fd = BlockStateInterface.get(src.down()).getBlock();
|
Block fd = BlockStateInterface.get(src.down()).getBlock();
|
||||||
boolean ladder = fd instanceof BlockLadder || fd instanceof BlockVine;
|
boolean ladder = fd instanceof BlockLadder || fd instanceof BlockVine;
|
||||||
IBlockState pb0 = BlockStateInterface.get(positionsToBreak[0]);
|
IBlockState pb0 = BlockStateInterface.get(positionsToBreak[0]);
|
||||||
@ -186,7 +192,7 @@ public class MovementTraverse extends Movement {
|
|||||||
state.setInput(InputOverrideHandler.Input.SPRINT, true);
|
state.setInput(InputOverrideHandler.Input.SPRINT, true);
|
||||||
}
|
}
|
||||||
Block destDown = BlockStateInterface.get(dest.down()).getBlock();
|
Block destDown = BlockStateInterface.get(dest.down()).getBlock();
|
||||||
if (ladder && (destDown instanceof BlockVine || destDown instanceof BlockLadder)) {
|
if (whereAmI.getY() != dest.getY() && ladder && (destDown instanceof BlockVine || destDown instanceof BlockLadder)) {
|
||||||
new MovementPillar(dest.down(), dest).updateState(state); // i'm sorry
|
new MovementPillar(dest.down(), dest).updateState(state); // i'm sorry
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
@ -264,4 +270,15 @@ public class MovementTraverse extends Movement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean prepared(MovementState state) {
|
||||||
|
if (playerFeet().equals(src) || playerFeet().equals(src.down())) {
|
||||||
|
Block block = BlockStateInterface.getBlock(src.down());
|
||||||
|
if (block == Blocks.LADDER || block == Blocks.VINE) {
|
||||||
|
state.setInput(InputOverrideHandler.Input.SNEAK, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.prepared(state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user