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/main/java') 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