mirror of
https://github.com/cabaletta/baritone
synced 2025-01-02 20:52:09 +00:00
Add support for nether vines
This commit is contained in:
parent
e8bcd0535d
commit
292eaef25e
@ -65,7 +65,7 @@ public class MovementPillar extends Movement {
|
||||
public static double cost(CalculationContext context, int x, int y, int z) {
|
||||
BlockState fromState = context.get(x, y, z);
|
||||
Block from = fromState.getBlock();
|
||||
boolean ladder = from == Blocks.LADDER || from == Blocks.VINE;
|
||||
boolean ladder = from == Blocks.LADDER || from == Blocks.VINE || from == Blocks.WEEPING_VINES || from == Blocks.TWISTING_VINES || from == Blocks.WEEPING_VINES_PLANT || from == Blocks.TWISTING_VINES_PLANT;
|
||||
BlockState fromDown = context.get(x, y - 1, z);
|
||||
if (!ladder) {
|
||||
if (fromDown.getBlock() == Blocks.LADDER || fromDown.getBlock() == Blocks.VINE) {
|
||||
@ -116,7 +116,7 @@ public class MovementPillar extends Movement {
|
||||
return COST_INF;
|
||||
}
|
||||
if (hardness != 0) {
|
||||
if (toBreakBlock == Blocks.LADDER || toBreakBlock == Blocks.VINE) {
|
||||
if (toBreakBlock == Blocks.LADDER || toBreakBlock == Blocks.VINE || toBreakBlock == Blocks.WEEPING_VINES || toBreakBlock == Blocks.TWISTING_VINES) {
|
||||
hardness = 0; // we won't actually need to break the ladder / vine because we're going to use it
|
||||
} else {
|
||||
BlockState check = context.get(x, y + 3, z); // the block on top of the one we're going to break, could it fall on us?
|
||||
@ -194,10 +194,12 @@ public class MovementPillar extends Movement {
|
||||
}
|
||||
boolean ladder = fromDown.getBlock() == Blocks.LADDER || fromDown.getBlock() == Blocks.VINE;
|
||||
boolean vine = fromDown.getBlock() == Blocks.VINE;
|
||||
boolean nether_vine = fromDown.getBlock() == Blocks.WEEPING_VINES || fromDown.getBlock() == Blocks.TWISTING_VINES || fromDown.getBlock() == Blocks.WEEPING_VINES_PLANT || fromDown.getBlock() == Blocks.TWISTING_VINES_PLANT;
|
||||
|
||||
Rotation rotation = RotationUtils.calcRotationFromVec3d(ctx.playerHead(),
|
||||
VecUtils.getBlockPosCenter(positionToPlace),
|
||||
ctx.playerRotations());
|
||||
if (!ladder) {
|
||||
if (!(ladder || nether_vine)) {
|
||||
state.setTarget(new MovementState.MovementTarget(ctx.playerRotations().withPitch(rotation.getPitch()), true));
|
||||
}
|
||||
|
||||
@ -223,6 +225,13 @@ public class MovementPillar extends Movement {
|
||||
|
||||
MovementHelper.moveTowards(ctx, state, against);
|
||||
return state;
|
||||
} else if (nether_vine) {
|
||||
if (ctx.playerFeet().equals(dest)) {
|
||||
return state.setStatus(MovementStatus.SUCCESS);
|
||||
}
|
||||
MovementHelper.moveTowards(ctx, state, dest);
|
||||
state.setInput(Input.JUMP, true);
|
||||
return state;
|
||||
} else {
|
||||
// Get ready to place a throwaway block
|
||||
if (!((Baritone) baritone).getInventoryBehavior().selectThrowawayForLocation(true, src.x, src.y, src.z)) {
|
||||
|
@ -114,13 +114,13 @@ public class MovementTraverse extends Movement {
|
||||
}
|
||||
return WC;
|
||||
}
|
||||
if (srcDownBlock == Blocks.LADDER || srcDownBlock == Blocks.VINE) {
|
||||
if (srcDownBlock == Blocks.LADDER || srcDownBlock == Blocks.VINE || srcDownBlock == Blocks.WEEPING_VINES || srcDownBlock == Blocks.TWISTING_VINES || srcDownBlock == Blocks.WEEPING_VINES_PLANT || srcDownBlock == Blocks.TWISTING_VINES_PLANT) {
|
||||
hardness1 *= 5;
|
||||
hardness2 *= 5;
|
||||
}
|
||||
return WC + hardness1 + hardness2;
|
||||
} else {//this is a bridge, so we need to place a block
|
||||
if (srcDownBlock == Blocks.LADDER || srcDownBlock == Blocks.VINE) {
|
||||
if (srcDownBlock == Blocks.LADDER || srcDownBlock == Blocks.VINE || srcDownBlock == Blocks.WEEPING_VINES || srcDownBlock == Blocks.TWISTING_VINES || srcDownBlock == Blocks.WEEPING_VINES_PLANT || srcDownBlock == Blocks.TWISTING_VINES_PLANT) {
|
||||
return COST_INF;
|
||||
}
|
||||
if (MovementHelper.isReplaceable(destX, y - 1, destZ, destOn, context.bsi)) {
|
||||
@ -217,7 +217,7 @@ public class MovementTraverse extends Movement {
|
||||
state.setInput(Input.SNEAK, false);
|
||||
|
||||
Block fd = BlockStateInterface.get(ctx, src.below()).getBlock();
|
||||
boolean ladder = fd == Blocks.LADDER || fd == Blocks.VINE;
|
||||
boolean ladder = fd == Blocks.LADDER || fd == Blocks.VINE || fd == Blocks.WEEPING_VINES || fd == Blocks.TWISTING_VINES || fd == Blocks.WEEPING_VINES_PLANT || fd == Blocks.TWISTING_VINES_PLANT;
|
||||
|
||||
if (pb0.getBlock() instanceof DoorBlock || pb1.getBlock() instanceof DoorBlock) {
|
||||
boolean notPassable = pb0.getBlock() instanceof DoorBlock && !MovementHelper.isDoorPassable(ctx, src, dest) || pb1.getBlock() instanceof DoorBlock && !MovementHelper.isDoorPassable(ctx, dest, src);
|
||||
@ -370,7 +370,7 @@ public class MovementTraverse extends Movement {
|
||||
protected boolean prepared(MovementState state) {
|
||||
if (ctx.playerFeet().equals(src) || ctx.playerFeet().equals(src.below())) {
|
||||
Block block = BlockStateInterface.getBlock(ctx, src.below());
|
||||
if (block == Blocks.LADDER || block == Blocks.VINE) {
|
||||
if (block == Blocks.LADDER || block == Blocks.VINE || block == Blocks.WEEPING_VINES || block == Blocks.TWISTING_VINES || block == Blocks.WEEPING_VINES_PLANT || block == Blocks.TWISTING_VINES_PLANT) {
|
||||
state.setInput(Input.SNEAK, true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user