diff options
| author | chochem <40274384+chochem@users.noreply.github.com> | 2024-05-26 00:34:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-26 00:34:53 +0100 |
| commit | 3939f74dc8afe7236f2bec0aba021e3675c24bfc (patch) | |
| tree | bd8a56ac6d9e30b54d42848d34677becb1801c50 /src/main/java | |
| parent | 3819aed2f2e0e82f303f76b789b519c7702cf9bb (diff) | |
| download | GT5-Unofficial-3939f74dc8afe7236f2bec0aba021e3675c24bfc.tar.gz GT5-Unofficial-3939f74dc8afe7236f2bec0aba021e3675c24bfc.tar.bz2 GT5-Unofficial-3939f74dc8afe7236f2bec0aba021e3675c24bfc.zip | |
Mod load check refactors (#2621)
* deprecate LoaderReference
* replace all uses of LoaderReference
* delete loaderreference
* mod loaded checks in gagreg
* remove modloaded checks for merged mods
Diffstat (limited to 'src/main/java')
47 files changed, 1807 insertions, 2012 deletions
diff --git a/src/main/java/bloodasp/galacticgreg/GalacticGreg.java b/src/main/java/bloodasp/galacticgreg/GalacticGreg.java index 4ca2eb36f6..d48a65c79d 100644 --- a/src/main/java/bloodasp/galacticgreg/GalacticGreg.java +++ b/src/main/java/bloodasp/galacticgreg/GalacticGreg.java @@ -1,5 +1,7 @@ package bloodasp.galacticgreg; +import static gregtech.api.enums.Mods.AppliedEnergistics2; + import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -13,7 +15,6 @@ import bloodasp.galacticgreg.command.AEStorageCommand; import bloodasp.galacticgreg.command.ProfilingCommand; import bloodasp.galacticgreg.registry.GalacticGregRegistry; import bloodasp.galacticgreg.schematics.SpaceSchematicHandler; -import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -90,26 +91,21 @@ public class GalacticGreg { // new WorldGenGaGT().run(); DO NOT UNCOMMENT, was moved to gregtech.loaders.postload.GT_Worldgenloader - if (Loader.isModLoaded("bartworks")) { - for (int f = 0, - j = GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks", "AmountOfCustomLargeVeinSlots", 0); f - < j; f++) { - new BW_Worldgen_Ore_Layer_Space( - "mix.custom." + (f < 10 ? "0" : "") + f, - GregTech_API.sWorldgenFile - .get("worldgen.GaGregBartworks." + "mix.custom." + (f < 10 ? "0" : "") + f, "Enabled", false)); - } + for (int f = 0, + j = GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks", "AmountOfCustomLargeVeinSlots", 0); f + < j; f++) { + new BW_Worldgen_Ore_Layer_Space( + "mix.custom." + (f < 10 ? "0" : "") + f, + GregTech_API.sWorldgenFile + .get("worldgen.GaGregBartworks." + "mix.custom." + (f < 10 ? "0" : "") + f, "Enabled", false)); + } - for (int f = 0, - j = GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks", "AmountOfCustomSmallSlots", 0); f - < j; f++) { - new BW_Worldgen_Ore_SmallOre_Space( - "small.custom." + (f < 10 ? "0" : "") + f, - GregTech_API.sWorldgenFile.get( - "worldgen.GaGregBartworks." + "small.custom." + (f < 10 ? "0" : "") + f, - "Enabled", - false)); - } + for (int f = 0, j = GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks", "AmountOfCustomSmallSlots", 0); f + < j; f++) { + new BW_Worldgen_Ore_SmallOre_Space( + "small.custom." + (f < 10 ? "0" : "") + f, + GregTech_API.sWorldgenFile + .get("worldgen.GaGregBartworks." + "small.custom." + (f < 10 ? "0" : "") + f, "Enabled", false)); } for (Runnable r : ADDITIONALVEINREGISTER) { @@ -136,7 +132,7 @@ public class GalacticGreg { if (GalacticConfig.ProfileOreGen) pEvent.registerServerCommand(new ProfilingCommand()); - if (Loader.isModLoaded("appliedenergistics2") && GalacticConfig.EnableAEExportCommand + if (AppliedEnergistics2.isModLoaded() && GalacticConfig.EnableAEExportCommand && GalacticConfig.SchematicsEnabled) pEvent.registerServerCommand(new AEStorageCommand()); Logger.trace("Leaving SERVERLOAD"); diff --git a/src/main/java/com/elisis/gtnhlanth/loader/RecipeLoader.java b/src/main/java/com/elisis/gtnhlanth/loader/RecipeLoader.java index d5c7d63f8d..7997865ebe 100644 --- a/src/main/java/com/elisis/gtnhlanth/loader/RecipeLoader.java +++ b/src/main/java/com/elisis/gtnhlanth/loader/RecipeLoader.java @@ -54,7 +54,6 @@ import com.elisis.gtnhlanth.common.register.WerkstoffMaterialPool; import com.github.bartimaeusnek.bartworks.system.material.GT_Enhancement.PlatinumSludgeOverHaul; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; -import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import goodgenerator.items.MyMaterial; import gregtech.api.enums.GT_Values; @@ -3454,105 +3453,103 @@ public class RecipeLoader { GT_Log.out.print("Electrolyzer (PA) done!\n"); - if (Loader.isModLoaded("miscutils")) { - // For Simple Washer - for (GT_Recipe recipe : simpleWasherRecipes.getAllRecipes()) { - ItemStack input = recipe.mInputs[0]; - if (GT_Utility.isStackValid(input)) { - int[] oreDict = OreDictionary.getOreIDs(input); - for (int oreDictID : oreDict) { - if (OreDictionary.getOreName(oreDictID) - .startsWith("dustImpureCerium") - || OreDictionary.getOreName(oreDictID) - .startsWith("dustImpureSamarium") - || OreDictionary.getOreName(oreDictID) - .startsWith("dustPureSamarium") - || OreDictionary.getOreName(oreDictID) - .startsWith("dustPureCerium")) { - GT_Recipe tRecipe = recipe.copy(); - for (int i = 0; i < tRecipe.mOutputs.length; i++) { - if (!GT_Utility.isStackValid(tRecipe.mOutputs[i])) continue; - if (tRecipe.mOutputs[i].isItemEqual(Materials.Cerium.getDust(1))) { - tRecipe.mOutputs[i] = GT_Utility.copyAmount( - tRecipe.mOutputs[i].stackSize, - WerkstoffMaterialPool.CeriumRichMixture.get(OrePrefixes.dust, 1)); - } else if (tRecipe.mOutputs[i].isItemEqual(Materials.Samarium.getDust(1))) { - tRecipe.mOutputs[i] = GT_Utility.copyAmount( - tRecipe.mOutputs[i].stackSize, - WerkstoffMaterialPool.SamariumOreConcentrate.get(OrePrefixes.dust, 1)); - } - } - if (!tRecipe.equals(recipe)) { - reAdd.add(tRecipe); - remove.add(recipe); + // For Simple Washer + for (GT_Recipe recipe : simpleWasherRecipes.getAllRecipes()) { + ItemStack input = recipe.mInputs[0]; + if (GT_Utility.isStackValid(input)) { + int[] oreDict = OreDictionary.getOreIDs(input); + for (int oreDictID : oreDict) { + if (OreDictionary.getOreName(oreDictID) + .startsWith("dustImpureCerium") + || OreDictionary.getOreName(oreDictID) + .startsWith("dustImpureSamarium") + || OreDictionary.getOreName(oreDictID) + .startsWith("dustPureSamarium") + || OreDictionary.getOreName(oreDictID) + .startsWith("dustPureCerium")) { + GT_Recipe tRecipe = recipe.copy(); + for (int i = 0; i < tRecipe.mOutputs.length; i++) { + if (!GT_Utility.isStackValid(tRecipe.mOutputs[i])) continue; + if (tRecipe.mOutputs[i].isItemEqual(Materials.Cerium.getDust(1))) { + tRecipe.mOutputs[i] = GT_Utility.copyAmount( + tRecipe.mOutputs[i].stackSize, + WerkstoffMaterialPool.CeriumRichMixture.get(OrePrefixes.dust, 1)); + } else if (tRecipe.mOutputs[i].isItemEqual(Materials.Samarium.getDust(1))) { + tRecipe.mOutputs[i] = GT_Utility.copyAmount( + tRecipe.mOutputs[i].stackSize, + WerkstoffMaterialPool.SamariumOreConcentrate.get(OrePrefixes.dust, 1)); } - break; } + if (!tRecipe.equals(recipe)) { + reAdd.add(tRecipe); + remove.add(recipe); + } + break; } } } - simpleWasherRecipes.getBackend() - .removeRecipes(remove); - reAdd.forEach(simpleWasherRecipes::add); - simpleWasherRecipes.getBackend() - .reInit(); + } + simpleWasherRecipes.getBackend() + .removeRecipes(remove); + reAdd.forEach(simpleWasherRecipes::add); + simpleWasherRecipes.getBackend() + .reInit(); - GT_Log.out.print(Tags.MODID + ": Replace " + remove.size() + "! "); + GT_Log.out.print(Tags.MODID + ": Replace " + remove.size() + "! "); - remove.clear(); - reAdd.clear(); + remove.clear(); + reAdd.clear(); - GT_Log.out.print("Simple Washer done!\n"); + GT_Log.out.print("Simple Washer done!\n"); - // Dehydrator - for (GT_Recipe recipe : chemicalDehydratorRecipes.getAllRecipes()) { - if (recipe.mInputs.length == 0) { - continue; - } - ItemStack input = recipe.mInputs[0]; + // Dehydrator + for (GT_Recipe recipe : chemicalDehydratorRecipes.getAllRecipes()) { + if (recipe.mInputs.length == 0) { + continue; + } + ItemStack input = recipe.mInputs[0]; - if (GT_Utility.isStackValid(input)) { - int[] oreDict = OreDictionary.getOreIDs(input); - for (int oreDictID : oreDict) { - String oreName = OreDictionary.getOreName(oreDictID); - if (oreName.equals("dustCerite") || oreName.equals("dustFluorcaphite") - || oreName.equals("dustZirkelite") - || oreName.equals("dustGadoliniteCe") - || oreName.equals("dustGadoliniteY") - || oreName.equals("dustPolycrase") - || oreName.equals("dustBastnasite")) { - GT_Recipe tRecipe = recipe.copy(); - for (int i = 0; i < tRecipe.mOutputs.length; i++) { - if (!GT_Utility.isStackValid(tRecipe.mOutputs[i])) continue; - if (tRecipe.mOutputs[i].isItemEqual(Materials.Cerium.getDust(1))) { - tRecipe.mOutputs[i] = GT_Utility.copyAmount( - tRecipe.mOutputs[i].stackSize, - WerkstoffMaterialPool.CeriumRichMixture.get(OrePrefixes.dust, 1)); - } - } - if (!tRecipe.equals(recipe)) { - reAdd.add(tRecipe); - remove.add(recipe); + if (GT_Utility.isStackValid(input)) { + int[] oreDict = OreDictionary.getOreIDs(input); + for (int oreDictID : oreDict) { + String oreName = OreDictionary.getOreName(oreDictID); + if (oreName.equals("dustCerite") || oreName.equals("dustFluorcaphite") + || oreName.equals("dustZirkelite") + || oreName.equals("dustGadoliniteCe") + || oreName.equals("dustGadoliniteY") + || oreName.equals("dustPolycrase") + || oreName.equals("dustBastnasite")) { + GT_Recipe tRecipe = recipe.copy(); + for (int i = 0; i < tRecipe.mOutputs.length; i++) { + if (!GT_Utility.isStackValid(tRecipe.mOutputs[i])) continue; + if (tRecipe.mOutputs[i].isItemEqual(Materials.Cerium.getDust(1))) { + tRecipe.mOutputs[i] = GT_Utility.copyAmount( + tRecipe.mOutputs[i].stackSize, + WerkstoffMaterialPool.CeriumRichMixture.get(OrePrefixes.dust, 1)); } - break; } + if (!tRecipe.equals(recipe)) { + reAdd.add(tRecipe); + remove.add(recipe); + } + break; } } } + } - chemicalDehydratorRecipes.getBackend() - .removeRecipes(remove); - reAdd.forEach(chemicalDehydratorRecipes::add); - chemicalDehydratorRecipes.getBackend() - .reInit(); + chemicalDehydratorRecipes.getBackend() + .removeRecipes(remove); + reAdd.forEach(chemicalDehydratorRecipes::add); + chemicalDehydratorRecipes.getBackend() + .reInit(); - GT_Log.out.print(Tags.MODID + ": Replace " + remove.size() + "! "); + GT_Log.out.print(Tags.MODID + ": Replace " + remove.size() + "! "); - remove.clear(); - reAdd.clear(); + remove.clear(); + reAdd.clear(); - GT_Log.out.print("Dehydrator done!\n"); - } + GT_Log.out.print("Dehydrator done!\n"); /* * DOES NOT WORK, something to do with load times for sifter recipes or some shit //Sifter for (GT_Recipe recipe diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java index f8e4bbfe7b..415b5af36c 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -17,7 +17,6 @@ import static com.github.bartimaeusnek.bartworks.common.loaders.BioRecipeLoader. import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.removeIC2Recipes; import static gregtech.api.enums.GT_Values.VN; import static gregtech.api.enums.Mods.BartWorks; -import static gregtech.api.enums.Mods.GTPlusPlus; import java.io.IOException; import java.util.Map; @@ -113,9 +112,7 @@ public final class MainMod { @Mod.EventHandler public void preInit(FMLPreInitializationEvent preinit) { - if (GTPlusPlus.isModLoaded()) { - MainMod.LOGGER.info("Found GT++, continuing"); - } + MainMod.LOGGER.info("Found GT++, continuing"); if (API_ConfigValues.debugLog) { try { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/GTNHBlocks.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/GTNHBlocks.java index 329d73023f..977ebf19e0 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/GTNHBlocks.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/GTNHBlocks.java @@ -128,9 +128,7 @@ public class GTNHBlocks { } } - if (TecTech.isModLoaded()) { - BioVatLogicAdder.BioVatGlass.addCustomGlass(TecTech.ID, "tile.quantumGlass", 0, 8); - } + BioVatLogicAdder.BioVatGlass.addCustomGlass(TecTech.ID, "tile.quantumGlass", 0, 8); if (Witchery.isModLoaded()) { for (int i = 0; i < 16; i++) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java index 499686e6e0..1a655ab4fa 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java @@ -16,7 +16,6 @@ package com.github.bartimaeusnek.bartworks.common.loaders; import static com.github.bartimaeusnek.bartworks.MainMod.BWT; import static com.github.bartimaeusnek.bartworks.MainMod.GT2; import static gregtech.api.enums.Mods.GalactiGreg; -import static gregtech.api.enums.Mods.TecTech; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -409,44 +408,42 @@ public class ItemRegistry { "VoidMiner1", "Void Miner I").getStackForm(1L); } - if (TecTech.isModLoaded()) { - TecTechPipeEnergyLowPower = new TT_MetaTileEntity_Pipe_Energy_LowPower( - ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 14, - "pipe.lowpowerlaser", - "Low Power Laser Pipe").getStackForm(1L); - int startID = ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 15; - for (int amps = 32; amps <= 128; amps += 32) { - for (int tier = 4; tier < 8; tier++) { - TecTechLaserAdditions[0][amps / 32 - 1][tier - 4] = new TT_MetaTileEntity_LowPowerLaserBox( - startID, - GT_Values.VN[tier] + "_LPLaser_Converter_" + amps, - GT_Values.VN[tier] + " " + amps + "A/t" + " Low Power Laser Converter", - tier, - amps).getStackForm(1L); - startID++; - } + TecTechPipeEnergyLowPower = new TT_MetaTileEntity_Pipe_Energy_LowPower( + ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 14, + "pipe.lowpowerlaser", + "Low Power Laser Pipe").getStackForm(1L); + int startID = ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 15; + for (int amps = 32; amps <= 128; amps += 32) { + for (int tier = 4; tier < 8; tier++) { + TecTechLaserAdditions[0][amps / 32 - 1][tier - 4] = new TT_MetaTileEntity_LowPowerLaserBox( + startID, + GT_Values.VN[tier] + "_LPLaser_Converter_" + amps, + GT_Values.VN[tier] + " " + amps + "A/t" + " Low Power Laser Converter", + tier, + amps).getStackForm(1L); + startID++; } - for (int amps = 32; amps <= 128; amps += 32) { - for (int tier = 4; tier < 8; tier++) { - TecTechLaserAdditions[1][amps / 32 - 1][tier - 4] = new TT_MetaTileEntity_LowPowerLaserHatch( - startID, - GT_Values.VN[tier] + "_LPLaser_Hatch_" + amps, - GT_Values.VN[tier] + " " + amps + "A/t" + " Low Power Laser Target Hatch", - tier, - amps).getStackForm(1L); - startID++; - } + } + for (int amps = 32; amps <= 128; amps += 32) { + for (int tier = 4; tier < 8; tier++) { + TecTechLaserAdditions[1][amps / 32 - 1][tier - 4] = new TT_MetaTileEntity_LowPowerLaserHatch( + startID, + GT_Values.VN[tier] + "_LPLaser_Hatch_" + amps, + GT_Values.VN[tier] + " " + amps + "A/t" + " Low Power Laser Target Hatch", + tier, + amps).getStackForm(1L); + startID++; } - for (int amps = 32; amps <= 128; amps += 32) { - for (int tier = 4; tier < 8; tier++) { - TecTechLaserAdditions[2][amps / 32 - 1][tier - 4] = new TT_MetaTileEntity_LowPowerLaserDynamo( - startID, - GT_Values.VN[tier] + "_LPLaser_Dynamo_" + amps, - GT_Values.VN[tier] + " " + amps + "A/t" + " Low Power Laser Source Hatch", - tier, - amps).getStackForm(1L); - startID++; - } + } + for (int amps = 32; amps <= 128; amps += 32) { + for (int tier = 4; tier < 8; tier++) { + TecTechLaserAdditions[2][amps / 32 - 1][tier - 4] = new TT_MetaTileEntity_LowPowerLaserDynamo( + startID, + GT_Values.VN[tier] + "_LPLaser_Dynamo_" + amps, + GT_Values.VN[tier] + " " + amps + "A/t" + " Low Power Laser Source Hatch", + tier, + amps).getStackForm(1L); + startID++; } } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/PlatinumSludgeOverHaul.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/PlatinumSludgeOverHaul.java index ba08d083c2..85f66beec6 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/PlatinumSludgeOverHaul.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/PlatinumSludgeOverHaul.java @@ -976,7 +976,7 @@ public class PlatinumSludgeOverHaul { if (obj instanceof ShapedRecipes || obj instanceof ShapelessRecipes) { inputName = "recipeOutput"; inputItemName = "recipeItems"; - } else if (GTPlusPlus.isModLoaded()) { + } else { try { if (Class.forName("gtPlusPlus.api.objects.minecraft.ShapedRecipe") .isAssignableFrom(obj.getClass())) @@ -1109,33 +1109,33 @@ public class PlatinumSludgeOverHaul { } } - if (GTPlusPlus.isModLoaded()) { - try { - if (Class.forName("gtPlusPlus.core.item.base.BaseItemComponent") - .isAssignableFrom( - stack.getItem() - .getClass()) - && !stack.getUnlocalizedName() - .contains("dust") - && !stack.getUnlocalizedName() - .contains("Dust")) - return true; - if (Class.forName("gtPlusPlus.core.block.base.BlockBaseModular") - .isAssignableFrom( - Block.getBlockFromItem(stack.getItem()) - .getClass())) - return true; - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - if (stack.getItem() == GT_ModHandler.getModItem(GTPlusPlus.ID, "itemDustHeLiCoPtEr", 1L) - .getItem()) { + try { + if (Class.fo |
