Skip to content

Commit

Permalink
Fixed NEI reload when changing dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
slprime committed Dec 31, 2024
1 parent 8dd36f1 commit 88b1b00
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/main/java/codechicken/nei/NEIClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -831,8 +834,6 @@ public void run() {
ItemList.loadItems.restart();
}
}.start();
} else {
ItemList.loadItems.restart();
}
}

Expand Down

0 comments on commit 88b1b00

Please sign in to comment.