aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtneioreplugin
diff options
context:
space:
mode:
authormiozune <miozune@gmail.com>2024-09-07 12:49:42 +0900
committerGitHub <noreply@github.com>2024-09-07 03:49:42 +0000
commitd57edae3a55131600090a3aee00c85c4b94621ad (patch)
treef3eee9af20c8907b33504773fee24e3779512e68 /src/main/java/gtneioreplugin
parent82604eadb847335e4b4ddf2e90a28b325786837b (diff)
downloadGT5-Unofficial-d57edae3a55131600090a3aee00c85c4b94621ad.tar.gz
GT5-Unofficial-d57edae3a55131600090a3aee00c85c4b94621ad.tar.bz2
GT5-Unofficial-d57edae3a55131600090a3aee00c85c4b94621ad.zip
Followup for the great renaming & cleanup IMC for NEI (#3083)
Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: boubou19 <miisterunknown@gmail.com>
Diffstat (limited to 'src/main/java/gtneioreplugin')
-rw-r--r--src/main/java/gtneioreplugin/GTNEIOrePlugin.java5
-rw-r--r--src/main/java/gtneioreplugin/plugin/IMCForNEI.java52
-rw-r--r--src/main/java/gtneioreplugin/plugin/NEIPluginConfig.java44
3 files changed, 47 insertions, 54 deletions
diff --git a/src/main/java/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/gtneioreplugin/GTNEIOrePlugin.java
index 6a168a8070..5c970fd032 100644
--- a/src/main/java/gtneioreplugin/GTNEIOrePlugin.java
+++ b/src/main/java/gtneioreplugin/GTNEIOrePlugin.java
@@ -4,6 +4,7 @@ import java.io.File;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
+import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -19,7 +20,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import gregtech.GT_Version;
-import gtneioreplugin.plugin.IMCForNEI;
+import gtneioreplugin.plugin.NEIPluginConfig;
import gtneioreplugin.plugin.block.ModBlocks;
import gtneioreplugin.util.CSVMaker;
import gtneioreplugin.util.GT5OreLayerHelper;
@@ -67,7 +68,7 @@ public class GTNEIOrePlugin {
@EventHandler
public void init(FMLInitializationEvent event) {
ModBlocks.init();
- IMCForNEI.IMCSender();
+ MinecraftForge.EVENT_BUS.register(new NEIPluginConfig());
}
@EventHandler
diff --git a/src/main/java/gtneioreplugin/plugin/IMCForNEI.java b/src/main/java/gtneioreplugin/plugin/IMCForNEI.java
deleted file mode 100644
index 620140c630..0000000000
--- a/src/main/java/gtneioreplugin/plugin/IMCForNEI.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package gtneioreplugin.plugin;
-
-import net.minecraft.nbt.NBTTagCompound;
-
-import cpw.mods.fml.common.event.FMLInterModComms;
-import gtneioreplugin.GTNEIOrePlugin;
-
-public class IMCForNEI {
-
- public static void IMCSender() {
- // Though these 2 are already registered in NEI jar, we need to re-register
- // because new DimensionDisplayItems made tabs a bit taller.
- sendHandler("gregtech5.plugin.gtneioreplugin.PluginGT5VeinStat", "gregtech:gt.blockores:386");
-
- sendHandler("gregtech5.plugin.gtneioreplugin.PluginGT5SmallOreStat", "gregtech:gt.blockores:85");
-
- sendHandler("gregtech5.plugin.gtneioreplugin.PluginGT5UndergroundFluid", "gregtech:gt.metaitem.01:32619");
- sendCatalyst("gregtech5.plugin.gtneioreplugin.PluginGT5UndergroundFluid", "gregtech:gt.blockmachines:1157");
- sendCatalyst("gregtech5.plugin.gtneioreplugin.PluginGT5UndergroundFluid", "gregtech:gt.blockmachines:141");
- sendCatalyst("gregtech5.plugin.gtneioreplugin.PluginGT5UndergroundFluid", "gregtech:gt.blockmachines:142");
- sendCatalyst("gregtech5.plugin.gtneioreplugin.PluginGT5UndergroundFluid", "gregtech:gt.blockmachines:149");
- sendCatalyst("gregtech5.plugin.gtneioreplugin.PluginGT5UndergroundFluid", "gregtech:gt.blockmachines:148");
- }
-
- private static void sendHandler(String name, String itemStack) {
- NBTTagCompound aNBT = new NBTTagCompound();
- aNBT.setString("handler", name);
- aNBT.setString("modName", GTNEIOrePlugin.NAME);
- aNBT.setString("modId", GTNEIOrePlugin.MODID);
- aNBT.setBoolean("modRequired", true);
- aNBT.setString("itemName", itemStack);
- aNBT.setInteger("handlerHeight", 160);
- aNBT.setInteger("handlerWidth", 166);
- aNBT.setInteger("maxRecipesPerPage", 2);
- aNBT.setInteger("yShift", 0);
- FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", aNBT);
- }
-
- @SuppressWarnings("SameParameterValue")
- private static void sendCatalyst(String name, String itemStack, int priority) {
- NBTTagCompound aNBT = new NBTTagCompound();
- aNBT.setString("handlerID", name);
- aNBT.setString("itemName", itemStack);
- aNBT.setInteger("priority", priority);
- FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", aNBT);
- }
-
- @SuppressWarnings("SameParameterValue")
- private static void sendCatalyst(String name, String itemStack) {
- sendCatalyst(name, itemStack, 0);
- }
-}
diff --git a/src/main/java/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/gtneioreplugin/plugin/NEIPluginConfig.java
index 8ce07c124c..d325a1085f 100644
--- a/src/main/java/gtneioreplugin/plugin/NEIPluginConfig.java
+++ b/src/main/java/gtneioreplugin/plugin/NEIPluginConfig.java
@@ -1,7 +1,21 @@
package gtneioreplugin.plugin;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.item.ItemStack;
+
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
+import codechicken.nei.event.NEIRegisterHandlerInfosEvent;
+import codechicken.nei.recipe.HandlerInfo;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GTOreDictUnificator;
import gtneioreplugin.GTNEIOrePlugin;
import gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat;
import gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid;
@@ -31,5 +45,35 @@ public class NEIPluginConfig implements IConfigureNEI {
API.registerUsageHandler(pluginSmallOreStat);
API.registerRecipeHandler(pluginGT5UndergroundFluid);
API.registerUsageHandler(pluginGT5UndergroundFluid);
+
+ List<ItemList> catalysts = Arrays.asList(
+ ItemList.OilDrill1,
+ ItemList.OilDrill2,
+ ItemList.OilDrill3,
+ ItemList.OilDrill4,
+ ItemList.OilDrillInfinite);
+ for (ItemList catalyst : catalysts) {
+ API.addRecipeCatalyst(catalyst.get(1), pluginGT5UndergroundFluid);
+ }
+ }
+
+ @SubscribeEvent
+ public void registerHandlerInfo(NEIRegisterHandlerInfosEvent event) {
+ // Though first two handlers are already registered in NEI jar, we need to re-register
+ // because new DimensionDisplayItems made tabs a bit taller.
+ Map<String, ItemStack> handlers = new HashMap<>();
+ handlers.put("PluginGT5VeinStat", GTOreDictUnificator.get(OrePrefixes.ore, Materials.Manyullyn, 1));
+ handlers.put("PluginGT5SmallOreStat", GTOreDictUnificator.get(OrePrefixes.ore, Materials.Platinum, 1));
+ handlers.put("PluginGT5UndergroundFluid", ItemList.Electric_Pump_UEV.get(1));
+ for (Map.Entry<String, ItemStack> handler : handlers.entrySet()) {
+ event.registerHandlerInfo(
+ new HandlerInfo.Builder(
+ "gtneioreplugin.plugin.gregtech5." + handler.getKey(),
+ GTNEIOrePlugin.NAME,
+ GTNEIOrePlugin.MODID).setHeight(160)
+ .setMaxRecipesPerPage(2)
+ .setDisplayStack(handler.getValue())
+ .build());
+ }
}
}