Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
more tfc compat
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 6, 2023
1 parent e679031 commit 097abae
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
1 change: 1 addition & 0 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<String, IRecipeRegistrate.IRecipeLoader> loader = (a, b) -> event.registrat.add(GTIRef.ID, a, b);
loader.accept("tfc_machine_recipes", MachineRecipes::init);
}

@SubscribeEvent
Expand Down

0 comments on commit 097abae

Please sign in to comment.