From 4cbf55396f509db89a467f8a4817bb652617f3cf Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 21 Jul 2021 21:57:12 +0200 Subject: Add Scroll lock for storage gui so people with scrollable tooltips can scroll in storage gui --- .../notenoughupdates/miscgui/StorageOverlay.java | 5 ++++- .../options/seperateSections/StorageGUI.java | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index b8d6dc38..2dd0fbd1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -40,6 +40,7 @@ import org.lwjgl.util.vector.Vector4f; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.awt.*; +import java.awt.event.KeyEvent; import java.util.*; import java.util.List; @@ -1439,7 +1440,9 @@ public class StorageOverlay extends GuiElement { if(!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) return false; int dWheel = Mouse.getEventDWheel(); - if(dWheel != 0) { + if(dWheel != 0 && + (((NotEnoughUpdates.INSTANCE.config.storageGUI.scrollLock == 0)|| + (NotEnoughUpdates.INSTANCE.config.storageGUI.scrollLock == 1 && !KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.slotLockKey))))) { if(dWheel < 0) { dWheel = -1; if(scrollVelocity > 0) scrollVelocity = 0; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java index 17c25117..2b48bc74 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java @@ -102,6 +102,28 @@ public class StorageGUI { @ConfigAccordionId(id = 1) public String selectedStorageColour = "0:255:255:223:0"; + @Expose + @ConfigOption( + name = "Scroll Lock", + desc = "Stop scrolling when holding the key below.\n"+ + "Usefull for people using scrollable tooltips." + ) + @ConfigEditorDropdown( + values = {"Off", "On"} + ) + @ConfigAccordionId(id = 1) + public int scrollLock = 0; + + @Expose + @ConfigOption( + name = "Scroll Lock Key", + desc = "Hold this keep to stop scrolling in the gui.\n" + + "Don't forget to enable it above." + ) + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_LSHIFT) + @ConfigAccordionId(id = 1) + public int slotLockKey = Keyboard.KEY_LSHIFT; + @ConfigOption( name = "Inventory Backpacks", -- cgit