From 40545c0c5de71f78c8529818e4e584a537ef1d8e Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 23 Aug 2018 18:34:40 -0500 Subject: [PATCH] Add player null check to our allowUserInput hook, fixes #81 --- src/main/java/baritone/launch/mixins/MixinMinecraft.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/launch/mixins/MixinMinecraft.java b/src/main/java/baritone/launch/mixins/MixinMinecraft.java index 653c233c..2bb04ef8 100755 --- a/src/main/java/baritone/launch/mixins/MixinMinecraft.java +++ b/src/main/java/baritone/launch/mixins/MixinMinecraft.java @@ -25,6 +25,7 @@ import baritone.event.events.WorldEvent; import baritone.event.events.type.EventState; import baritone.utils.ExampleBaritoneControl; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.item.ItemStack; @@ -48,6 +49,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; public class MixinMinecraft { @Shadow private int leftClickCounter; + @Shadow public EntityPlayerSP player; @Shadow public WorldClient world; @Inject( @@ -160,7 +162,7 @@ public class MixinMinecraft { ) ) private boolean isAllowUserInput(GuiScreen screen) { - return PathingBehavior.INSTANCE.getCurrent() != null || screen.allowUserInput; + return (PathingBehavior.INSTANCE.getCurrent() != null && player != null) || screen.allowUserInput; } @Inject(