diff --git a/src/main/java/codechicken/nei/ClientHandler.java b/src/main/java/codechicken/nei/ClientHandler.java index 84db4012..fa50989f 100644 --- a/src/main/java/codechicken/nei/ClientHandler.java +++ b/src/main/java/codechicken/nei/ClientHandler.java @@ -24,6 +24,7 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiErrorScreen; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiSelectWorld; +import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.resources.IResource; import net.minecraft.entity.Entity; @@ -153,6 +154,7 @@ public class ClientHandler { loadHiddenHandlers(); loadEnableAutoFocus(); loadGuiCraftablesBlacklist(); + loadDefaultBookmarkContainers(); ItemInfo.preInit(); StackInfo.loadGuidFilters(); } @@ -253,6 +255,20 @@ public class ClientHandler { lines -> ItemCraftablesPanel.guiBlacklist = lines.collect(Collectors.toList())); } + public static void loadDefaultBookmarkContainers() { + loadSettingsFile("defaultbookmarkcontainers.cfg", lines -> { + for (String clazz : lines.collect(Collectors.toList())) { + try { + API.registerBookmarkContainerHandler( + (Class) Class.forName(clazz), + new DefaultBookmarkContainerHandler()); + } catch (Exception e) { + NEIClientConfig.logger.error("Failed to load class '{}' for defaultbookmarkcontainers.cfg", clazz); + } + } + }); + } + public static void loadHiddenItems() { loadSettingsFile("hiddenitems.cfg", lines -> lines.forEach(API::hideItem)); } diff --git a/src/main/resources/assets/nei/cfg/defaultbookmarkcontainers.cfg b/src/main/resources/assets/nei/cfg/defaultbookmarkcontainers.cfg new file mode 100644 index 00000000..3b259b26 --- /dev/null +++ b/src/main/resources/assets/nei/cfg/defaultbookmarkcontainers.cfg @@ -0,0 +1,5 @@ +# This file contains a list of GUIs that can use the DefaultBookmarkContainerHandler for bookmarks. +# It serves as an alternative to API.registerBookmarkContainerHandler and is intended for cases +# where you can't modify the mod itself and its GUI doesn't have custom slots. +# Each line in this file should either be a comment (starting with '#') or a guiContainer class name. +# If you delete this file, it will be regenerated with the default bookmark containers list. \ No newline at end of file diff --git a/src/main/resources/assets/nei/cfg/guicraftablesblacklist.cfg b/src/main/resources/assets/nei/cfg/guicraftablesblacklist.cfg index 70b20c7c..26bb16b8 100644 --- a/src/main/resources/assets/nei/cfg/guicraftablesblacklist.cfg +++ b/src/main/resources/assets/nei/cfg/guicraftablesblacklist.cfg @@ -1,4 +1,5 @@ -# Each line in this file should either be a comment (line starts with '#'), handler name or handler id. +# This file contains a list of GUIs for which craftable item panels will not work. +# Each line in this file should either be a comment (line starts with '#'), or guiContainer class name. # If you delete this file, it will be regenerated with the default handlers list. appeng.client.gui.implementations.GuiPatternTerm appeng.client.gui.implementations.GuiPatternTermEx