From 6b77557e0e87cf5afd9ebd3985323ff1249e615c Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Sun, 2 Apr 2023 00:02:47 +0800 Subject: Recipe Adder v2 (#1770) * add everything * fixes * migrate plasma forge recipes * syntax update * make chances array length differ a fatal error * time constants + long eut overload * migrate extruder recipes * migrate electromagnetic separator recipes * migrate wiremill recipes * migrate forming press recipes * migrate bender recipes * add doc to clarify the three itemInputs * migrate alloy smelter recipes * migrate arc furnace recipes * added ModIDs enum * sort ModIDs * migrate autoclave recipes * migrated some assembler recipes * split a bit more assembler recipes * migrate canner recipes * migrate brewing recipes * ic2 mod check in canner recipes * use some loops to reduce the amount of recipes to migrate * add requested helper methods * migrate vacuum freezer recipes * migrate thermal centrifuge recipes * format smelter recipes only, doesn't go through normal GT recipe * migrated slicer recipes * migrated sifter recipes * Use proper enum now * remove more constants * cleaning cutting recipes before migration * remove tons of dead commented recipes * migrate pyrolyse recipes * use ModIDs enum more * migrate printer recipes * add a less confusing way to specify value of specialItem * migrate pulverizer recipes * less confusing special item specification * even more ModIDs enum usage * fix auto * import confusing Minecraft enum value with Minecraft client object * migrated blast furnace recipes * migrated Centrifuge recipes * migrated assembler recipes * migrated implosion compressor recipes * migrated extractor recipes * migrated mixer recipes * remove useless code * mgrate universal chemical recipes * refactor chemical recipes * migrate single block only chem reactor recipes * migrate chem reactor recipes * reworked circuit assembler recipes before migrating them * migrated circuit assembler recipes * fix merge conflict for assembler recipes * remove leftover of the merge conflicts * fix weird translation glitch * example of assembly line recipe using RA2 * bugfixes for assline * remove specialValue usage in blast furnace recipes * fix more bugs * add nooptimize to where it make sense * add recipe descriptions * Materials.Superconductor -> Materials.SuperconductorUHV * remove useless Object creations * remove explicit long casts * migrate assemblyline recipes * migrate chemical bath recipes * migrate compressor recipes * move smelting recipe where it belongs * migrated cutting machine recipes * migrated fermenter recipes (unhide alcohol) * remove explicit long casts * migrate fluid canner recipes * migrate fluid heater recipes * migrated fusion recipes * migrated lathe recipes * migrated laser engraver recipes * migrated packager recipes * migrated forge hammer recipes * migrated TPM recipes * exit early and reduced indents * migrated fluid extractor recipes * migrated fluid solidifier recipes * migrated electrolyzer recipes * migrated crop processing recipes * migrated default polymerization recipes * migrate distillery recipes * migrate matter amplifier recipes * add metadata identifier for fusion ignition threshold * migrate fuel recipes * update bs (cherry picked from commit c2d931c9b6caa0376e9d50591894cd849021104d) * spotless (cherry picked from commit 1060f5357fb95e28bfae1f052025f55dabc21a0f) * guard against null itemstacks * wrong translation * fix empty arrays being accessed * add 0 duration and 0 EU/t for fuel recipes * fix typo in matter amplifier recipes * spotless apply --------- Co-authored-by: boubou19 Co-authored-by: Martin Robertz --- src/main/java/gregtech/api/enums/GT_Values.java | 4 +- src/main/java/gregtech/api/enums/Materials.java | 8 +-- src/main/java/gregtech/api/enums/ModIDs.java | 84 ++++++++++++++++++++++ .../java/gregtech/api/enums/SoundResource.java | 48 ++++++------- 4 files changed, 115 insertions(+), 29 deletions(-) create mode 100644 src/main/java/gregtech/api/enums/ModIDs.java (limited to 'src/main/java/gregtech/api/enums') diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java index d06e70b0b5..6ccf092461 100644 --- a/src/main/java/gregtech/api/enums/GT_Values.java +++ b/src/main/java/gregtech/api/enums/GT_Values.java @@ -1,5 +1,7 @@ package gregtech.api.enums; +import static gregtech.api.enums.ModIDs.IndustrialCraft2; + import java.math.BigInteger; import java.util.*; @@ -206,7 +208,7 @@ public class GT_Values { TEX_DIR_ASPECTS = TEX_DIR + "aspects/", RES_PATH = MOD_ID + ":" + TEX_DIR, RES_PATH_GUI = MOD_ID + ":" + TEX_DIR_GUI, RES_PATH_ITEM = MOD_ID + ":", RES_PATH_BLOCK = MOD_ID + ":", RES_PATH_ENTITY = MOD_ID + ":" + TEX_DIR_ENTITY, RES_PATH_ASPECTS = MOD_ID + ":" + TEX_DIR_ASPECTS, - RES_PATH_IC2 = MOD_ID_IC2.toLowerCase(Locale.ENGLISH) + ":", + RES_PATH_IC2 = IndustrialCraft2.modID.toLowerCase(Locale.ENGLISH) + ":", RES_PATH_MODEL = MOD_ID + ":" + TEX_DIR + "models/"; /** diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 9932cf3b09..3ff4d70920 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -2,7 +2,8 @@ package gregtech.api.enums; import static gregtech.api.enums.FluidState.GAS; import static gregtech.api.enums.GT_Values.M; -import static gregtech.api.enums.GT_Values.MOD_ID_DC; +import static gregtech.api.enums.ModIDs.NewHorizonsCoreMod; +import static gregtech.api.enums.ModIDs.Thaumcraft; import java.util.*; import java.util.stream.Collectors; @@ -13,7 +14,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; -import cpw.mods.fml.common.Loader; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.TC_Aspects.TC_AspectStack; @@ -2316,7 +2316,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { MATERIALS_ARRAY = MATERIALS_MAP.values().toArray(new Materials[0]); // Generate standard object array. This is a // lot faster to loop over. VALUES = Arrays.asList(MATERIALS_ARRAY); - if (!Loader.isModLoaded(MOD_ID_DC) && !GT_Mod.gregtechproxy.mEnableAllComponents) + if (!NewHorizonsCoreMod.isModLoaded() && !GT_Mod.gregtechproxy.mEnableAllComponents) OrePrefixes.initMaterialComponents(); else { OrePrefixes.ingotHot.mDisabledItems.addAll( @@ -2442,7 +2442,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { : aMaterial == Diamond || aMaterial == Thaumium ? Wood : aMaterial.contains(SubTag.BURNING) ? Blaze : aMaterial.contains(SubTag.MAGICAL) && aMaterial.contains(SubTag.CRYSTAL) - && Loader.isModLoaded(GT_Values.MOD_ID_TC) ? Thaumium + && Thaumcraft.isModLoaded() ? Thaumium : aMaterial.getMass() > Element.Tc.getMass() * 2 ? TungstenSteel : aMaterial.getMass() > Element.Tc.getMass() ? Steel : Wood); diff --git a/src/main/java/gregtech/api/enums/ModIDs.java b/src/main/java/gregtech/api/enums/ModIDs.java new file mode 100644 index 0000000000..16c03e3ae5 --- /dev/null +++ b/src/main/java/gregtech/api/enums/ModIDs.java @@ -0,0 +1,84 @@ +package gregtech.api.enums; + +import cpw.mods.fml.common.Loader; + +public enum ModIDs { + + AdvancedSolarPanel("AdvancedSolarPanel"), + AE2FluidCraft("ae2fc"), + AppleCore("AppleCore"), + AppliedEnergistics2("appliedenergistics2"), + Avaritia("Avaritia"), + AvaritiaAddons("avaritiaddons"), + BartWorks("bartworks"), + BetterLoadingScreen("betterloadingscreen"), + BiomesOPlanty("BiomesOPlenty"), + BuildCraftFactory("BuildCraft|Factory"), + BuildCraftSilicon("BuildCraft|Silicon"), + BuildCraftTransport("BuildCraft|Transport"), + Computronics("computronics"), + CraftTweaker("MineTweaker3"), + EnderIO("EnderIO"), + EnderStorage("EnderStorage"), + EternalSingularity("eternalsingularity"), + ExtraCells2("extracells"), + ExtraUtilities("ExtraUtilities"), + ForbiddenMagic("ForbiddenMagic"), + Forestry("Forestry"), + GalacticraftCore("GalacticraftCore"), + GalacticraftMars("GalacticraftMars"), + GalaxySpace("GalaxySpace"), + Gendustry("gendustry"), + GoodGenerator("GoodGenerator"), + GregTech("gregtech"), + GraviSuite("GraviSuite"), + GTNHLanthanides("gtnhlanth"), + GTPlusPlus("miscutils"), + PamsHarvestCraft("harvestcraft"), + HardcoreEnderExpansion("HardcoreEnderExpansion"), + HodgePodge("hodgepodge"), + IC2CropPlugin("Ic2Nei"), + IC2NuclearControl("IC2NuclearControl"), + IguanaTweaksTinkerConstruct("IguanaTweaksTConstruct"), + IndustrialCraft2("IC2"), + IronChests("IronChest"), + IronTanks("irontank"), + Minecraft("minecraft"), + Natura("Natura"), + NEICustomDiagrams("neicustomdiagram"), + NewHorizonsCoreMod("dreamcraft"), + NotEnoughItems("NotEnoughItems"), + OpenComputers("OpenComputers"), + ProjectRedCore("ProjRed|Core"), + Railcraft("Railcraft"), + TaintedMagic("TaintedMagic"), + Thaumcraft("Thaumcraft"), + ThaumicBases("thaumicbases"), + ThaumicTinkerer("ThaumicTinkerer"), + TinkerConstruct("TConstruct"), + TinkersGregworks("TGregworks"), + Translocator("Translocator"), + TwilightForest("TwilightForest"), + Waila("Waila"), + // Do we keep compat of those? + IndustrialCraft2Classic("IC2-Classic-Spmod"), + Metallurgy("Metallurgy"), + RotaryCraft("RotaryCraft"), + ThermalExpansion("ThermalExpansion"), + ThermalFondation("ThermalFoundation"), + UndergroundBiomes("UndergroundBiomes"); + + public final String modID; + private Boolean modLoaded; + + ModIDs(String modID) { + this.modID = modID; + } + + public boolean isModLoaded() { + if (this.modLoaded == null) { + this.modLoaded = Loader.isModLoaded(modID); + } + return this.modLoaded; + } +} diff --git a/src/main/java/gregtech/api/enums/SoundResource.java b/src/main/java/gregtech/api/enums/SoundResource.java index f1dffb3884..63a8331496 100644 --- a/src/main/java/gregtech/api/enums/SoundResource.java +++ b/src/main/java/gregtech/api/enums/SoundResource.java @@ -1,7 +1,7 @@ package gregtech.api.enums; import static gregtech.api.enums.GT_Values.MOD_ID; -import static gregtech.api.enums.GT_Values.MOD_ID_IC2; +import static gregtech.api.enums.ModIDs.IndustrialCraft2; import java.util.EnumSet; import java.util.Locale; @@ -30,31 +30,31 @@ public enum SoundResource { RANDOM_EXPLODE(5, "random.explode"), FIRE_IGNITE(6, "fire.ignite"), - IC2_TOOLS_WRENCH(100, MOD_ID_IC2, "tools.Wrench"), - IC2_TOOLS_RUBBER_TRAMPOLINE(101, MOD_ID_IC2, "tools.RubberTrampoline"), - IC2_TOOLS_PAINTER(102, MOD_ID_IC2, "tools.Painter"), - IC2_TOOLS_BATTERY_USE(103, MOD_ID_IC2, "tools.BatteryUse"), - IC2_TOOLS_CHAINSAW_CHAINSAW_USE_ONE(104, MOD_ID_IC2, "tools.chainsaw.ChainsawUseOne"), - IC2_TOOLS_CHAINSAW_CHAINSAW_USE_TWO(105, MOD_ID_IC2, "tools.chainsaw.ChainsawUseTwo"), - IC2_TOOLS_DRILL_DRILL_SOFT(106, MOD_ID_IC2, "tools.drill.DrillSoft"), - IC2_TOOLS_DRILL_DRILL_HARD(107, MOD_ID_IC2, "tools.drill.DrillHard"), - IC2_TOOLS_OD_SCANNER(108, MOD_ID_IC2, "tools.ODScanner"), - IC2_TOOLS_INSULATION_CUTTERS(109, MOD_ID_IC2, "tools.InsulationCutters"), + IC2_TOOLS_WRENCH(100, IndustrialCraft2.modID, "tools.Wrench"), + IC2_TOOLS_RUBBER_TRAMPOLINE(101, IndustrialCraft2.modID, "tools.RubberTrampoline"), + IC2_TOOLS_PAINTER(102, IndustrialCraft2.modID, "tools.Painter"), + IC2_TOOLS_BATTERY_USE(103, IndustrialCraft2.modID, "tools.BatteryUse"), + IC2_TOOLS_CHAINSAW_CHAINSAW_USE_ONE(104, IndustrialCraft2.modID, "tools.chainsaw.ChainsawUseOne"), + IC2_TOOLS_CHAINSAW_CHAINSAW_USE_TWO(105, IndustrialCraft2.modID, "tools.chainsaw.ChainsawUseTwo"), + IC2_TOOLS_DRILL_DRILL_SOFT(106, IndustrialCraft2.modID, "tools.drill.DrillSoft"), + IC2_TOOLS_DRILL_DRILL_HARD(107, IndustrialCraft2.modID, "tools.drill.DrillHard"), + IC2_TOOLS_OD_SCANNER(108, IndustrialCraft2.modID, "tools.ODScanner"), + IC2_TOOLS_INSULATION_CUTTERS(109, IndustrialCraft2.modID, "tools.InsulationCutters"), - IC2_MACHINES_EXTRACTOR_OP(200, MOD_ID_IC2, "machines.ExtractorOp"), - IC2_MACHINES_MACERATOR_OP(201, MOD_ID_IC2, "machines.MaceratorOp"), - IC2_MACHINES_INDUCTION_LOOP(202, MOD_ID_IC2, "machines.InductionLoop"), - IC2_MACHINES_COMPRESSOR_OP(203, MOD_ID_IC2, "machines.CompressorOp"), - IC2_MACHINES_RECYCLER_OP(204, MOD_ID_IC2, "machines.RecyclerOp"), - IC2_MACHINES_MINER_OP(205, MOD_ID_IC2, "machines.MinerOp"), - IC2_MACHINES_PUMP_OP(206, MOD_ID_IC2, "machines.PumpOp"), - IC2_MACHINES_ELECTROFURNACE_LOOP(207, MOD_ID_IC2, "machines.ElectroFurnaceLoop"), + IC2_MACHINES_EXTRACTOR_OP(200, IndustrialCraft2.modID, "machines.ExtractorOp"), + IC2_MACHINES_MACERATOR_OP(201, IndustrialCraft2.modID, "machines.MaceratorOp"), + IC2_MACHINES_INDUCTION_LOOP(202, IndustrialCraft2.modID, "machines.InductionLoop"), + IC2_MACHINES_COMPRESSOR_OP(203, IndustrialCraft2.modID, "machines.CompressorOp"), + IC2_MACHINES_RECYCLER_OP(204, IndustrialCraft2.modID, "machines.RecyclerOp"), + IC2_MACHINES_MINER_OP(205, IndustrialCraft2.modID, "machines.MinerOp"), + IC2_MACHINES_PUMP_OP(206, IndustrialCraft2.modID, "machines.PumpOp"), + IC2_MACHINES_ELECTROFURNACE_LOOP(207, IndustrialCraft2.modID, "machines.ElectroFurnaceLoop"), @Deprecated - DEPRECATED_DUPE_OF_IC2_MACHINES_INDUCTION_LOOP(208, MOD_ID_IC2, "machines.InductionLoop"), - IC2_MACHINES_MACHINE_OVERLOAD(209, MOD_ID_IC2, "machines.MachineOverload"), - IC2_MACHINES_INTERRUPT_ONE(210, MOD_ID_IC2, "machines.InterruptOne"), - IC2_MACHINES_KA_CHING(211, MOD_ID_IC2, "machines.KaChing"), - IC2_MACHINES_MAGNETIZER_LOOP(212, MOD_ID_IC2, "machines.MagnetizerLoop"), + DEPRECATED_DUPE_OF_IC2_MACHINES_INDUCTION_LOOP(208, IndustrialCraft2.modID, "machines.InductionLoop"), + IC2_MACHINES_MACHINE_OVERLOAD(209, IndustrialCraft2.modID, "machines.MachineOverload"), + IC2_MACHINES_INTERRUPT_ONE(210, IndustrialCraft2.modID, "machines.InterruptOne"), + IC2_MACHINES_KA_CHING(211, IndustrialCraft2.modID, "machines.KaChing"), + IC2_MACHINES_MAGNETIZER_LOOP(212, IndustrialCraft2.modID, "machines.MagnetizerLoop"), GT_MACHINES_FUSION_LOOP(230, MOD_ID, "machines.FusionLoop"), GT_MACHINES_DISTILLERY_LOOP(231, MOD_ID, "machines.DistilleryLoop"), -- cgit