Remove references to null Helper player
This commit is contained in:
parent
471c170884
commit
7eae7a86b5
@ -9,7 +9,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
* @author Brady
|
* @author Brady
|
||||||
* @since 8/1/2018 5:38 PM
|
* @since 8/1/2018 5:38 PM
|
||||||
*/
|
*/
|
||||||
public class PathExecution extends Behavior implements Helper {
|
public class PathExecution extends Behavior {
|
||||||
private static final double MAX_DIST_FROM_PATH = 2;
|
private static final double MAX_DIST_FROM_PATH = 2;
|
||||||
private final IPath path;
|
private final IPath path;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ public class PathExecution extends Behavior implements Helper {
|
|||||||
// and only increment it when the movement said it was done, not when it detected that the player feet had
|
// and only increment it when the movement said it was done, not when it detected that the player feet had
|
||||||
// moved into the next position
|
// moved into the next position
|
||||||
} else {
|
} else {
|
||||||
Tuple<Double, BlockPos> closest = path.closestPathPos(player.posX, player.posY, player.posZ);
|
Tuple<Double, BlockPos> closest = path.closestPathPos(mc.player.posX, mc.player.posY, mc.player.posZ);
|
||||||
if (closest.getFirst() > MAX_DIST_FROM_PATH) {
|
if (closest.getFirst() > MAX_DIST_FROM_PATH) {
|
||||||
// TODO how to indicate failure? Exception?
|
// TODO how to indicate failure? Exception?
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public abstract class Action implements AbstractGameEventListener, Helper, Actio
|
|||||||
ActionState latestState = calcState();
|
ActionState latestState = calcState();
|
||||||
Tuple<Float, Float> rotation = Utils.calcRotationFromVec3d(mc.player.getPositionEyes(1.0F),
|
Tuple<Float, Float> rotation = Utils.calcRotationFromVec3d(mc.player.getPositionEyes(1.0F),
|
||||||
latestState.getGoal().rotation);
|
latestState.getGoal().rotation);
|
||||||
player.setPositionAndRotation(mc.player.posX, mc.player.posY, mc.player.posZ,
|
mc.player.setPositionAndRotation(mc.player.posX, mc.player.posY, mc.player.posZ,
|
||||||
rotation.getFirst(), rotation.getSecond());
|
rotation.getFirst(), rotation.getSecond());
|
||||||
latestState.inputState.forEach((input, forced) -> {
|
latestState.inputState.forEach((input, forced) -> {
|
||||||
Baritone.INSTANCE.getInputOverrideHandler().setInputForceState(input, forced);
|
Baritone.INSTANCE.getInputOverrideHandler().setInputForceState(input, forced);
|
||||||
|
@ -12,11 +12,9 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
public interface Helper {
|
public interface Helper {
|
||||||
|
|
||||||
Minecraft mc = Minecraft.getMinecraft();
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
EntityPlayerSP player = mc.player;
|
|
||||||
WorldClient world = mc.world;
|
|
||||||
|
|
||||||
default BlockPos playerFeet() {
|
default BlockPos playerFeet() {
|
||||||
return new BlockPos(player.posX, player.posY, player.posZ);
|
return new BlockPos(mc.player.posX, mc.player.posY, mc.player.posZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user