From 88b1b0077d01f66722c225155fedad24904e6540 Mon Sep 17 00:00:00 2001 From: slprime Date: Tue, 31 Dec 2024 09:47:07 +0200 Subject: [PATCH] Fixed NEI reload when changing dimension --- .../java/codechicken/nei/NEIClientConfig.java | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/main/java/codechicken/nei/NEIClientConfig.java b/src/main/java/codechicken/nei/NEIClientConfig.java index 22868f2e5..6b9dd5c25 100644 --- a/src/main/java/codechicken/nei/NEIClientConfig.java +++ b/src/main/java/codechicken/nei/NEIClientConfig.java @@ -703,23 +703,25 @@ public static OptionList getOptionList() { public static void loadWorld(String worldPath) { unloadWorld(); - NEIClientConfig.worldPath = worldPath; - setInternalEnabled(true); - logger.debug("Loading " + (Minecraft.getMinecraft().isSingleplayer() ? "Local" : "Remote") + " World"); - final File specificDir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/" + worldPath); - final boolean newWorld = !specificDir.exists(); + if (!worldPath.equals(NEIClientConfig.worldPath)) { + NEIClientConfig.worldPath = worldPath; - if (newWorld) { - specificDir.mkdirs(); - } + logger.debug("Loading " + (Minecraft.getMinecraft().isSingleplayer() ? "Local" : "Remote") + " World"); + + final File specificDir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/" + worldPath); + final boolean newWorld = !specificDir.exists(); - world = new ConfigSet(new File(specificDir, "NEI.dat"), new ConfigFile(new File(specificDir, "NEI.cfg"))); - bootNEI(ClientUtils.getWorld()); - CollapsibleItems.load(); - ItemPanels.bookmarkPanel.load(); - onWorldLoad(newWorld); + if (newWorld) { + specificDir.mkdirs(); + } + + world = new ConfigSet(new File(specificDir, "NEI.dat"), new ConfigFile(new File(specificDir, "NEI.cfg"))); + bootNEI(ClientUtils.getWorld()); + onWorldLoad(newWorld); + ItemPanels.bookmarkPanel.load(); + } } public static String getWorldPath() { @@ -734,7 +736,6 @@ private static void onWorldLoad(boolean newWorld) { creativeInv = new ItemStack[54]; LayoutManager.searchField.setText(getSearchExpression()); ItemPanels.itemPanel.quantity.setText(Integer.toString(getItemQuantity())); - SubsetWidget.loadHidden(); if (newWorld && Minecraft.getMinecraft().isSingleplayer()) world.config.getTag("inventory.cheatmode") .setIntValue(NEIClientUtils.mc().playerController.isInCreativeMode() ? 2 : 0); @@ -818,6 +819,8 @@ public void run() { }); RecipeCatalysts.loadCatalystInfo(); + CollapsibleItems.load(); + SubsetWidget.loadHidden(); ItemSorter.loadConfig(); // Set pluginNEIConfigLoaded here before posting the NEIConfigsLoadedEvent. This used to be the @@ -831,8 +834,6 @@ public void run() { ItemList.loadItems.restart(); } }.start(); - } else { - ItemList.loadItems.restart(); } }