fix strange issue when exiting and entering the same world
This commit is contained in:
parent
aca487f97e
commit
c0bc7b5ecd
@ -39,6 +39,7 @@ import baritone.api.event.events.*;
|
||||
import baritone.api.event.events.type.EventState;
|
||||
import baritone.api.event.listener.IGameEventListener;
|
||||
import baritone.chunk.WorldProvider;
|
||||
import baritone.utils.BlockStateInterface;
|
||||
import baritone.utils.Helper;
|
||||
import baritone.utils.InputOverrideHandler;
|
||||
import baritone.utils.interfaces.Toggleable;
|
||||
@ -133,6 +134,8 @@ public final class GameEventHandler implements IGameEventListener, Helper {
|
||||
public final void onWorldEvent(WorldEvent event) {
|
||||
WorldProvider cache = WorldProvider.INSTANCE;
|
||||
|
||||
BlockStateInterface.clearCachedChunk();
|
||||
|
||||
switch (event.getState()) {
|
||||
case PRE:
|
||||
break;
|
||||
|
@ -31,7 +31,7 @@ import net.minecraft.world.chunk.Chunk;
|
||||
public class BlockStateInterface implements Helper {
|
||||
|
||||
private static Chunk prev = null;
|
||||
|
||||
|
||||
public static IBlockState get(BlockPos pos) { // wrappers for chunk caching capability
|
||||
|
||||
// Invalid vertical position
|
||||
@ -66,6 +66,10 @@ public class BlockStateInterface implements Helper {
|
||||
return Blocks.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
public static void clearCachedChunk() {
|
||||
prev = null;
|
||||
}
|
||||
|
||||
public static Block getBlock(BlockPos pos) {
|
||||
return get(pos).getBlock();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user