attampt to fix imc (#161)

* attampt to fix imc
This commit is contained in:
GlodBlock authored and GitHub committed 2021-09-22 23:38:53 -07:00
1 parent 65710c959a
commit 5b3a255be9
2 files changed
+10 -6

No files matched your search

+3 -3
View File
@@ -75,8 +75,8 @@ public class IMCHandler {
NEIClientConfig.logger.info("Error setting handler dimensions for " + handler);
}
GuiRecipeTab.handlerMap.remove(handler);
GuiRecipeTab.handlerMap.put(handler, info);
GuiRecipeTab.handlerAdderFromIMC.remove(handler);
GuiRecipeTab.handlerAdderFromIMC.put(handler, info);
}
private static void handleRemoveHandlerInfo(IMCMessage message) {
@@ -88,7 +88,7 @@ public class IMCHandler {
final String handler = tag.getString("handler");
NEIClientConfig.logger.info("Processing removeHandlerInfo `" + handler + "` from " + message.getSender());
GuiRecipeTab.handlerMap.remove(handler);
GuiRecipeTab.handlerRemoverFromIMC.add(handler);
}
+7 -3
View File
@@ -29,12 +29,13 @@ import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.util.HashMap;
import java.util.List;
import java.util.*;
public abstract class GuiRecipeTab extends Widget {
public static HandlerInfo DEFAULT_HANDLER_INFO = getDefaultHandlerInfo();
public static HashMap<String, HandlerInfo> handlerMap = new HashMap<>();
public static HashMap<String, HandlerInfo> handlerAdderFromIMC = new HashMap<>();
public static Set<String> handlerRemoverFromIMC = new HashSet<>();
private final GuiRecipe guiRecipe;
private final IRecipeHandler handler;
@@ -177,7 +178,7 @@ public abstract class GuiRecipeTab extends Widget {
NEIClientConfig.logger.info("Loading handler info from " + (fromJar ? "JAR" : "Config"));
handlerMap.clear();
URL handlerUrl = Thread.currentThread().getContextClassLoader().getResource("assets/nei/csv/handlers.csv");
URL url;
if (fromJar) {
url = handlerUrl;
@@ -262,6 +263,9 @@ public abstract class GuiRecipeTab extends Widget {
e.printStackTrace();
}
handlerMap.keySet().removeAll(handlerRemoverFromIMC);
handlerMap.putAll(handlerAdderFromIMC);
NEIClientConfig.logger.info("Sending {}", NEIRegisterHandlerInfosEvent.class.getSimpleName());
MinecraftForge.EVENT_BUS.post(new NEIRegisterHandlerInfosEvent());
}