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;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public class MovementPillar extends Movement {
|
public class MovementPillar extends Movement {
|
||||||
private int numTicks = 0;
|
|
||||||
|
|
||||||
public MovementPillar(BetterBlockPos start, BetterBlockPos end) {
|
public MovementPillar(BetterBlockPos start, BetterBlockPos end) {
|
||||||
super(start, end, new BetterBlockPos[]{start.up(2)}, start);
|
super(start, end, new BetterBlockPos[]{start.up(2)}, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reset() {
|
|
||||||
super.reset();
|
|
||||||
numTicks = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double calculateCost(CalculationContext context) {
|
protected double calculateCost(CalculationContext context) {
|
||||||
return cost(context, src.x, src.y, src.z);
|
return cost(context, src.x, src.y, src.z);
|
||||||
@ -202,24 +195,21 @@ public class MovementPillar extends Movement {
|
|||||||
return state.setStatus(MovementStatus.UNREACHABLE);
|
return state.setStatus(MovementStatus.UNREACHABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
numTicks++;
|
|
||||||
// If our Y coordinate is above our goal, stop jumping
|
// If our Y coordinate is above our goal, stop jumping
|
||||||
state.setInput(InputOverrideHandler.Input.JUMP, player().posY < dest.getY());
|
state.setInput(InputOverrideHandler.Input.JUMP, player().posY < dest.getY());
|
||||||
state.setInput(InputOverrideHandler.Input.SNEAK, true);
|
state.setInput(InputOverrideHandler.Input.SNEAK, true);
|
||||||
|
|
||||||
// Otherwise jump
|
double diffX = player().posX - (dest.getX() + 0.5);
|
||||||
if (numTicks > 20) {
|
double diffZ = player().posZ - (dest.getZ() + 0.5);
|
||||||
double diffX = player().posX - (dest.getX() + 0.5);
|
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
|
||||||
double diffZ = player().posZ - (dest.getZ() + 0.5);
|
if (dist > 0.17) {//why 0.17? because it seemed like a good number, that's why
|
||||||
double dist = Math.sqrt(diffX * diffX + diffZ * diffZ);
|
//[explanation added after baritone port lol] also because it needs to be less than 0.2 because of the 0.3 sneak limit
|
||||||
if (dist > 0.17) {//why 0.17? because it seemed like a good number, that's why
|
//and 0.17 is reasonably less than 0.2
|
||||||
//[explanation added after baritone port lol] also because it needs to be less than 0.2 because of the 0.3 sneak limit
|
|
||||||
//and 0.17 is reasonably less than 0.2
|
|
||||||
|
|
||||||
// If it's been more than forty ticks of trying to jump and we aren't done yet, go forward, maybe we are stuck
|
// 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);
|
state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!blockIsThere) {
|
if (!blockIsThere) {
|
||||||
Block fr = BlockStateInterface.get(src).getBlock();
|
Block fr = BlockStateInterface.get(src).getBlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user