mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-15 17:54:50 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f2782b06e | ||
|
|
f17bf6e8e2 | ||
|
|
10ee4d17ef | ||
|
|
f6acd768f3 | ||
|
|
8a5146b672 | ||
|
|
1632a90d15 |
No files matched your search
@@ -0,0 +1,3 @@
|
||||
compileJava {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
@@ -77,11 +77,11 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
/**
|
||||
* Sorted bottom first
|
||||
*/
|
||||
private static TreeSet<Widget> drawWidgets;
|
||||
private static TreeSet<Widget> drawWidgets = new TreeSet<>(new WidgetZOrder(false));
|
||||
/**
|
||||
* Sorted top first
|
||||
*/
|
||||
private static TreeSet<Widget> controlWidgets;
|
||||
private static TreeSet<Widget> controlWidgets = new TreeSet<>(new WidgetZOrder(true));
|
||||
|
||||
public static ItemPanel itemPanel;
|
||||
public static BookmarkPanel bookmarkPanel;
|
||||
|
||||
@@ -8,6 +8,7 @@ import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
import codechicken.nei.guihook.IContainerSlotClickHandler;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainerCreative;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -238,7 +239,9 @@ public class NEIController implements IContainerSlotClickHandler, IContainerInpu
|
||||
fastTransferManager.transferItem(manager.window, mouseover.slotNumber);
|
||||
else
|
||||
fastTransferManager.retrieveItem(manager.window, mouseover.slotNumber);
|
||||
return true;
|
||||
// slot in GuiRecipe does not contain an actual stack
|
||||
// and scroll should also be handled by GuiRecipe
|
||||
return !(gui instanceof GuiRecipe);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,6 @@ public class NEIModContainer extends DummyModContainer
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if (CommonUtils.isClient()) {
|
||||
GuiRecipeTab.loadHandlerInfo();
|
||||
RecipeCatalysts.loadCatalystInfo();
|
||||
ClientHandler.postInit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,26 @@ package codechicken.nei.config;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.recipe.CatalystInfo;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.HandlerInfo;
|
||||
import codechicken.nei.recipe.RecipeCatalysts;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class IMCHandler {
|
||||
private static final Set<String> processedCatalystSenders = new HashSet<>();
|
||||
private IMCHandler() {}
|
||||
|
||||
public static void processIMC(List<FMLInterModComms.IMCMessage> messages) {
|
||||
@@ -20,10 +29,19 @@ public class IMCHandler {
|
||||
String type = message.key;
|
||||
if (type == null || type.isEmpty()) continue;
|
||||
if (CommonUtils.isClient()) {
|
||||
if (type.equals("registerHandlerInfo")) {
|
||||
handleRegisterHandlerInfo(message);
|
||||
} else if (type.equals("removeHandlerInfo")) {
|
||||
handleRemoveHandlerInfo(message);
|
||||
switch (type) {
|
||||
case "registerHandlerInfo":
|
||||
handleRegisterHandlerInfo(message);
|
||||
break;
|
||||
case "removeHandlerInfo":
|
||||
handleRemoveHandlerInfo(message);
|
||||
break;
|
||||
case "registerCatalystInfo":
|
||||
handleRegisterCatalystInfo(message);
|
||||
break;
|
||||
case "removeCatalystInfo":
|
||||
handleRemoveCatalystInfo(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +109,72 @@ public class IMCHandler {
|
||||
GuiRecipeTab.handlerRemoverFromIMC.add(handler);
|
||||
}
|
||||
|
||||
private static void handleRegisterCatalystInfo(IMCMessage message) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message, "NBT");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!processedCatalystSenders.contains(message.getSender())) {
|
||||
NEIClientConfig.logger.info("Processing registerCatalystInfo from " + message.getSender());
|
||||
processedCatalystSenders.add(message.getSender());
|
||||
}
|
||||
final NBTTagCompound tag = message.getNBTValue();
|
||||
final String handlerID = tag.getString("handlerID");
|
||||
if (handlerID.isEmpty()) {
|
||||
NEIClientConfig.logger.warn("Missing handlerID for registerCatalystInfo!");
|
||||
return;
|
||||
}
|
||||
final String itemName = tag.getString("itemName");
|
||||
final String nbtInfo = tag.hasKey("nbtInfo") ? tag.getString("nbtInfo") : null;
|
||||
if (itemName.isEmpty()) {
|
||||
NEIClientConfig.logger.warn(String.format("Missing itemName for registerCatalystInfo in `%s`!", handlerID));
|
||||
return;
|
||||
}
|
||||
final ItemStack itemStack = NEIServerUtils.getModdedItem(itemName, nbtInfo);
|
||||
if (itemStack == null) {
|
||||
NEIClientConfig.logger.warn(String.format("Cannot find item `%s`!", itemName));
|
||||
return;
|
||||
}
|
||||
final int priority = tag.getInteger("priority");
|
||||
|
||||
RecipeCatalysts.addOrPut(RecipeCatalysts.catalystsAdderFromIMC, handlerID, new CatalystInfo(itemStack, priority));
|
||||
NEIClientConfig.logger.info(String.format("Added catalyst `%s` to handler %s", itemStack.getDisplayName(), handlerID));
|
||||
}
|
||||
|
||||
private static void handleRemoveCatalystInfo(IMCMessage message) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message, "NBT");
|
||||
return;
|
||||
}
|
||||
|
||||
NEIClientConfig.logger.info("Processing removeCatalystInfo from " + message.getSender());
|
||||
final NBTTagCompound tag = message.getNBTValue();
|
||||
final String handlerID = tag.getString("handlerID");
|
||||
if (handlerID.isEmpty()) {
|
||||
NEIClientConfig.logger.warn("Missing handlerID for registerCatalystInfo!");
|
||||
return;
|
||||
}
|
||||
final String itemName = tag.getString("itemName");
|
||||
final String nbtInfo = tag.hasKey("nbtInfo") ? tag.getString("nbtInfo") : null;
|
||||
if (itemName.isEmpty()) {
|
||||
NEIClientConfig.logger.warn(String.format("Missing itemName for registerCatalystInfo in `%s`!", handlerID));
|
||||
return;
|
||||
}
|
||||
final ItemStack itemStack = NEIServerUtils.getModdedItem(itemName, nbtInfo);
|
||||
if (itemStack == null) {
|
||||
NEIClientConfig.logger.warn(String.format("Cannot find item `%s`!", itemName));
|
||||
return;
|
||||
}
|
||||
|
||||
if (RecipeCatalysts.catalystsRemoverFromIMC.containsKey(handlerID)) {
|
||||
RecipeCatalysts.catalystsRemoverFromIMC.get(handlerID).add(itemStack);
|
||||
} else {
|
||||
RecipeCatalysts.catalystsRemoverFromIMC.put(handlerID, new ArrayList<>(Collections.singletonList(itemStack)));
|
||||
}
|
||||
NEIClientConfig.logger.info(String.format("Removed catalyst `%s` from handler %s", itemStack.getDisplayName(), handlerID));
|
||||
}
|
||||
|
||||
|
||||
private static void logInvalidMessage(FMLInterModComms.IMCMessage message, String type) {
|
||||
FMLLog.bigWarning(String.format("Received invalid IMC '%s' from %s. Not a %s Message.", message.key, message.getSender(), type));
|
||||
|
||||
@@ -29,6 +29,8 @@ import java.util.Map;
|
||||
public class RecipeCatalysts {
|
||||
private static final Map<String, CatalystInfoList> catalystsAdderFromAPI = new HashMap<>();
|
||||
private static final Map<String, List<ItemStack>> catalystsRemoverFromAPI = new HashMap<>();
|
||||
public static final Map<String, CatalystInfoList> catalystsAdderFromIMC = new HashMap<>();
|
||||
public static final Map<String, List<ItemStack>> catalystsRemoverFromIMC = new HashMap<>();
|
||||
private static final Map<String, CatalystInfoList> recipeCatalystMap = new HashMap<>();
|
||||
private static Map<String, List<PositionedStack>> positionedRecipeCatalystMap = new HashMap<>();
|
||||
private static final List<String> forceClassNameList = new ArrayList<>();
|
||||
@@ -161,6 +163,7 @@ public class RecipeCatalysts {
|
||||
// todo
|
||||
final String minVersion = record.get("minVersion");
|
||||
final String maxVersion = record.get("maxVersion");
|
||||
//
|
||||
final boolean forceClassName = Boolean.parseBoolean(record.get("forceClassName"));
|
||||
|
||||
if (requiresMod && !Loader.isModLoaded(modId)) continue;
|
||||
@@ -209,6 +212,13 @@ public class RecipeCatalysts {
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<String, CatalystInfoList> entry : catalystsAdderFromIMC.entrySet()) {
|
||||
String handlerID = entry.getKey();
|
||||
for (CatalystInfo catalyst : entry.getValue()) {
|
||||
addOrPut(recipeCatalystMap, handlerID, catalyst);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<String, List<ItemStack>> entry : catalystsRemoverFromAPI.entrySet()) {
|
||||
String handlerID = entry.getKey();
|
||||
if (recipeCatalystMap.containsKey(handlerID)) {
|
||||
@@ -217,6 +227,14 @@ public class RecipeCatalysts {
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<String, List<ItemStack>> entry : catalystsRemoverFromIMC.entrySet()) {
|
||||
String handlerID = entry.getKey();
|
||||
if (recipeCatalystMap.containsKey(handlerID)) {
|
||||
CatalystInfoList catalysts = recipeCatalystMap.get(handlerID);
|
||||
entry.getValue().forEach(catalysts::remove);
|
||||
}
|
||||
}
|
||||
|
||||
updatePosition(getHeight(), true);
|
||||
}
|
||||
|
||||
@@ -234,7 +252,7 @@ public class RecipeCatalysts {
|
||||
handler.getHandlerId());
|
||||
}
|
||||
|
||||
private static void addOrPut(Map<String, CatalystInfoList> map, String handlerID, CatalystInfo catalyst) {
|
||||
public static void addOrPut(Map<String, CatalystInfoList> map, String handlerID, CatalystInfo catalyst) {
|
||||
if (map.containsKey(handlerID)) {
|
||||
map.get(handlerID).add(catalyst);
|
||||
} else {
|
||||
|
||||
@@ -383,6 +383,11 @@ nc.crafting.nei.RecyclerRecipeHandler,NuclearCraft:recyclerIdle,,NuclearCraft,TR
|
||||
nc.crafting.nei.NuclearWorkspaceRecipeHandler,NuclearCraft:nuclearWorkspace,,NuclearCraft,TRUE,,,,,,
|
||||
ganymedes01.etfuturum.NEI_EtFuturum_Config$NEI_Recipes_Smoker,etfuturum:smoker,,etfuturum,TRUE,,,,,,not working well
|
||||
ganymedes01.etfuturum.NEI_EtFuturum_Config$NEI_Recipes_BlastFurnace,etfuturum:blast_furnace,,etfuturum,TRUE,,,,,,not working well
|
||||
connor135246.campfirebackport.client.compat.nei.NEICampfireRecipeHandler,campfirebackport:campfire,,campfirebackport,TRUE,,,,,,
|
||||
connor135246.campfirebackport.client.compat.nei.NEICampfireRecipeHandler,campfirebackport:soul_campfire,,campfirebackport,TRUE,,,,,,
|
||||
connor135246.campfirebackport.client.compat.nei.NEICampfireStateChangerHandler,campfirebackport:campfire,,campfirebackport,TRUE,,,,,,
|
||||
connor135246.campfirebackport.client.compat.nei.NEICampfireStateChangerHandler,campfirebackport:soul_campfire,,campfirebackport,TRUE,,,,,,
|
||||
smelting,Natura:NetherFurnace,,Natura,TRUE,,,,,,
|
||||
crafting,gregtech:gt.metaitem.01:32744,,gregtech,TRUE,,,,,,"GT5 start: for readability, keep all GTNH-related catalysts below"
|
||||
gt.recipe.primitiveblastfurnace,gregtech:gt.blockmachines:140,,gregtech,TRUE,,,,,,
|
||||
gt.recipe.primitiveblastfurnace,gregtech:gt.blockmachines:108,,gregtech,TRUE,,,,,,
|
||||
@@ -1064,9 +1069,9 @@ gtpp.recipe.simplewasher,gregtech:gt.blockmachines:31018,,miscutils,TRUE,,,,,,
|
||||
gtpp.recipe.simplewasher,gregtech:gt.blockmachines:31019,,miscutils,TRUE,,,,,,
|
||||
gtpp.recipe.simplewasher,gregtech:gt.blockmachines:31020,,miscutils,TRUE,,,,,,
|
||||
gtpp.recipe.vacfurnace,gregtech:gt.blockmachines:995,,miscutils,TRUE,,,,,,
|
||||
gtPlusPlus.nei.GT_NEI_FlotationCell,gregtech:gt.blockmachines:31028,,miscutils,TRUE,,,,,,
|
||||
gtPlusPlus.nei.GT_NEI_FluidReactor,gregtech:gt.blockmachines:998,,miscutils,TRUE,,,,,,
|
||||
gtPlusPlus.nei.GT_NEI_MillingMachine,gregtech:gt.blockmachines:31027,,miscutils,TRUE,,,,,,
|
||||
gtpp.recipe.flotationcell,gregtech:gt.blockmachines:31028,,miscutils,TRUE,,,,,,
|
||||
gtpp.recipe.fluidchemicaleactor,gregtech:gt.blockmachines:998,,miscutils,TRUE,,,,,,
|
||||
gtpp.recipe.oremill,gregtech:gt.blockmachines:31027,,miscutils,TRUE,,,,,,
|
||||
team.chisel.compat.nei.RecipeHandlerChisel,gregtech:gt.blockmachines:31066,,miscutils,TRUE,,,,,,
|
||||
team.chisel.compat.nei.RecipeHandlerChisel,gregtech:gt.blockmachines:31067,,miscutils,TRUE,,,,,,
|
||||
team.chisel.compat.nei.RecipeHandlerChisel,gregtech:gt.blockmachines:31068,,miscutils,TRUE,,,,,,
|
||||
|
||||
|
@@ -473,4 +473,6 @@ nc.crafting.nei.HeliumExtractorRecipeHandler,NuclearCraft,NuclearCraft:heliumExt
|
||||
nc.crafting.nei.RecyclerRecipeHandler,NuclearCraft,NuclearCraft:recyclerIdle,,NuclearCraft,TRUE,,,65,166,5,,,,,,
|
||||
nc.crafting.nei.NuclearWorkspaceRecipeHandler,NuclearCraft,NuclearCraft:nuclearWorkspace,,NuclearCraft,TRUE,,,130,,2,,,,,,
|
||||
ganymedes01.etfuturum.NEI_EtFuturum_Config$NEI_Recipes_Smoker,EtFuturum Requiem,etfuturum:lit_smoker,,etfuturum,TRUE,,,65,166,5,,,,,,
|
||||
ganymedes01.etfuturum.NEI_EtFuturum_Config$NEI_Recipes_BlastFurnace,EtFuturum Requiem,etfuturum:lit_blast_furnace,,etfuturum,TRUE,,,65,166,5,,,,,,
|
||||
ganymedes01.etfuturum.NEI_EtFuturum_Config$NEI_Recipes_BlastFurnace,EtFuturum Requiem,etfuturum:lit_blast_furnace,,etfuturum,TRUE,,,65,166,5,,,,,,
|
||||
connor135246.campfirebackport.client.compat.nei.NEICampfireRecipeHandler,Campfire Backport,campfirebackport:campfire,,campfirebackport,TRUE,,,65,166,5,,,,,,
|
||||
connor135246.campfirebackport.client.compat.nei.NEICampfireStateChangerHandler,Campfire Backport,campfirebackport:campfire_base,,campfirebackport,TRUE,,,65,166,5,,,,,,
|
||||
|
Reference in new issue
Block a user