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

68 lines
3.4 KiB
Java
Raw Normal View History

package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.crafting.LiquidFuelRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
2024-03-04 22:03:46 +01:00
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
2024-03-03 01:20:53 +01:00
import net.minecraft.data.PackOutput;
2024-03-04 20:21:48 +01:00
import net.minecraft.data.recipes.RecipeOutput;
2024-03-02 21:23:08 +01:00
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
2024-03-04 20:21:48 +01:00
import net.neoforged.neoforge.fluids.FluidStack;
import javax.annotation.Nonnull;
public class FuelRecipeGenerator extends RecipeProvider {
2024-03-03 01:20:53 +01:00
public FuelRecipeGenerator(PackOutput packOutput) {
super(packOutput);
}
@Override
2024-03-03 01:20:53 +01:00
public String getName() {
return "Fuel " + super.getName();
}
2024-03-03 01:20:53 +01:00
@Override
2024-03-04 22:03:46 +01:00
protected void buildRecipes(@Nonnull RecipeOutput output) {
var recipeOutput = new NoAdvRecipeOutput(output);
addSolid(recipeOutput, "coal", Items.COAL, 32000, 1600);
addSolid(recipeOutput, "stick", Items.STICK, 2000, 100);
addSolid(recipeOutput, "tiny-coal", ActuallyTags.Items.TINY_COALS, 4000, 200);
addSolid(recipeOutput, "charcoal", Items.CHARCOAL, 32000, 1600);
addSolid(recipeOutput, "coal-block", Items.COAL_BLOCK, 320000, 16000);
addSolid(recipeOutput, "lava", Items.LAVA_BUCKET, 400000, 20000);
recipeOutput.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/canola_oil"), new LiquidFuelRecipe(
2024-03-04 20:21:48 +01:00
new FluidStack(InitFluids.CANOLA_OIL.get(), 50), 4000, 100), null);
2024-03-04 22:03:46 +01:00
recipeOutput.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/refined_canola_oil"), new LiquidFuelRecipe(
2024-03-04 20:21:48 +01:00
new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 50), 9600, 120), null);
2024-03-04 22:03:46 +01:00
recipeOutput.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/crystallized_canola_oil"),new LiquidFuelRecipe(
2024-03-04 20:21:48 +01:00
new FluidStack(InitFluids.CRYSTALLIZED_OIL.get(), 50), 28000, 280), null);
2024-03-04 22:03:46 +01:00
recipeOutput.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/empowered_canola_oil"), new LiquidFuelRecipe(
2024-03-04 20:21:48 +01:00
new FluidStack(InitFluids.EMPOWERED_OIL.get(), 50), 48000, 400), null);
}
2024-03-04 20:21:48 +01:00
private void addSolid(RecipeOutput consumer, String name, Item item, int energy, int burnTime) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name);
consumer.accept(id, new SolidFuelRecipe(Ingredient.of(item), energy, burnTime), null);
}
2024-03-04 20:21:48 +01:00
private void addSolid(RecipeOutput consumer, String name, Ingredient item, int energy, int burnTime) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name);
consumer.accept(id, new SolidFuelRecipe(item, energy, burnTime), null);
}
2024-03-04 20:21:48 +01:00
private void addSolid(RecipeOutput consumer, String name, TagKey<Item> tag, int energy, int burnTime) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name);
consumer.accept(id, new SolidFuelRecipe(Ingredient.of(tag), energy, burnTime), null);
}
}