center pillar regardless of timing
This commit is contained in:
parent
089037663e
commit
9bd205f190
@ -35,18 +35,11 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class MovementPillar extends Movement {
|
||||
private int numTicks = 0;
|
||||
|
||||
public MovementPillar(BetterBlockPos start, BetterBlockPos end) {
|
||||
super(start, end, new BetterBlockPos[]{start.up(2)}, start);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
numTicks = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
return cost(context, src.x, src.y, src.z);
|
||||
@ -202,13 +195,10 @@ public class MovementPillar extends Movement {
|
||||
return state.setStatus(MovementStatus.UNREACHABLE);
|
||||
}
|
||||
|
||||
numTicks++;
|
||||
// If our Y coordinate is above our goal, stop jumping
|
||||
state.setInput(InputOverrideHandler.Input.JUMP, player().posY < dest.getY());
|
||||
state.setInput(InputOverrideHandler.Input.SNEAK, true);
|
||||
|
||||
// Otherwise jump
|
||||
if (numTicks > 20) {
|
||||
double diffX = player().posX - (dest.getX() + 0.5);
|
||||
double diffZ = player().posZ - (dest.getZ() + 0.5);
|
||||
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
|
||||
@ -219,7 +209,7 @@ public class MovementPillar extends Movement {
|
||||
// If it's been more than forty ticks of trying to jump and we aren't done yet, go forward, maybe we are stuck
|
||||
state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!blockIsThere) {
|
||||
Block fr = BlockStateInterface.get(src).getBlock();
|
||||
|
Loading…
Reference in New Issue
Block a user