2014-04-29 10:54:20 +10:00
|
|
|
package codechicken.nei;
|
|
|
|
|
|
2023-09-25 00:35:24 +02:00
|
|
|
import java.io.File;
|
2024-12-29 06:00:02 +01:00
|
|
|
import java.util.ArrayList;
|
2023-09-25 00:35:24 +02:00
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.HashSet;
|
2025-12-26 19:31:41 +01:00
|
|
|
import java.util.LinkedList;
|
2023-09-25 00:35:24 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
2025-12-26 19:31:41 +01:00
|
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
2023-09-25 00:35:24 +02:00
|
|
|
|
|
|
|
|
import com.google.common.eventbus.EventBus;
|
|
|
|
|
import com.google.common.eventbus.Subscribe;
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
import codechicken.core.CommonUtils;
|
|
|
|
|
import codechicken.core.launch.CodeChickenCorePlugin;
|
2025-12-26 19:31:41 +01:00
|
|
|
import codechicken.nei.api.IConfigureNEI;
|
2014-04-29 10:54:20 +10:00
|
|
|
import codechicken.nei.asm.NEICorePlugin;
|
2021-04-10 22:31:32 -07:00
|
|
|
import codechicken.nei.config.IMCHandler;
|
2025-12-26 19:31:41 +01:00
|
|
|
import codechicken.nei.guihook.HideousLinkedList;
|
2021-03-20 22:38:46 -07:00
|
|
|
import codechicken.nei.recipe.GuiRecipeTab;
|
2014-04-29 10:54:20 +10:00
|
|
|
import cpw.mods.fml.client.FMLFileResourcePack;
|
|
|
|
|
import cpw.mods.fml.client.FMLFolderResourcePack;
|
|
|
|
|
import cpw.mods.fml.common.DummyModContainer;
|
|
|
|
|
import cpw.mods.fml.common.LoadController;
|
2022-02-07 23:18:02 +03:00
|
|
|
import cpw.mods.fml.common.Loader;
|
2014-04-29 10:54:20 +10:00
|
|
|
import cpw.mods.fml.common.ModMetadata;
|
2025-03-13 07:04:41 -07:00
|
|
|
import cpw.mods.fml.common.discovery.ASMDataTable;
|
2014-04-29 10:54:20 +10:00
|
|
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
2021-04-10 22:31:32 -07:00
|
|
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
2023-11-07 22:44:13 +09:00
|
|
|
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
2021-03-20 22:38:46 -07:00
|
|
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
2021-10-16 11:31:43 -06:00
|
|
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
2025-12-16 20:44:15 +01:00
|
|
|
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
|
2014-04-29 10:54:20 +10:00
|
|
|
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
|
|
|
|
import cpw.mods.fml.common.versioning.VersionParser;
|
|
|
|
|
import cpw.mods.fml.common.versioning.VersionRange;
|
|
|
|
|
|
2025-12-16 20:44:15 +01:00
|
|
|
@SuppressWarnings("UnstableApiUsage")
|
2022-06-24 12:32:13 +01:00
|
|
|
public class NEIModContainer extends DummyModContainer {
|
2023-01-28 17:55:51 -08:00
|
|
|
|
2025-12-26 19:31:41 +01:00
|
|
|
public static final LinkedList<IConfigureNEI> plugins = new HideousLinkedList<>(new CopyOnWriteArrayList<>());
|
|
|
|
|
|
2022-02-07 23:18:02 +03:00
|
|
|
private static boolean gregTech5Loaded;
|
2024-12-29 06:00:02 +01:00
|
|
|
private static boolean gtnhLibLoaded;
|
2026-07-10 04:02:43 -04:00
|
|
|
private static boolean cubicChunksLoaded;
|
2022-02-07 23:18:02 +03:00
|
|
|
|
2025-03-13 07:04:41 -07:00
|
|
|
private static ASMDataTable asmDataTable;
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
public NEIModContainer() {
|
2021-11-22 17:56:35 +01:00
|
|
|
super(getModMetadata());
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
|
2021-11-22 17:56:35 +01:00
|
|
|
private static ModMetadata getModMetadata() {
|
|
|
|
|
final ModMetadata modMetadata = new ModMetadata();
|
2023-01-30 11:53:56 +00:00
|
|
|
modMetadata.name = "NotEnoughItems";
|
|
|
|
|
modMetadata.modId = "NotEnoughItems";
|
|
|
|
|
modMetadata.version = Tags.VERSION;
|
2026-02-16 11:37:20 +02:00
|
|
|
modMetadata.authorList = Arrays.asList("ChickenBones", "mitchej123", "SLPrime");
|
2022-02-10 19:33:30 -06:00
|
|
|
modMetadata.url = "https://github.com/GTNewHorizons/NotEnoughItems";
|
2022-06-24 12:32:13 +01:00
|
|
|
modMetadata.description = "Recipe Viewer, Inventory Manager, Item Spawner, Cheats and more; GTNH Version includes many enhancements.";
|
2021-11-22 17:56:35 +01:00
|
|
|
return modMetadata;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-07 23:18:02 +03:00
|
|
|
public static boolean isGT5Loaded() {
|
|
|
|
|
return gregTech5Loaded;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-29 06:00:02 +01:00
|
|
|
public static boolean isGTNHLibLoaded() {
|
|
|
|
|
return gtnhLibLoaded;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-10 04:02:43 -04:00
|
|
|
public static boolean isCCLoaded() {
|
|
|
|
|
return cubicChunksLoaded;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
@Override
|
|
|
|
|
public Set<ArtifactVersion> getRequirements() {
|
2019-12-30 20:19:16 -08:00
|
|
|
Set<ArtifactVersion> deps = new HashSet<>();
|
2024-12-29 06:00:02 +01:00
|
|
|
deps.add(VersionParser.parseVersionReference("CodeChickenCore@[" + codechicken.core.asm.Tags.VERSION + ",)"));
|
2014-04-29 10:54:20 +10:00
|
|
|
return deps;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ArtifactVersion> getDependencies() {
|
2024-12-29 06:00:02 +01:00
|
|
|
List<ArtifactVersion> deps = new ArrayList<>();
|
|
|
|
|
deps.add(VersionParser.parseVersionReference("CodeChickenCore@[" + codechicken.core.asm.Tags.VERSION + ",)"));
|
2026-03-15 17:07:31 +02:00
|
|
|
deps.add(VersionParser.parseVersionReference("gtnhlib@[0.9.6,)"));
|
2024-12-29 06:00:02 +01:00
|
|
|
return deps;
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|
|
|
|
|
|
2014-07-25 14:45:45 +10:00
|
|
|
private String description;
|
2022-06-24 12:32:13 +01:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
@Override
|
|
|
|
|
public boolean registerBus(EventBus bus, LoadController controller) {
|
|
|
|
|
bus.register(this);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-29 20:31:37 +10:00
|
|
|
@Subscribe
|
|
|
|
|
public void preInit(FMLPreInitializationEvent event) {
|
2022-02-07 23:18:02 +03:00
|
|
|
gregTech5Loaded = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi_post");
|
2024-12-29 06:00:02 +01:00
|
|
|
gtnhLibLoaded = Loader.isModLoaded("gtnhlib");
|
2026-07-10 04:02:43 -04:00
|
|
|
cubicChunksLoaded = Loader.isModLoaded("cubicchunks");
|
2026-09-12 23:41:17 +03:00
|
|
|
ServerHandler.preInit();
|
2022-06-24 12:32:13 +01:00
|
|
|
if (CommonUtils.isClient()) ClientHandler.preInit();
|
2025-03-13 07:04:41 -07:00
|
|
|
asmDataTable = event.getAsmData();
|
2014-06-29 20:31:37 +10:00
|
|
|
}
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
@Subscribe
|
|
|
|
|
public void init(FMLInitializationEvent event) {
|
2025-12-16 20:44:15 +01:00
|
|
|
if (CommonUtils.isClient()) {
|
|
|
|
|
ClientHandler.load();
|
2026-03-21 15:04:09 +02:00
|
|
|
IMCForNEI.IMCSender();
|
2025-12-16 20:44:15 +01:00
|
|
|
}
|
2014-04-29 10:54:20 +10:00
|
|
|
ServerHandler.load();
|
|
|
|
|
}
|
2022-06-24 12:32:13 +01:00
|
|
|
|
2021-03-20 22:38:46 -07:00
|
|
|
@Subscribe
|
|
|
|
|
public void postInit(FMLPostInitializationEvent event) {
|
2021-10-18 19:43:19 -04:00
|
|
|
if (CommonUtils.isClient()) {
|
|
|
|
|
ClientHandler.postInit();
|
|
|
|
|
}
|
2021-03-20 22:38:46 -07:00
|
|
|
}
|
2021-04-10 22:31:32 -07:00
|
|
|
|
2023-11-07 22:44:13 +09:00
|
|
|
@Subscribe
|
|
|
|
|
public void loadComplete(FMLLoadCompleteEvent event) {
|
|
|
|
|
if (CommonUtils.isClient()) {
|
|
|
|
|
GuiRecipeTab.loadHandlerInfo();
|
2024-09-01 23:19:12 +03:00
|
|
|
ClientHandler.loadPluginsList();
|
2024-12-01 16:56:02 +01:00
|
|
|
ClientHandler.loadHandlerOrdering();
|
2025-03-13 07:04:41 -07:00
|
|
|
asmDataTable = null;
|
2023-11-07 22:44:13 +09:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-16 20:44:15 +01:00
|
|
|
@Subscribe
|
|
|
|
|
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
|
|
|
|
|
NEIServerConfig.resetFirstLoad();
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-27 01:35:24 +08:00
|
|
|
@Subscribe
|
|
|
|
|
public void handleIMCMessages(FMLInterModComms.IMCEvent event) {
|
|
|
|
|
IMCHandler.processIMC(event.getMessages());
|
2021-04-10 22:31:32 -07:00
|
|
|
}
|
|
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
@Override
|
|
|
|
|
public VersionRange acceptableMinecraftVersionRange() {
|
|
|
|
|
return VersionParser.parseRange(CodeChickenCorePlugin.mcVersion);
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-30 01:03:17 +10:00
|
|
|
@Override
|
2014-04-29 10:54:20 +10:00
|
|
|
public File getSource() {
|
|
|
|
|
return NEICorePlugin.location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Class<?> getCustomResourcePackClass() {
|
|
|
|
|
return getSource().isDirectory() ? FMLFolderResourcePack.class : FMLFileResourcePack.class;
|
2014-04-30 01:03:17 +10:00
|
|
|
}
|
2025-03-13 07:04:41 -07:00
|
|
|
|
|
|
|
|
public static ASMDataTable getAsmDataTable() {
|
|
|
|
|
return asmDataTable;
|
|
|
|
|
}
|
2014-04-29 10:54:20 +10:00
|
|
|
}
|