2022-04-02 04:50:39 +02:00
|
|
|
package de.ellpeck.actuallyadditions.data;
|
|
|
|
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
|
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-03 01:20:53 +01:00
|
|
|
import net.minecraft.data.CachedOutput;
|
|
|
|
import net.minecraft.data.PackOutput;
|
2024-03-02 21:23:08 +01:00
|
|
|
import net.minecraft.data.recipes.FinishedRecipe;
|
|
|
|
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;
|
2022-04-02 04:50:39 +02:00
|
|
|
import net.minecraftforge.fluids.FluidStack;
|
2024-03-03 01:20:53 +01:00
|
|
|
import org.jetbrains.annotations.Nullable;
|
2022-04-02 04:50:39 +02:00
|
|
|
|
|
|
|
import javax.annotation.Nonnull;
|
2024-03-03 01:20:53 +01:00
|
|
|
import java.util.concurrent.CompletableFuture;
|
2022-04-02 04:50:39 +02:00
|
|
|
import java.util.function.Consumer;
|
|
|
|
|
|
|
|
public class FuelRecipeGenerator extends RecipeProvider {
|
2024-03-03 01:20:53 +01:00
|
|
|
public FuelRecipeGenerator(PackOutput packOutput) {
|
|
|
|
super(packOutput);
|
2022-04-02 04:50:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2024-03-03 01:20:53 +01:00
|
|
|
public String getName() {
|
|
|
|
return "Fuel " + super.getName();
|
2022-04-02 04:50:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2024-03-03 01:20:53 +01:00
|
|
|
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
|
|
|
return null; //Nope...
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void buildRecipes(@Nonnull Consumer<FinishedRecipe> consumer) {
|
2022-04-02 04:50:39 +02:00
|
|
|
addSolid(consumer, "coal", Items.COAL, 32000, 1600);
|
|
|
|
addSolid(consumer, "stick", Items.STICK, 2000, 100);
|
|
|
|
addSolid(consumer, "tiny-coal", ActuallyTags.Items.TINY_COALS, 4000, 200);
|
|
|
|
addSolid(consumer, "charcoal", Items.CHARCOAL, 32000, 1600);
|
|
|
|
addSolid(consumer, "coal-block", Items.COAL_BLOCK, 320000, 16000);
|
|
|
|
addSolid(consumer, "lava", Items.LAVA_BUCKET, 400000, 20000);
|
|
|
|
|
2024-03-02 21:23:08 +01:00
|
|
|
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/canola_oil"),
|
2022-04-02 04:50:39 +02:00
|
|
|
new FluidStack(InitFluids.CANOLA_OIL.get(), 50), 4000, 100));
|
|
|
|
|
2024-03-02 21:23:08 +01:00
|
|
|
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/refined_canola_oil"),
|
2022-04-02 04:50:39 +02:00
|
|
|
new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 50), 9600, 120));
|
|
|
|
|
2024-03-02 21:23:08 +01:00
|
|
|
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/crystallized_canola_oil"),
|
2022-04-02 04:50:39 +02:00
|
|
|
new FluidStack(InitFluids.CRYSTALLIZED_OIL.get(), 50), 28000, 280));
|
|
|
|
|
2024-03-02 21:23:08 +01:00
|
|
|
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/empowered_canola_oil"),
|
2022-04-02 04:50:39 +02:00
|
|
|
new FluidStack(InitFluids.EMPOWERED_OIL.get(), 50), 48000, 400));
|
|
|
|
}
|
|
|
|
|
2024-03-02 21:23:08 +01:00
|
|
|
private void addSolid(Consumer<FinishedRecipe> consumer, String name, Item item, int energy, int burnTime) {
|
|
|
|
consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(item), energy, burnTime));
|
2022-04-02 04:50:39 +02:00
|
|
|
}
|
2024-03-02 21:23:08 +01:00
|
|
|
private void addSolid(Consumer<FinishedRecipe> consumer, String name, Ingredient item, int energy, int burnTime) {
|
|
|
|
consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), item, energy, burnTime));
|
2022-04-02 04:50:39 +02:00
|
|
|
}
|
2024-03-02 21:23:08 +01:00
|
|
|
private void addSolid(Consumer<FinishedRecipe> consumer, String name, TagKey<Item> tag, int energy, int burnTime) {
|
|
|
|
consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(tag), energy, burnTime));
|
2022-04-02 04:50:39 +02:00
|
|
|
}
|
|
|
|
}
|