From 097abaeed23438ce16fcb4ac09e510744c2a4de5 Mon Sep 17 00:00:00 2001 From: trinsdar <30245301+Trinsdar@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:50:42 -0400 Subject: [PATCH] more tfc compat --- forge/build.gradle | 1 + .../integration/forge/tfc/MachineRecipes.java | 75 +++++++++++++++++++ .../integration/forge/tfc/TFCRegistrar.java | 12 +++ 3 files changed, 88 insertions(+) create mode 100644 forge/src/main/java/muramasa/gregtech/integration/forge/tfc/MachineRecipes.java diff --git a/forge/build.gradle b/forge/build.gradle index 9e369bae2..273ca3a5d 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -90,6 +90,7 @@ dependencies { modCompileOnly("curse.maven:terrafirmacraft-302973:4723717") modRuntimeOnly("curse.maven:terrafirmacraft-302973:4723717") modRuntimeOnly("curse.maven:patchouli-306770:3846086") + modRuntimeOnly("curse.maven:tfcm-819850:4449385") } jar { diff --git a/forge/src/main/java/muramasa/gregtech/integration/forge/tfc/MachineRecipes.java b/forge/src/main/java/muramasa/gregtech/integration/forge/tfc/MachineRecipes.java new file mode 100644 index 000000000..448933804 --- /dev/null +++ b/forge/src/main/java/muramasa/gregtech/integration/forge/tfc/MachineRecipes.java @@ -0,0 +1,75 @@ +package muramasa.gregtech.integration.forge.tfc; + +import muramasa.antimatter.data.AntimatterMaterialTypes; +import muramasa.antimatter.data.AntimatterMaterials; +import muramasa.antimatter.material.Material; +import muramasa.antimatter.util.Utils; +import muramasa.gregtech.data.Materials; +import muramasa.gregtech.data.RecipeMaps; +import net.dries007.tfc.common.blocks.TFCMaterials; +import net.dries007.tfc.common.blocks.rock.Ore; +import net.dries007.tfc.common.items.TFCItems; +import net.dries007.tfc.util.Metal; +import net.minecraft.world.item.ItemStack; + +import static muramasa.antimatter.data.AntimatterMaterialTypes.DUST; +import static muramasa.antimatter.data.AntimatterMaterials.*; +import static muramasa.antimatter.material.MaterialTags.MACERATE_INTO; +import static muramasa.antimatter.material.MaterialTags.ORE_MULTI; +import static muramasa.gregtech.data.Materials.*; +import static net.dries007.tfc.common.blocks.rock.Ore.*; + +public class MachineRecipes { + public static void init(){ + initMaceratorRecipes(); + } + + public static void initMaceratorRecipes(){ + addMaceratorRecipe(NATIVE_COPPER, Copper); + addMaceratorRecipe(NATIVE_GOLD, Gold); + addMaceratorRecipe(NATIVE_SILVER, Silver); + addMaceratorRecipe(HEMATITE, Iron); + addMaceratorRecipe(CASSITERITE, Cassiterite); + addMaceratorRecipe(BISMUTHINITE, Bismuth); + addMaceratorRecipe(GARNIERITE, Garnierite); + addMaceratorRecipe(MALACHITE, Malachite); + addMaceratorRecipe(MAGNETITE, Magnetite); + addMaceratorRecipe(LIMONITE, YellowLimonite); + addMaceratorRecipe(SPHALERITE, Sphalerite); + addMaceratorRecipe(TETRAHEDRITE, Tetrahedrite); + addMaceratorRecipe(BITUMINOUS_COAL, Coal); + addMaceratorRecipe(LIGNITE, Lignite); + //addMaceratorRecipe(KAOLINITE); + //addMaceratorRecipe(GYPSUM,); + addMaceratorRecipe(GRAPHITE, Graphite); + addMaceratorRecipe(SULFUR, Sulfur); + addMaceratorRecipe(CINNABAR, Cinnabar); + addMaceratorRecipe(CRYOLITE, Redstone); + addMaceratorRecipe(SALTPETER, Saltpeter); + addMaceratorRecipe(HALITE, Salt); + addMaceratorRecipe(LAPIS_LAZULI, Lapis); + addMaceratorRecipe(EMERALD, Emerald); + addMaceratorRecipe(DIAMOND, Diamond); + addMaceratorRecipe(PYRITE, Pyrite); + addMaceratorRecipe(RUBY, Ruby); + addMaceratorRecipe(SAPPHIRE, Sapphire); + addMaceratorRecipe(TOPAZ, Topaz); + addMaceratorRecipe(OPAL, Opal); + addMaceratorRecipe(AMETHYST, Amethyst); + } + + private static void addMaceratorRecipe(Ore input, Material material){ + int multiplier = ORE_MULTI.getInt(material); + ItemStack crushedStack = AntimatterMaterialTypes.CRUSHED.get(MACERATE_INTO.getMapping(material), multiplier); + Material oreByProduct1 = !material.getByProducts().isEmpty() ? material.getByProducts().get(0) : MACERATE_INTO.getMapping(material); + if (input.isGraded()){ + RecipeMaps.MACERATING.RB().ii(TFCItems.GRADED_ORES.get(input).get(Ore.Grade.POOR).get()).io(crushedStack, DUST.get(oreByProduct1, 1)).chances(1.0, 0.05 * multiplier).add("poor_" + material.getId() + "_tfc", 400, 2); + RecipeMaps.MACERATING.RB().ii(TFCItems.GRADED_ORES.get(input).get(Ore.Grade.NORMAL).get()).io(Utils.ca(multiplier * 2, crushedStack), DUST.get(oreByProduct1, 1)).chances(1.0, 0.1 * multiplier).add("normal_" + material.getId() + "_tfc", 400, 2); + RecipeMaps.MACERATING.RB().ii(TFCItems.GRADED_ORES.get(input).get(Ore.Grade.RICH).get()).io(Utils.ca(multiplier * 3, crushedStack), DUST.get(oreByProduct1, 1)).chances(1.0, 0.15 * multiplier).add("rich_" + material.getId() + "_tfc", 400, 2); + } else { + RecipeMaps.MACERATING.RB().ii(TFCItems.ORES.get(input).get()).io(Utils.ca(multiplier * 2, crushedStack), DUST.get(oreByProduct1, 1)).chances(1.0, 0.1 * multiplier).add("normal_" + material.getId() + "_tfc", 400, 2); + } + + + } +} diff --git a/forge/src/main/java/muramasa/gregtech/integration/forge/tfc/TFCRegistrar.java b/forge/src/main/java/muramasa/gregtech/integration/forge/tfc/TFCRegistrar.java index 5e051b77d..e8f09982d 100644 --- a/forge/src/main/java/muramasa/gregtech/integration/forge/tfc/TFCRegistrar.java +++ b/forge/src/main/java/muramasa/gregtech/integration/forge/tfc/TFCRegistrar.java @@ -5,18 +5,24 @@ import muramasa.antimatter.datagen.providers.AntimatterBlockTagProvider; import muramasa.antimatter.datagen.providers.AntimatterFluidTagProvider; import muramasa.antimatter.datagen.providers.AntimatterItemTagProvider; +import muramasa.antimatter.event.forge.AntimatterLoaderEvent; import muramasa.antimatter.event.forge.AntimatterProvidersEvent; +import muramasa.antimatter.recipe.loader.IRecipeRegistrate; import muramasa.antimatter.registration.IAntimatterRegistrar; import muramasa.antimatter.registration.RegistrationEvent; import muramasa.antimatter.registration.Side; import muramasa.antimatter.util.TagUtils; +import muramasa.gregtech.GTIRef; import muramasa.gregtech.GregTech; import net.dries007.tfc.common.fluids.TFCFluids; import net.dries007.tfc.util.Metal; import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import java.util.function.BiConsumer; + import static muramasa.antimatter.data.AntimatterDefaultTools.SAW; public class TFCRegistrar implements IAntimatterRegistrar { @@ -39,6 +45,12 @@ public void onRegistrarInit() { if (isEnabled()) { FMLJavaModLoadingContext.get().getModEventBus().register(this); } + MinecraftForge.EVENT_BUS.addListener(this::registerRecipeLoaders); + } + + public void registerRecipeLoaders(AntimatterLoaderEvent event){ + BiConsumer loader = (a, b) -> event.registrat.add(GTIRef.ID, a, b); + loader.accept("tfc_machine_recipes", MachineRecipes::init); } @SubscribeEvent