From ebe3f457c6325bacbc3edbc5e576ddfdca568ae4 Mon Sep 17 00:00:00 2001 From: Brady Date: Sat, 7 Mar 2020 20:27:29 -0600 Subject: [PATCH] Fix additional injection points in 1.13.2 --- .../baritone/launch/mixins/MixinNetHandlerPlayClient.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java b/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java index 31a5611a..3c7725c3 100644 --- a/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java +++ b/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java @@ -87,7 +87,8 @@ public class MixinNetHandlerPlayClient { ) private void preChunkUnload(SPacketUnloadChunk packet, CallbackInfo ci) { for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) { - if (ibaritone.getPlayerContext().player().connection == (NetHandlerPlayClient) (Object) this) { + EntityPlayerSP player = ibaritone.getPlayerContext().player(); + if (player != null && player.connection == (NetHandlerPlayClient) (Object) this) { ibaritone.getGameEventHandler().onChunkEvent( new ChunkEvent(EventState.PRE, ChunkEvent.Type.UNLOAD, packet.getX(), packet.getZ()) ); @@ -101,7 +102,8 @@ public class MixinNetHandlerPlayClient { ) private void postChunkUnload(SPacketUnloadChunk packet, CallbackInfo ci) { for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) { - if (ibaritone.getPlayerContext().player().connection == (NetHandlerPlayClient) (Object) this) { + EntityPlayerSP player = ibaritone.getPlayerContext().player(); + if (player != null && player.connection == (NetHandlerPlayClient) (Object) this) { ibaritone.getGameEventHandler().onChunkEvent( new ChunkEvent(EventState.POST, ChunkEvent.Type.UNLOAD, packet.getX(), packet.getZ()) );