Fix incorrect references to player and world

This commit is contained in:
Brady
2023-06-12 21:12:49 -05:00
parent c217a34f13
commit 2022d33d03
2 changed files with 6 additions and 6 deletions

View File

@@ -38,13 +38,13 @@ public class SurfaceCommand extends Command {
@Override
public void execute(String label, IArgConsumer args) throws CommandException {
final BetterBlockPos playerPos = baritone.getPlayerContext().playerFeet();
final int surfaceLevel = baritone.getPlayerContext().world().getSeaLevel();
final int worldHeight = baritone.getPlayerContext().world().getActualHeight();
final BetterBlockPos playerPos = ctx.playerFeet();
final int surfaceLevel = ctx.world().getSeaLevel();
final int worldHeight = ctx.world().getActualHeight();
// Ensure this command will not run if you are above the surface level and the block above you is air
// As this would imply that your are already on the open surface
if (playerPos.getY() > surfaceLevel && mc.world.getBlockState(playerPos.up()).getBlock() instanceof BlockAir) {
if (playerPos.getY() > surfaceLevel && ctx.world().getBlockState(playerPos.up()).getBlock() instanceof BlockAir) {
logDirect("Already at surface");
return;
}

View File

@@ -34,14 +34,14 @@ public class InventoryPauserProcess extends BaritoneProcessHelper {
@Override
public boolean isActive() {
if (mc.player == null || mc.world == null) {
if (ctx.player() == null || ctx.world() == null) {
return false;
}
return true;
}
private double motion() {
return Math.sqrt(mc.player.motionX * mc.player.motionX + mc.player.motionZ * mc.player.motionZ);
return Math.sqrt(ctx.player().motionX * ctx.player().motionX + ctx.player().motionZ * ctx.player().motionZ);
}
private boolean stationaryNow() {