Search in sources :

Example 1 with ProcessingRecipeBuilder

use of com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder in project Create by Creators-of-Create.

the class SequencedAssemblyRecipeBuilder method addStep.

public <T extends ProcessingRecipe<?>> SequencedAssemblyRecipeBuilder addStep(ProcessingRecipeFactory<T> factory, UnaryOperator<ProcessingRecipeBuilder<T>> builder) {
    ProcessingRecipeBuilder<T> recipeBuilder = new ProcessingRecipeBuilder<>(factory, new ResourceLocation("dummy"));
    Item placeHolder = recipe.getTransitionalItem().getItem();
    recipe.getSequence().add(new SequencedRecipe<>(builder.apply(recipeBuilder.require(placeHolder).output(placeHolder)).build()));
    return this;
}
Also used : Item(net.minecraft.world.item.Item) ProcessingRecipeBuilder(com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder) ResourceLocation(net.minecraft.resources.ResourceLocation)

Example 2 with ProcessingRecipeBuilder

use of com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder in project Create by Creators-of-Create.

the class ProcessingRecipeGen method create.

/**
 * Create a processing recipe with a single itemstack ingredient, using its id
 * as the name of the recipe
 */
protected <T extends ProcessingRecipe<?>> GeneratedRecipe create(String namespace, Supplier<ItemLike> singleIngredient, UnaryOperator<ProcessingRecipeBuilder<T>> transform) {
    ProcessingRecipeSerializer<T> serializer = getSerializer();
    GeneratedRecipe generatedRecipe = c -> {
        ItemLike iItemProvider = singleIngredient.get();
        transform.apply(new ProcessingRecipeBuilder<>(serializer.getFactory(), new ResourceLocation(namespace, iItemProvider.asItem().getRegistryName().getPath())).withItemIngredients(Ingredient.of(iItemProvider))).build(c);
    };
    all.add(generatedRecipe);
    return generatedRecipe;
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) ProcessingRecipe(com.simibubi.create.content.contraptions.processing.ProcessingRecipe) HashCache(net.minecraft.data.HashCache) IOException(java.io.IOException) UnaryOperator(java.util.function.UnaryOperator) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) Ingredient(net.minecraft.world.item.crafting.Ingredient) FluidAttributes(net.minecraftforge.fluids.FluidAttributes) List(java.util.List) Create(com.simibubi.create.Create) ItemLike(net.minecraft.world.level.ItemLike) IRecipeTypeInfo(com.simibubi.create.foundation.utility.recipe.IRecipeTypeInfo) ProcessingRecipeSerializer(com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer) ProcessingRecipeBuilder(com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder) DataGenerator(net.minecraft.data.DataGenerator) DataProvider(net.minecraft.data.DataProvider) ProcessingRecipeBuilder(com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder) ResourceLocation(net.minecraft.resources.ResourceLocation) ItemLike(net.minecraft.world.level.ItemLike)

Aggregations

ProcessingRecipeBuilder (com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder)2 ResourceLocation (net.minecraft.resources.ResourceLocation)2 Create (com.simibubi.create.Create)1 ProcessingRecipe (com.simibubi.create.content.contraptions.processing.ProcessingRecipe)1 ProcessingRecipeSerializer (com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer)1 IRecipeTypeInfo (com.simibubi.create.foundation.utility.recipe.IRecipeTypeInfo)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Supplier (java.util.function.Supplier)1 UnaryOperator (java.util.function.UnaryOperator)1 DataGenerator (net.minecraft.data.DataGenerator)1 DataProvider (net.minecraft.data.DataProvider)1 HashCache (net.minecraft.data.HashCache)1 Item (net.minecraft.world.item.Item)1 Ingredient (net.minecraft.world.item.crafting.Ingredient)1 ItemLike (net.minecraft.world.level.ItemLike)1 FluidAttributes (net.minecraftforge.fluids.FluidAttributes)1