Search in sources :

Example 1 with Create

use of com.simibubi.create.Create 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

Create (com.simibubi.create.Create)1 ProcessingRecipe (com.simibubi.create.content.contraptions.processing.ProcessingRecipe)1 ProcessingRecipeBuilder (com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder)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 ResourceLocation (net.minecraft.resources.ResourceLocation)1 Ingredient (net.minecraft.world.item.crafting.Ingredient)1 ItemLike (net.minecraft.world.level.ItemLike)1 FluidAttributes (net.minecraftforge.fluids.FluidAttributes)1