"fix" it
This commit is contained in:
parent
66769365d0
commit
0ce4107d56
@ -19,6 +19,7 @@ package baritone.pathing.movement;
|
|||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
import baritone.api.pathing.movement.ActionCosts;
|
import baritone.api.pathing.movement.ActionCosts;
|
||||||
|
import baritone.cache.WorldData;
|
||||||
import baritone.utils.BlockStateInterface;
|
import baritone.utils.BlockStateInterface;
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
import baritone.utils.ToolSet;
|
import baritone.utils.ToolSet;
|
||||||
@ -43,6 +44,7 @@ public class CalculationContext {
|
|||||||
|
|
||||||
private final EntityPlayerSP player;
|
private final EntityPlayerSP player;
|
||||||
private final World world;
|
private final World world;
|
||||||
|
private final WorldData worldData;
|
||||||
private final BlockStateInterface bsi;
|
private final BlockStateInterface bsi;
|
||||||
private final ToolSet toolSet;
|
private final ToolSet toolSet;
|
||||||
private final boolean hasWaterBucket;
|
private final boolean hasWaterBucket;
|
||||||
@ -59,7 +61,8 @@ public class CalculationContext {
|
|||||||
public CalculationContext() {
|
public CalculationContext() {
|
||||||
this.player = Helper.HELPER.player();
|
this.player = Helper.HELPER.player();
|
||||||
this.world = Helper.HELPER.world();
|
this.world = Helper.HELPER.world();
|
||||||
this.bsi = new BlockStateInterface(world, Baritone.INSTANCE.getWorldProvider().getCurrentWorld()); // TODO TODO TODO
|
this.worldData = Baritone.INSTANCE.getWorldProvider().getCurrentWorld();
|
||||||
|
this.bsi = new BlockStateInterface(world, worldData); // TODO TODO TODO
|
||||||
// new CalculationContext() needs to happen, can't add an argument (i'll beat you), can we get the world provider from currentlyTicking?
|
// new CalculationContext() needs to happen, can't add an argument (i'll beat you), can we get the world provider from currentlyTicking?
|
||||||
this.toolSet = new ToolSet(player);
|
this.toolSet = new ToolSet(player);
|
||||||
this.hasThrowaway = Baritone.settings().allowPlace.get() && MovementHelper.throwaway(false);
|
this.hasThrowaway = Baritone.settings().allowPlace.get() && MovementHelper.throwaway(false);
|
||||||
@ -90,10 +93,6 @@ public class CalculationContext {
|
|||||||
return bsi.isLoaded(x, z);
|
return bsi.isLoaded(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockStateInterface bsi() {
|
|
||||||
return bsi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IBlockState get(BlockPos pos) {
|
public IBlockState get(BlockPos pos) {
|
||||||
return get(pos.getX(), pos.getY(), pos.getZ());
|
return get(pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
@ -132,6 +131,13 @@ public class CalculationContext {
|
|||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockStateInterface bsi() {
|
||||||
|
return bsi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorldData worldData() {
|
||||||
|
return worldData;
|
||||||
|
}
|
||||||
|
|
||||||
public ToolSet getToolSet() {
|
public ToolSet getToolSet() {
|
||||||
return toolSet;
|
return toolSet;
|
||||||
|
@ -20,6 +20,7 @@ package baritone.utils;
|
|||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
import baritone.cache.CachedRegion;
|
import baritone.cache.CachedRegion;
|
||||||
import baritone.cache.WorldData;
|
import baritone.cache.WorldData;
|
||||||
|
import baritone.pathing.movement.CalculationContext;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
@ -53,9 +54,9 @@ public class BlockStateInterface implements Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static IBlockState get(BlockPos pos) {
|
public static IBlockState get(BlockPos pos) {
|
||||||
// this is the version thats called from updatestate and stuff, not from cost calculation
|
return new CalculationContext().get(pos); // immense iq
|
||||||
// doesn't need to be fast or cached actually
|
// can't just do world().get because that doesn't work for out of bounds
|
||||||
return Helper.HELPER.world().getBlockState(pos);
|
// and toBreak and stuff fails when the movement is instantiated out of load range but it's not able to BlockStateInterface.get what it's going to walk on
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBlockState get0(int x, int y, int z) {
|
public IBlockState get0(int x, int y, int z) {
|
||||||
|
Loading…
Reference in New Issue
Block a user