Skip to content

Commit

Permalink
Followup for the great renaming & cleanup IMC for NEI (#3083)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: boubou19 <miisterunknown@gmail.com>
  • Loading branch information
3 people authored Sep 7, 2024
1 parent 82604ea commit d57edae
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 103 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gregtech/common/GTClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ public void onPlayerTickEventClient(TickEvent.PlayerTickEvent aEvent) {

@SubscribeEvent
public void onConfigChange(ConfigChangedEvent.OnConfigChangedEvent e) {
if (GregTech.ID.equals(e.modID) && "kekztech/client".equals(e.configID)) {
if (GregTech.ID.equals(e.modID) && "client".equals(e.configID)) {
// refresh client preference and send to server, since it's the only config we allow changing at runtime.
mPreference = new GTClientPreference();
GTPreLoad.loadClientConfig();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/gtneioreplugin/GTNEIOrePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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;
Expand All @@ -19,7 +20,7 @@
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;
Expand Down Expand Up @@ -67,7 +68,7 @@ public void preinit(FMLPreInitializationEvent event) {
@EventHandler
public void init(FMLInitializationEvent event) {
ModBlocks.init();
IMCForNEI.IMCSender();
MinecraftForge.EVENT_BUS.register(new NEIPluginConfig());
}

@EventHandler
Expand Down
52 changes: 0 additions & 52 deletions src/main/java/gtneioreplugin/plugin/IMCForNEI.java

This file was deleted.

44 changes: 44 additions & 0 deletions src/main/java/gtneioreplugin/plugin/NEIPluginConfig.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -31,5 +45,35 @@ public void loadConfig() {
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());
}
}
}
2 changes: 0 additions & 2 deletions src/main/java/kubatech/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import kubatech.api.utils.ModUtils;
import kubatech.nei.IMCForNEI;

@SuppressWarnings("unused")
public class ClientProxy extends CommonProxy {
Expand All @@ -42,7 +41,6 @@ public void preInit(FMLPreInitializationEvent event) {

public void init(FMLInitializationEvent event) {
super.init(event);
IMCForNEI.IMCSender();
}

public void postInit(FMLPostInitializationEvent event) {
Expand Down
46 changes: 0 additions & 46 deletions src/main/java/kubatech/nei/IMCForNEI.java

This file was deleted.

6 changes: 6 additions & 0 deletions src/main/java/kubatech/nei/NEIConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

package kubatech.nei;

import static gregtech.api.enums.Mods.EnderIO;
import static gregtech.api.enums.Mods.MobsInfo;
import static kubatech.api.enums.ItemList.LegendaryBlackTea;
import static kubatech.api.enums.ItemList.LegendaryButterflyTea;
import static kubatech.api.enums.ItemList.LegendaryEarlGrayTea;
Expand All @@ -37,11 +39,15 @@
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import kubatech.Tags;
import kubatech.api.enums.ItemList;

public class NEIConfig implements IConfigureNEI {

@Override
public void loadConfig() {
if (MobsInfo.isModLoaded() && EnderIO.isModLoaded()) {
API.addRecipeCatalyst(ItemList.ExtremeEntityCrusher.get(1), "mobsinfo.mobhandler");
}
API.hideItem(LegendaryBlackTea.get(1));
API.hideItem(LegendaryButterflyTea.get(1));
API.hideItem(LegendaryEarlGrayTea.get(1));
Expand Down

0 comments on commit d57edae

Please sign in to comment.