From 647902c019e26c6600930b243b99ae1c44ae8cbf Mon Sep 17 00:00:00 2001 From: MAGGen-hub <56871670+MAGGen-hub@users.noreply.github.com> Date: Sun, 19 Sep 2021 13:24:55 +0300 Subject: [PATCH] Allow using mouse in off-hand pocket computer screen (#918) --- .../client/gui/NoTermComputerScreen.java | 11 +++++++++++ src/main/resources/META-INF/accesstransformer.cfg | 1 + 2 files changed, 12 insertions(+) diff --git a/src/main/java/dan200/computercraft/client/gui/NoTermComputerScreen.java b/src/main/java/dan200/computercraft/client/gui/NoTermComputerScreen.java index ca1edee7a..49f101fb0 100644 --- a/src/main/java/dan200/computercraft/client/gui/NoTermComputerScreen.java +++ b/src/main/java/dan200/computercraft/client/gui/NoTermComputerScreen.java @@ -43,6 +43,10 @@ public class NoTermComputerScreen extends Scree @Override protected void init() { + this.passEvents = true; // to allow gui click events pass through mouseHelper protection (see MouseHelper.OnPres:105 code string) + minecraft.mouseHandler.grabMouse(); + minecraft.screen = this; + super.init(); minecraft.keyboardHandler.setSendRepeatsToGui( true ); @@ -66,6 +70,13 @@ public class NoTermComputerScreen extends Scree terminal.update(); } + @Override + public boolean mouseScrolled( double pMouseX, double pMouseY, double pDelta ) + { + minecraft.player.inventory.swapPaint( pDelta ); + return super.mouseScrolled( pMouseX, pMouseY, pDelta ); + } + @Override public void onClose() { diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 6e87a36ff..55977f889 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -5,3 +5,4 @@ public net.minecraft.client.renderer.FirstPersonRenderer func_228403_a_(Lcom/moj # ClientTableFormatter public net.minecraft.client.gui.NewChatGui func_146234_a(Lnet/minecraft/util/text/ITextComponent;I)V # printChatMessageWithOptionalDeletion public net.minecraft.client.gui.NewChatGui func_146242_c(I)V # deleteChatLine +public net.minecraft.client.Minecraft field_71462_r # currentScreen