fix strange issue when exiting and entering the same world

This commit is contained in:
Leijurv 2018-09-01 12:26:55 -07:00
parent aca487f97e
commit c0bc7b5ecd
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 8 additions and 1 deletions

View File

@ -39,6 +39,7 @@ import baritone.api.event.events.*;
import baritone.api.event.events.type.EventState; import baritone.api.event.events.type.EventState;
import baritone.api.event.listener.IGameEventListener; import baritone.api.event.listener.IGameEventListener;
import baritone.chunk.WorldProvider; import baritone.chunk.WorldProvider;
import baritone.utils.BlockStateInterface;
import baritone.utils.Helper; import baritone.utils.Helper;
import baritone.utils.InputOverrideHandler; import baritone.utils.InputOverrideHandler;
import baritone.utils.interfaces.Toggleable; import baritone.utils.interfaces.Toggleable;
@ -133,6 +134,8 @@ public final class GameEventHandler implements IGameEventListener, Helper {
public final void onWorldEvent(WorldEvent event) { public final void onWorldEvent(WorldEvent event) {
WorldProvider cache = WorldProvider.INSTANCE; WorldProvider cache = WorldProvider.INSTANCE;
BlockStateInterface.clearCachedChunk();
switch (event.getState()) { switch (event.getState()) {
case PRE: case PRE:
break; break;

View File

@ -66,6 +66,10 @@ public class BlockStateInterface implements Helper {
return Blocks.AIR.getDefaultState(); return Blocks.AIR.getDefaultState();
} }
public static void clearCachedChunk() {
prev = null;
}
public static Block getBlock(BlockPos pos) { public static Block getBlock(BlockPos pos) {
return get(pos).getBlock(); return get(pos).getBlock();
} }