Compare commits

..
Author SHA1 Message Date
Wilhelm Schuster 30c87e9160 Make sure NEI plugins are loaded before processing keybindings (#375)
NEI plugins are initialized in a separate thread. If this takes too long,
the client tick handler might already be running checking the keybindings
in KeyManager while a plugin calls API.addKeyBind() which can lead to a
CME.

Reported in https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/13292
Thanks to @Denostrov for helping me track this down.
2023-05-05 21:01:50 +02:00
chill 5eeb001534 Readme: fix wording (#374) 2023-05-05 12:16:22 +02:00
3 changed files with 11 additions and 4 deletions

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@ If you have issues with NEI outside of the GTNH modpack you may report them in t
- Uses a parallel stream to search the item list over multiple cores, resulting in 2-6x faster searches on average
- Loads the recipe handlers in parallel
* A textbox for search with most of the features you'd expect - moving forward, backwards, selection, etc
* Bookmarks! What are you in the process of crafting? Bookmark it using either 'A' or configure your own key.
* Bookmarks! Are you in the process of crafting? Bookmark it using either 'A' or configure your own key.
* Toggle bookmark pane. Default shortcut key `B`. Item Subsets menu is only available if bookmarks are not visible.
* Utility/Cheat buttons line up and wrap based on GUI size
* ItemList is no longer regenerated from the ItemRegistry on every inventory load
@@ -276,7 +276,11 @@ public class ClientHandler {
if (!NEIClientConfig.isEnabled()) return;
KeyManager.tickKeyStates();
/*
* NEI plugins are loaded in a separate thread. Make sure loading them has finished otherwise a CME might
* occur in KeyManager if a plugin calls API.addKeyBind() during initialization.
*/
if (NEIClientConfig.isLoaded()) KeyManager.tickKeyStates();
NEIController.updateUnlimitedItems(mc.thePlayer.inventory);
if (mc.currentScreen == null) NEIController.processCreativeCycling(mc.thePlayer.inventory);
@@ -472,8 +472,6 @@ public class NEIClientConfig {
NEIController.load();
RecipeCatalysts.loadCatalystInfo();
configLoaded = true;
new Thread("NEI Plugin Loader") {
@Override
@@ -496,6 +494,7 @@ public class NEIClientConfig {
}
MinecraftForge.EVENT_BUS.post(new NEIConfigsLoadedEvent());
configLoaded = true;
}
}.start();
ItemSorter.loadConfig();
@@ -597,6 +596,10 @@ public class NEIClientConfig {
return enabledOverride && getBooleanSetting("inventory.widgetsenabled");
}
public static boolean isLoaded() {
return configLoaded;
}
public static boolean loadHandlersFromJar() {
return !getBooleanSetting("tools.handler_load_from_config");
}