ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/data/MiscMachineRecipeGenerator.java

54 lines
2.2 KiB
Java
Raw Normal View History

2022-01-07 00:16:37 +01:00
package de.ellpeck.actuallyadditions.data;
import com.google.gson.JsonObject;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
2022-01-15 19:38:00 +01:00
import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe;
2022-08-31 00:20:32 +02:00
import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe;
2022-01-07 00:16:37 +01:00
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache;
import net.minecraft.data.IFinishedRecipe;
import net.minecraft.data.RecipeProvider;
2022-01-07 01:59:06 +01:00
import net.minecraft.fluid.Fluids;
2022-08-31 00:20:32 +02:00
import net.minecraft.item.Items;
2022-01-07 00:16:37 +01:00
import net.minecraft.item.crafting.Ingredient;
2022-08-31 00:20:32 +02:00
import net.minecraft.tags.ITag;
import net.minecraft.util.IItemProvider;
2022-01-07 00:16:37 +01:00
import net.minecraft.util.ResourceLocation;
2022-08-31 00:20:32 +02:00
import net.minecraft.util.registry.Registry;
2022-01-07 01:59:06 +01:00
import net.minecraftforge.common.Tags;
2022-01-07 00:16:37 +01:00
import net.minecraftforge.fluids.FluidStack;
2022-08-31 00:20:32 +02:00
import net.minecraftforge.registries.ForgeRegistries;
2022-01-07 00:16:37 +01:00
import java.nio.file.Path;
import java.util.function.Consumer;
public class MiscMachineRecipeGenerator extends RecipeProvider {
public MiscMachineRecipeGenerator(DataGenerator pGenerator) {
super(pGenerator);
}
@Override
protected void saveAdvancement(DirectoryCache pCache, JsonObject pAdvancementJson, Path pPath) {
}
@Override
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> consumer) {
2022-01-07 01:59:06 +01:00
consumer.accept(new PressingRecipe.FinishedRecipe(folderRecipe("pressing", "canola"),
Ingredient.of(ActuallyItems.CANOLA.get()), new FluidStack(InitFluids.CANOLA_OIL.get(), 80)));
2022-01-15 19:38:00 +01:00
consumer.accept(new FermentingRecipe.FinishedRecipe(folderRecipe("fermenting", "refined_canola"),
new FluidStack(InitFluids.CANOLA_OIL.get(), 80), new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 80), 100));
2022-01-07 01:59:06 +01:00
}
2022-08-31 00:20:32 +02:00
private String getItemName(IItemProvider item) {
return ForgeRegistries.ITEMS.getKey(item.asItem()).getPath();
}
2022-01-07 01:59:06 +01:00
private ResourceLocation folderRecipe(String folder, String recipe) {
return new ResourceLocation(ActuallyAdditions.MODID, folder + "/" + recipe);
2022-01-07 00:16:37 +01:00
}
}