Remove references to null Helper player

This commit is contained in:
Howard Stark 2018-08-02 17:19:49 -04:00
parent 471c170884
commit 7eae7a86b5
No known key found for this signature in database
GPG Key ID: 9FA4E350B33067F3
3 changed files with 4 additions and 6 deletions

View File

@ -9,7 +9,7 @@ import net.minecraft.util.math.BlockPos;
* @author Brady
* @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 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
// moved into the next position
} 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) {
// TODO how to indicate failure? Exception?
}

View File

@ -43,7 +43,7 @@ public abstract class Action implements AbstractGameEventListener, Helper, Actio
ActionState latestState = calcState();
Tuple<Float, Float> rotation = Utils.calcRotationFromVec3d(mc.player.getPositionEyes(1.0F),
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());
latestState.inputState.forEach((input, forced) -> {
Baritone.INSTANCE.getInputOverrideHandler().setInputForceState(input, forced);

View File

@ -12,11 +12,9 @@ import net.minecraft.util.math.BlockPos;
public interface Helper {
Minecraft mc = Minecraft.getMinecraft();
EntityPlayerSP player = mc.player;
WorldClient world = mc.world;
default BlockPos playerFeet() {
return new BlockPos(player.posX, player.posY, player.posZ);
return new BlockPos(mc.player.posX, mc.player.posY, mc.player.posZ);
}
}