From 26caa265b7eae49767947e1ff4e6cfc8166b07f5 Mon Sep 17 00:00:00 2001 From: boubou19 Date: Sun, 9 Apr 2023 01:08:26 +0200 Subject: clean up GT++ code (#589) * yeet big reactor support * yeet IC2 classic support * yeet pneumaticraft support * yeet More Planets support * yeet Immersive Engineering support * yeet Psychedilicraft support * yeet Beyond Reality Core support * sort mods to see what must be purged * yeet simply jetpacks * yeet RFTools * yeet xReliquary * yeet RedTech * yeet Mekanism * yeet GrowthCraft * yeet ihl * leftover cleaning * yeet thermal fondation support * yeet compact windmills support * spotless * remove constants from LoadedMods (part 1 / 2) * spotless * remove constants from LoadedMods (part 2 / 2) * use mod id enum instead of strings + optimize imports * Loaded.isModLoaded -> enum * restore RA init * missing ! * start organizing recipes stuff * fix crash on world load in dev * remove unused class * remove HazmatUtils.java * move all the removals * remove enableHarderRecipesForHighTierCasings and usages(disabled in the pack) * move some pyrolyse oven recipes to its own file * sa * bump GT version * bump GT5U version * spotless apply * use Everglades entry from the mod enum --------- Co-authored-by: miozune Co-authored-by: Martin Robertz --- src/main/java/gtPlusPlus/core/lib/CORE.java | 28 +- src/main/java/gtPlusPlus/core/lib/LoadedMods.java | 365 ---------------------- 2 files changed, 17 insertions(+), 376 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/core/lib/LoadedMods.java (limited to 'src/main/java/gtPlusPlus/core/lib') diff --git a/src/main/java/gtPlusPlus/core/lib/CORE.java b/src/main/java/gtPlusPlus/core/lib/CORE.java index e06a962545..918c767a8c 100644 --- a/src/main/java/gtPlusPlus/core/lib/CORE.java +++ b/src/main/java/gtPlusPlus/core/lib/CORE.java @@ -1,6 +1,14 @@ package gtPlusPlus.core.lib; -import java.util.*; +import static gregtech.api.enums.Mods.GTPlusPlus; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; @@ -15,6 +23,7 @@ import net.minecraftforge.common.util.FakePlayerFactory; import com.mojang.authlib.GameProfile; import cpw.mods.fml.common.FMLCommonHandler; +import gregtech.api.enums.Mods; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.api.objects.random.XSTR; @@ -40,7 +49,6 @@ public class CORE { // Mod Variables public static final String name = "GT++"; - public static final String MODID = "miscutils"; public static final String VERSION = "GRADLETOKEN_VERSION"; // Tweakables @@ -62,9 +70,6 @@ public class CORE { .translateToLocal("GTPP.core.GT_Tooltip_Radioactive"); public static final String noItem = ""; - // Because I want to be lazy. Beyond Reality Classic Var. - public static boolean BRC = false; - public static final String SEPERATOR = "/"; /** @@ -94,10 +99,11 @@ public class CORE { public static final String TEX_DIR = "textures/", TEX_DIR_GUI = TEX_DIR + "gui/", TEX_DIR_ITEM = TEX_DIR + "items/", TEX_DIR_BLOCK = TEX_DIR + "blocks/", TEX_DIR_ENTITY = TEX_DIR + "entity/", TEX_DIR_ASPECTS = TEX_DIR + "aspects/", TEX_DIR_FLUIDS = TEX_DIR_BLOCK + "fluids/", - RES_PATH = MODID + ":" + TEX_DIR, RES_PATH_GUI = MODID + ":" + TEX_DIR_GUI, - RES_PATH_ITEM = MODID + ":" + TEX_DIR_ITEM, RES_PATH_BLOCK = MODID + ":" + TEX_DIR_BLOCK, - RES_PATH_ENTITY = MODID + ":" + TEX_DIR_ENTITY, RES_PATH_ASPECTS = MODID + ":" + TEX_DIR_ASPECTS, - RES_PATH_FLUIDS = MODID + ":" + TEX_DIR_FLUIDS; + RES_PATH = GTPlusPlus.ID + ":" + TEX_DIR, RES_PATH_GUI = GTPlusPlus.ID + ":" + TEX_DIR_GUI, + RES_PATH_ITEM = GTPlusPlus.ID + ":" + TEX_DIR_ITEM, RES_PATH_BLOCK = GTPlusPlus.ID + ":" + TEX_DIR_BLOCK, + RES_PATH_ENTITY = GTPlusPlus.ID + ":" + TEX_DIR_ENTITY, + RES_PATH_ASPECTS = GTPlusPlus.ID + ":" + TEX_DIR_ASPECTS, + RES_PATH_FLUIDS = GTPlusPlus.ID + ":" + TEX_DIR_FLUIDS; /** * Used to create a {@link EntityPlayer} instance from {@link FakePlayerFactory}. If this instance already exists in @@ -154,7 +160,6 @@ public class CORE { // GT Fixes public static boolean enableSulfuricAcidFix = false; - public static boolean enableHarderRecipesForHighTierCasings = true; // Single Block Machines public static boolean enableMachine_SolarGenerators = false; @@ -265,7 +270,8 @@ public class CORE { public static class Everglades { - public static final String MODID = "ToxicEverglades"; + @Deprecated + public static final String MODID = Mods.Names.G_T_PLUS_PLUS_EVERGLADES; public static final String NAME = "GT++ Toxic Everglades"; public static final String VERSION = "GRADLETOKEN_VERSION"; } diff --git a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java deleted file mode 100644 index 498b69860e..0000000000 --- a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java +++ /dev/null @@ -1,365 +0,0 @@ -package gtPlusPlus.core.lib; - -import static gtPlusPlus.core.lib.CORE.*; - -import java.util.HashMap; - -import cpw.mods.fml.common.Loader; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechTextures; -import gtPlusPlus.xmod.gregtech.recipes.GregtechRecipeAdder; - -public class LoadedMods { - - // Initialize Variables - public static boolean PlayerAPI = false; - public static boolean BuildCraft = false; - public static boolean EnderIO = false; - public static boolean Big_Reactors = false; - public static boolean IndustrialCraft2Classic = false; - public static boolean Simply_Jetpacks = false; - public static boolean RFTools = false; - public static boolean Thaumcraft = false; - public static boolean ThaumicBases = false; - public static boolean Baubles = false; - public static boolean Extra_Utils = false; - public static boolean PneumaticCraft = false; - public static boolean MorePlanets = false; - public static boolean ForbiddenMagic = false; - public static boolean CompactWindmills = false; - public static boolean Railcraft = false; - public static boolean ImmersiveEngineering = false; - public static boolean Growthcraft = false; - public static boolean CoFHCore = false; - public static boolean Forestry = false; - public static boolean MagicBees = false; - public static boolean ExtraBees = false; - public static boolean Psychedelicraft = false; - public static boolean ThermalFoundation = false; - public static boolean IHL = false; - public static boolean AdvancedSolarPanel = false; - public static boolean OpenComputers = false; // OpenComputers - public static boolean OpenBlocks = false; - public static boolean Computronics = false; // computronics - public static boolean DreamCraft = false; // GT: New Horizons - public static boolean BeyondRealityCore = false; // Beyond Reality - Probably Classic - public static boolean BiomesOPlenty = false; - public static boolean PamsHarvestcraft = false; - public static boolean GalacticraftCore = false; - public static boolean Mekanism = false; - public static boolean RedTech = false; // RedMage's Mod - public static boolean TecTech = false; // Technus' Mod - public static boolean KekzTech = false; // KekzDealers' Mod - public static boolean TiCon = false; - public static boolean StevesCarts = false; - public static boolean Witchery = false; - public static boolean Waila = false; - public static boolean CropsPlusPlus = false; // Barts Crop Mod - public static boolean Reliquary = false; - public static boolean SpiceOfLife = false; - public static boolean RemoteIO = false; - public static boolean BartWorks = false; - public static boolean GoodGenerator = false; - public static boolean ExtraTrees = false; - - private static int totalMods; - - @SuppressWarnings("deprecation") - public static void checkLoaded() { - Logger.INFO("Looking for optional mod prereqs."); - Logger.INFO("Components enabled for: Gregtech"); - try { - CORE.RA = new GregtechRecipeAdder(); - Logger.INFO("Created Gregtech recipe handler."); - GregtechTextures.BlockIcons.VOID.name(); - GregtechTextures.ItemIcons.VOID.name(); - Logger.INFO("Created Gregtech texture handler."); - } catch (final NullPointerException e) { - Logger.INFO("Could NOT create a Gregtech recipe handler."); - } - - totalMods++; - if (isModLoaded("dreamcraft")) { - DreamCraft = true; - Logger.INFO("Components enabled for: DreamCraft"); - totalMods++; - } - if (isModLoaded("beyondrealitycore")) { - BeyondRealityCore = true; - BRC = true; - Logger.INFO("Components enabled for: Beyond Reality"); - totalMods++; - } - if (isModLoaded("PlayerAPI")) { - PlayerAPI = true; - Logger.INFO("Components enabled for: PlayerAPI"); - totalMods++; - } - if (isModLoaded("berriespp")) { - CropsPlusPlus = true; - Logger.INFO("Components enabled for: Crops++"); - totalMods++; - } - if (isModLoaded("xreliquary")) { - Reliquary = true; - Logger.INFO("Components enabled for: Reliquary"); - totalMods++; - } - if (isModLoaded("TConstruct")) { - TiCon = true; - Logger.INFO("Components enabled for: Tinkers Construct"); - totalMods++; - } - if (isModLoaded("AdvancedSolarPanel")) { - AdvancedSolarPanel = true; - Logger.INFO("Components enabled for: Advanced Solar Panels"); - totalMods++; - } - if (isModLoaded("GoodGenerator")) { - GoodGenerator = true; - Logger.INFO("Components enabled for: GoodGenerator"); - totalMods++; - } - if (isModLoaded("bartworks")) { - BartWorks = true; - Logger.INFO("Components enabled for: BartWorks"); - totalMods++; - } - if (isModLoaded("BuildCraft")) { - BuildCraft = true; - Logger.INFO("Components enabled for: BuildCraft"); - totalMods++; - } - if ((isModLoaded("EnderIO")) && !ConfigSwitches.disableEnderIOIntegration) { - EnderIO = true; - Logger.INFO("Components enabled for: EnderIO"); - totalMods++; - } - if (isModLoaded("BigReactors")) { - Big_Reactors = true; - Logger.INFO("Components enabled for: Big Reactors"); - totalMods++; - } - if (isModLoaded("IC2-Classic-Spmod")) { - IndustrialCraft2Classic = true; - Logger.INFO("Components enabled for: IndustrialCraft2-Classic"); - totalMods++; - } - if (isModLoaded("simplyjetpacks")) { - Simply_Jetpacks = true; - Logger.INFO("Components enabled for: Simply Jetpacks"); - totalMods++; - } - if (isModLoaded("rftools")) { - RFTools = true; - Logger.INFO("Components enabled for: RFTools"); - totalMods++; - } - if (isModLoaded("StevesCarts")) { - StevesCarts = true; - Logger.INFO("Components enabled for: StevesCarts"); - totalMods++; - } - if (isModLoaded("OpenBlocks")) { - OpenBlocks = true; - Logger.INFO("Components enabled for: OpenBlocks"); - totalMods++; - } - if (isModLoaded("Thaumcraft")) { - Thaumcraft = true; - Logger.INFO("Components enabled for: Thaumcraft"); - totalMods++; - } - if (isModLoaded("thaumicbases")) { - ThaumicBases = true; - Logger.INFO("Components enabled for: Thaumic Bases"); - totalMods++; - } - if (isModLoaded("BiomesOPlenty")) { - BiomesOPlenty = true; - Logger.INFO("Components enabled for: BiomesOPlenty"); - totalMods++; - } - if (isModLoaded("ExtraUtilities")) { - Extra_Utils = true; - Logger.INFO("Components enabled for: Extra_Utils"); - totalMods++; - } - if (isModLoaded("harvestcraft")) { - PamsHarvestcraft = true; - Logger.INFO("Components enabled for: PamsHarvestcraft"); - totalMods++; - } - if (isModLoaded("PneumaticCraft")) { - PneumaticCraft = true; - Logger.INFO("Components enabled for: PneumaticCraft"); - totalMods++; - } - if (isModLoaded("MorePlanet")) { - MorePlanets = true; - Logger.INFO("Components enabled for: MorePlanets"); - totalMods++; - } - if (isModLoaded("ForbiddenMagic")) { - ForbiddenMagic = true; - Logger.INFO("Components enabled for: ForbiddenMagic"); - totalMods++; - } - if (isModLoaded("CompactWindmills")) { - CompactWindmills = true; - Logger.INFO("Components enabled for: CompactWindmills"); - totalMods++; - } - if (isModLoaded("Railcraft")) { - Railcraft = true; - Logger.INFO("Components enabled for: Railcraft"); - totalMods++; - } - if (isModLoaded("Waila")) { - Waila = true; - Logger.INFO("Components enabled for: WAILA"); - totalMods++; - } - if (isModLoaded("SpiceOfLife")) { - SpiceOfLife = true; - Logger.INFO("Components enabled for: Spice Of Life"); - totalMods++; - } - if (isModLoaded("Mekanism")) { - Mekanism = true; - Logger.INFO( - "Components enabled for: Mekanism - This feature is not configurable and balances Mekanism to suit GT."); - totalMods++; - } - if (isModLoaded("Growthcraft")) { - Logger.INFO("Growthcraft Version: " + getModVersion("Growthcraft")); - if (getModVersion("Growthcraft").equals("1.7.10-2.3.1")) { - // Load Growthcraft Compat - Growthcraft = true; - Logger.INFO("Components enabled for: Growthcraft"); - totalMods++; - } else { - Growthcraft = false; - Logger.INFO("Growthcraft found, but the version was too new. I will update GC support eventually."); - } - } - if (isModLoaded("CoFHCore")) { - CoFHCore = true; - Logger.INFO("Components enabled for: CoFHCore"); - totalMods++; - } - if (isModLoaded("Forestry")) { - Forestry = true; - Logger.INFO("Components enabled for: Forestry"); - totalMods++; - } - if (isModLoaded("MagicBees")) { - MagicBees = true; - Logger.INFO("Components enabled for: MagicBees"); - totalMods++; - } - if (isModLoaded("psychedelicraft")) { - Psychedelicraft = true; - Logger.INFO("Components enabled for: Psychedelicraft"); - totalMods++; - } - if (isModLoaded("ImmersiveEngineering")) { - ImmersiveEngineering = true; - Logger.INFO("Components enabled for: ImmersiveEngineering"); - totalMods++; - } - if (isModLoaded("ExtraBees")) { - ExtraBees = true; - Logger.INFO("Components enabled for: ExtraBees"); - totalMods++; - } - if (isModLoaded("ThermalFoundation") == false) { - ThermalFoundation = false; - Logger.INFO("Components enabled for: ThermalFoundation - This feature will disable itself if you add TF."); - totalMods++; - } else if (isModLoaded("ThermalFoundation")) { - ThermalFoundation = true; - Logger.INFO( - "Components disabled for: ThermalFoundation - This feature will enable itself if you remove TF."); - // totalMods++; - } - if (isModLoaded("ihl")) { - IHL = true; - Logger.INFO("Components enabled for: IHL"); - totalMods++; - } - if (isModLoaded("Baubles")) { - Baubles = true; - Logger.INFO("Components enabled for: Baubles"); - totalMods++; - } - if (isModLoaded("GalacticraftCore")) { - GalacticraftCore = true; - Logger.INFO("Components enabled for: Galacticraft Core"); - totalMods++; - } - if (isModLoaded("OpenComputers")) { - OpenComputers = true; - Logger.INFO("Components enabled for: OpenComputers"); - totalMods++; - } - if (isModLoaded("computronics")) { - Computronics = true; - Logger.INFO( - "Components disabled for: Computronics - This feature will enable itself if you remove Computronics."); - totalMods++; - } else { - Logger.INFO( - "Components enabled for: Computronics - This feature will disable itself if you add Computronics."); - } - if (isModLoaded("GTRedtech")) { - RedTech = true; - Logger.INFO("Components enabled for: GTRedtech"); - totalMods++; - } - if (isModLoaded("tectech")) { - TecTech = true; - Logger.INFO("Components enabled for: TecTech"); - totalMods++; - } - if (isModLoaded("kekztech")) { - KekzTech = true; - Logger.INFO("Components enabled for: KekzTech"); - totalMods++; - } - if (isModLoaded("witchery")) { - Witchery = true; - Logger.INFO("Components enabled for: Witchery"); - totalMods++; - } - if (isModLoaded("RIO")) { - RemoteIO = true; - Logger.INFO("Components enabled for: RemoteIO"); - totalMods++; - } - if (isModLoaded("ExtraTrees")) { - ExtraTrees = true; - Logger.INFO("Components enabled for: ExtraTrees"); - totalMods++; - } - Logger.INFO("Content found for " + totalMods + " mods"); - } - - public static String getModVersion(final String modName) { - final String ver = cpw.mods.fml.common.FMLCommonHandler.instance().findContainerFor(modName).getVersion(); - return ver; - } - - private static final HashMap mLoadedModCache = new HashMap(); - - public static boolean isModLoaded(String aModName) { - Boolean aResult = mLoadedModCache.get(aModName); - if (aResult == null) { - boolean aTemp = Loader.isModLoaded(aModName); - mLoadedModCache.put(aModName, aTemp); - aResult = aTemp; - } - return aResult; - } -} -- cgit