This commit is contained in:
Leijurv 2018-11-11 18:23:18 -08:00
parent 66769365d0
commit 0ce4107d56
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 15 additions and 8 deletions

View File

@ -19,6 +19,7 @@ package baritone.pathing.movement;
import baritone.Baritone;
import baritone.api.pathing.movement.ActionCosts;
import baritone.cache.WorldData;
import baritone.utils.BlockStateInterface;
import baritone.utils.Helper;
import baritone.utils.ToolSet;
@ -43,6 +44,7 @@ public class CalculationContext {
private final EntityPlayerSP player;
private final World world;
private final WorldData worldData;
private final BlockStateInterface bsi;
private final ToolSet toolSet;
private final boolean hasWaterBucket;
@ -59,7 +61,8 @@ public class CalculationContext {
public CalculationContext() {
this.player = Helper.HELPER.player();
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?
this.toolSet = new ToolSet(player);
this.hasThrowaway = Baritone.settings().allowPlace.get() && MovementHelper.throwaway(false);
@ -90,10 +93,6 @@ public class CalculationContext {
return bsi.isLoaded(x, z);
}
public BlockStateInterface bsi() {
return bsi;
}
public IBlockState get(BlockPos pos) {
return get(pos.getX(), pos.getY(), pos.getZ());
}
@ -132,6 +131,13 @@ public class CalculationContext {
return player;
}
public BlockStateInterface bsi() {
return bsi;
}
public WorldData worldData() {
return worldData;
}
public ToolSet getToolSet() {
return toolSet;

View File

@ -20,6 +20,7 @@ package baritone.utils;
import baritone.Baritone;
import baritone.cache.CachedRegion;
import baritone.cache.WorldData;
import baritone.pathing.movement.CalculationContext;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
@ -53,9 +54,9 @@ public class BlockStateInterface implements Helper {
}
public static IBlockState get(BlockPos pos) {
// this is the version thats called from updatestate and stuff, not from cost calculation
// doesn't need to be fast or cached actually
return Helper.HELPER.world().getBlockState(pos);
return new CalculationContext().get(pos); // immense iq
// can't just do world().get because that doesn't work for out of bounds
// 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) {