mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-13 17:04:03 +00:00
More robust IMC handling (#371)
* Complain if IMC adds a handler/catalyst for a handlerID that doesn't exist. * Look at the right maps this time * Don't show matches, only misses
This commit is contained in:
1 parent
a12fadb10d
commit
0e34840c21
2 files changed
+30
No files matched your search
@@ -282,6 +282,20 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
handlerMap.keySet().removeAll(handlerRemoverFromIMC);
|
||||
handlerMap.putAll(handlerAdderFromIMC);
|
||||
|
||||
if (!handlerAdderFromIMC.isEmpty()) {
|
||||
// If we're getting an IMC message, it probably means it should match
|
||||
Set<String> handlerIds = new HashSet<>(handlerMap.keySet());
|
||||
handlerAdderFromIMC.keySet().forEach(handlerName -> {
|
||||
if (!handlerIds.contains(handlerName)) {
|
||||
NEIClientConfig.logger.warn("Could not find a registered handlerID that matches " + handlerName);
|
||||
handlerIds.forEach(handler -> {
|
||||
if (handler.equalsIgnoreCase(handlerName)) {
|
||||
NEIClientConfig.logger.warn(" -- Did you mean: " + handler);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
NEIClientConfig.logger.info("Sending {}", NEIRegisterHandlerInfosEvent.class.getSimpleName());
|
||||
MinecraftForge.EVENT_BUS.post(new NEIRegisterHandlerInfosEvent());
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -227,6 +229,20 @@ public class RecipeCatalysts {
|
||||
}
|
||||
}
|
||||
|
||||
if (!catalystsAdderFromIMC.isEmpty()) {
|
||||
// If we're getting an IMC message, it probably means it should match
|
||||
Set<String> handlerIds = new HashSet<>(GuiRecipeTab.handlerMap.keySet());
|
||||
catalystsAdderFromIMC.keySet().forEach(handlerName -> {
|
||||
if (!handlerIds.contains(handlerName)) {
|
||||
NEIClientConfig.logger.warn("Could not find a registered handlerID that matches " + handlerName);
|
||||
handlerIds.forEach(handler -> {
|
||||
if (handler.equalsIgnoreCase(handlerName)) {
|
||||
NEIClientConfig.logger.warn(" -- Did you mean: " + handler);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
for (Map.Entry<String, List<ItemStack>> entry : catalystsRemoverFromAPI.entrySet()) {
|
||||
String handlerID = entry.getKey();
|
||||
if (recipeCatalystMap.containsKey(handlerID)) {
|
||||
|
||||
Reference in new issue
Block a user