From 4f852c5b9bbbf83b55086da047d4f5fc0a5ede3f Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Fri, 27 Aug 2021 19:50:09 +0200 Subject: we be fixing --- .../notenoughupdates/NEUEventListener.java | 6 +++-- .../miscfeatures/StorageManager.java | 31 ++++++++++++---------- .../notenoughupdates/miscgui/StorageOverlay.java | 21 +++++++-------- 3 files changed, 31 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index ea9994a7..c7e89e9b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1399,8 +1399,10 @@ public class NEUEventListener { if(containerName.endsWith(" Profile") && eventGui.getSlotUnderMouse() != null && eventGui.getSlotUnderMouse().getSlotIndex() == 34 && Mouse.getEventButton() >= 0) { event.setCanceled(true); - Utils.playPressSound(); - NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{containerName.replaceAll("'s? Profile", "")}); + if(Mouse.getEventButtonState()) { + Utils.playPressSound(); + NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{containerName.replaceAll("'s? Profile", "")}); + } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index 03e6b98e..b85b79fe 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -166,6 +166,7 @@ public class StorageManager { public static class StorageConfig { public HashMap pages = new HashMap<>(); public final HashMap displayToStorageIdMap = new HashMap<>(); + public final HashMap displayToStorageIdMapRender = new HashMap<>(); } public StorageConfig storageConfig = new StorageConfig(); @@ -491,21 +492,22 @@ public class StorageManager { if(changed) { synchronized(storageConfig.displayToStorageIdMap) { storageConfig.displayToStorageIdMap.clear(); + storageConfig.displayToStorageIdMapRender.clear(); int displayIndex = 0; for(int i=0; i 0) { updateSearchForPage(searchStr, page); if(page.matchesSearch) { - storageConfig.displayToStorageIdMap.put(displayIndex++, i); + storageConfig.displayToStorageIdMapRender.put(displayIndex++, i); } } else { - storageConfig.displayToStorageIdMap.put(displayIndex++, i); + storageConfig.displayToStorageIdMapRender.put(displayIndex++, i); page.matchesSearch = true; page.searchedId = sid; } 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 6b459ecb..78402a7f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -125,12 +125,12 @@ public class StorageOverlay extends GuiElement { private LerpingInteger scroll = new LerpingInteger(0, 200); private int getMaximumScroll() { - synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMap) { + synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMapRender) { int maxH = 0; for(int i=0; i<3; i++) { - int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size()-1; + int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.size()-1; int coords = (int)Math.ceil(lastDisplayId/3f)*3+1+i; int h = getPageCoords(coords).y+scroll.getValue()-getStorageViewSize()-14; @@ -305,8 +305,8 @@ public class StorageOverlay extends GuiElement { int startY = getPageCoords(0).y; if(OpenGlHelper.isFramebufferEnabled()) { int h; - synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMap) { - int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size()-1; + synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMapRender) { + int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.size()-1; int coords = (int)Math.ceil(lastDisplayId/3f)*3+3; h = getPageCoords(coords).y+scroll.getValue(); @@ -363,7 +363,7 @@ public class StorageOverlay extends GuiElement { if(doItemRender) { enchantGlintRenderLocations.clear(); - for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) { int displayId = entry.getKey(); int storageId = entry.getValue(); @@ -583,7 +583,7 @@ public class StorageOverlay extends GuiElement { } GlScissorStack.push(0, guiTop+3, width, guiTop+3+storageViewSize, scaledResolution); - for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) { int displayId = entry.getKey(); int storageId = entry.getValue(); @@ -1427,10 +1427,10 @@ public class StorageOverlay extends GuiElement { for(int j=i; j guiTop+3 && mouseY < guiTop+storageViewSize+3) { int currentPage = StorageManager.getInstance().getCurrentPageId(); - - for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) { IntPair pageCoords = getPageCoords(entry.getKey()); if(pageCoords.y > storageViewSize+3 || pageCoords.y+90 < 3) continue; @@ -1854,7 +1853,7 @@ public class StorageOverlay extends GuiElement { if(Keyboard.getEventKeyState()) { if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking && - KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockKey)) { + KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockKey) && !searchBar.getFocus()) { if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) return true; GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen; -- cgit From 7e065b9d6b8763377a3c3fbec68145aa8cf79778 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 30 Aug 2021 10:27:25 +0200 Subject: fix da fix --- .../github/moulberry/notenoughupdates/miscfeatures/StorageManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index b85b79fe..530833f9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -380,7 +380,7 @@ public class StorageManager { public int getDisplayIdForStorageId(int storageId) { if(storageId < 0) return -1; - for(Map.Entry entry : storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry entry : storageConfig.displayToStorageIdMapRender.entrySet()) { if(entry.getValue() == storageId) { return entry.getKey(); } -- cgit From 8e43f9f23835e802b5caea2585db8a50a6408fbb Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 30 Aug 2021 10:53:02 +0200 Subject: fix shift click delay --- .../io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java | 2 ++ 1 file changed, 2 insertions(+) (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 78402a7f..bc96b732 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -1543,6 +1543,8 @@ public class StorageOverlay extends GuiElement { if(mouseX > guiLeft+181 && mouseX < guiLeft+181+162 && mouseY > guiTop+storageViewSize+18 && mouseY < guiTop+storageViewSize+94) { + if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + dirty = true; return false; } -- cgit From b0164aa3994e4b74c6d7a15c1fe5d03f16dcba2e Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 30 Aug 2021 13:05:10 +0200 Subject: last thing --- .../notenoughupdates/miscfeatures/StorageManager.java | 10 ++++++++++ .../moulberry/notenoughupdates/miscgui/StorageOverlay.java | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index 530833f9..3a3aec6d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -379,6 +379,16 @@ public class StorageManager { } public int getDisplayIdForStorageId(int storageId) { + if(storageId < 0) return -1; + for(Map.Entry entry : storageConfig.displayToStorageIdMap.entrySet()) { + if(entry.getValue() == storageId) { + return entry.getKey(); + } + } + return -1; + } + + public int getDisplayIdForStorageIdRender(int storageId) { if(storageId < 0) return -1; for(Map.Entry entry : storageConfig.displayToStorageIdMapRender.entrySet()) { if(entry.getValue() == storageId) { 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 bc96b732..d80a5daf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -1705,7 +1705,7 @@ public class StorageOverlay extends GuiElement { } else if(Mouse.getEventButtonState() && Mouse.getEventButton() == 0) { for(int i=0; i<9; i++) { int storageId = i; - int displayId = StorageManager.getInstance().getDisplayIdForStorageId(i); + int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(i); StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false); if(page != null) { @@ -1722,7 +1722,7 @@ public class StorageOverlay extends GuiElement { } for(int i=0; i<18; i++) { int storageId = i+StorageManager.MAX_ENDER_CHEST_PAGES; - int displayId = StorageManager.getInstance().getDisplayIdForStorageId(i); + int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(i); StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false); if(page != null) { @@ -1805,7 +1805,7 @@ public class StorageOverlay extends GuiElement { } } else { int currentPage = StorageManager.getInstance().getCurrentPageId(); - int displayId = StorageManager.getInstance().getDisplayIdForStorageId(currentPage); + int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(currentPage); if(displayId >= 0) { IntPair pageCoords = getPageCoords(displayId); -- cgit