Files
NotEnoughItems/src/main/java/codechicken/nei/BookmarkContainerInfo.java
T
Ryan Nasers bd5946f5bf Fix the case where the bookmark key is the same key that is used to close a GUI. (#433)
* This should fix the case where the bookmark key is the same key that is used to close a GUI

* Spotless
2023-10-30 08:17:53 +01:00

35 lines
1.1 KiB
Java

package codechicken.nei;
import java.util.HashMap;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.gui.inventory.GuiContainer;
import codechicken.nei.api.API;
import codechicken.nei.api.IBookmarkContainerHandler;
public class BookmarkContainerInfo {
private static final HashMap<Class<? extends GuiContainer>, IBookmarkContainerHandler> handlerMap = new HashMap<>();
public static void registerBookmarkContainerHandler(Class<? extends GuiContainer> classz,
IBookmarkContainerHandler handler) {
handlerMap.put(classz, handler);
}
public static boolean hasBookmarkContainerHandler(Class<? extends GuiContainer> classz) {
return handlerMap.containsKey(classz);
}
public static IBookmarkContainerHandler getBookmarkContainerHandler(GuiContainer gui) {
if (gui != null) {
return handlerMap.get(gui.getClass());
}
return null;
}
public static void load() {
API.registerBookmarkContainerHandler(GuiChest.class, new DefaultBookmarkContainerHandler());
}
}