From a407fa66a2d149091ab0f411275d7bc5feee1d05 Mon Sep 17 00:00:00 2001 From: Brady Date: Tue, 21 Aug 2018 21:07:46 -0500 Subject: [PATCH] Fix placing blocks when in a gui screen and pathing --- .../baritone/launch/mixins/MixinMinecraft.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/baritone/launch/mixins/MixinMinecraft.java b/src/main/java/baritone/launch/mixins/MixinMinecraft.java index 52cbf163..a69a18f4 100755 --- a/src/main/java/baritone/launch/mixins/MixinMinecraft.java +++ b/src/main/java/baritone/launch/mixins/MixinMinecraft.java @@ -18,11 +18,13 @@ package baritone.launch.mixins; import baritone.bot.Baritone; +import baritone.bot.behavior.impl.PathingBehavior; import baritone.bot.event.events.TickEvent; import baritone.bot.event.events.WorldEvent; import baritone.bot.event.events.type.EventState; import baritone.bot.utils.ExampleBaritoneControl; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.multiplayer.WorldClient; import org.spongepowered.asm.lib.Opcodes; import org.spongepowered.asm.mixin.Mixin; @@ -31,6 +33,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; /** * @author Brady @@ -141,4 +144,16 @@ public class MixinMinecraft { ) ); } + + @Redirect( + method = "runTick", + at = @At( + value = "FIELD", + opcode = Opcodes.GETFIELD, + target = "net/minecraft/client/gui/GuiScreen.allowUserInput:Z" + ) + ) + private boolean isAllowUserInput(GuiScreen screen) { + return PathingBehavior.INSTANCE.getCurrent() != null || screen.allowUserInput; + } }