Package com.minecolonies.api.crafting
Class GenericRecipe.Builder
java.lang.Object
com.minecolonies.api.crafting.GenericRecipe.Builder
- Enclosing class:
- GenericRecipe
Generic recipe builder
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Default constructorBuilder(@NotNull IGenericRecipe recipe) Construct from an existing recipe -
Method Summary
Modifier and TypeMethodDescription@NotNull IGenericRecipebuild()Builds a recipe from the current builder state.withAdditionalOutputs(@NotNull List<net.minecraft.world.item.ItemStack> additionalOutputs) Set outputs generated in addition to the main outputs (e.g.withGridSize(int gridSize) Set input grid size (e.g.withInputs(@NotNull List<List<net.minecraft.world.item.ItemStack>> inputs) Set recipe inputs.withIntermediate(@NotNull net.minecraft.world.level.block.Block intermediate) Set required intermediate crafting block.withLevelSort(int levelSort) Sets a value that helps sort this recipe relative to others.withLootTable(@Nullable net.minecraft.resources.ResourceLocation lootTable) Set the loot table produced by this recipe.withOutput(@NotNull net.minecraft.world.item.ItemStack output) Set the main output result of this recipe.withOutput(@NotNull net.minecraft.world.level.ItemLike output) Set the main output result of this recipe.withOutput(@NotNull net.minecraft.world.level.ItemLike output, int count) Set the main output result of this recipe.withOutputs(@NotNull List<net.minecraft.world.item.ItemStack> multiOutputs) Set all possible main outputs (one of these will be generated).withOutputs(@NotNull net.minecraft.world.item.ItemStack firstOutput, @NotNull List<net.minecraft.world.item.ItemStack> otherOutputs) Set all possible main outputs (one of these will be generated).withRecipeId(@Nullable net.minecraft.resources.ResourceLocation id) Set (or clear) the original source recipe id.withRequiredEntity(@Nullable net.minecraft.world.entity.EntityType<?> requiredEntity) Set the entity required to craft this recipe.withRequiredTool(@NotNull EquipmentTypeEntry requiredTool) Set the tool required to craft this recipe.withRestrictions(@NotNull Supplier<List<net.minecraft.network.chat.Component>> restrictions) Set the restrictions on crafting this recipe.withRestrictions(@NotNull List<net.minecraft.network.chat.Component> restrictions) Set the restrictions on crafting this recipe.
-
Constructor Details
-
Builder
public Builder()Default constructor -
Builder
Construct from an existing recipe
-
-
Method Details
-
withRecipeId
public GenericRecipe.Builder withRecipeId(@Nullable @Nullable net.minecraft.resources.ResourceLocation id) Set (or clear) the original source recipe id.- Parameters:
id- the recipe id.- Returns:
- this
-
withOutput
public GenericRecipe.Builder withOutput(@NotNull @NotNull net.minecraft.world.item.ItemStack output) Set the main output result of this recipe.- Parameters:
output- the recipe output.- Returns:
- this
-
withOutput
public GenericRecipe.Builder withOutput(@NotNull @NotNull net.minecraft.world.level.ItemLike output) Set the main output result of this recipe.- Parameters:
output- the recipe output.- Returns:
- this
-
withOutput
public GenericRecipe.Builder withOutput(@NotNull @NotNull net.minecraft.world.level.ItemLike output, int count) Set the main output result of this recipe.- Parameters:
output- the recipe output.count- the count.- Returns:
- this
-
withOutputs
public GenericRecipe.Builder withOutputs(@NotNull @NotNull List<net.minecraft.world.item.ItemStack> multiOutputs) Set all possible main outputs (one of these will be generated).- Parameters:
multiOutputs- the possible recipe outputs.- Returns:
- this
-
withOutputs
public GenericRecipe.Builder withOutputs(@NotNull @NotNull net.minecraft.world.item.ItemStack firstOutput, @NotNull @NotNull List<net.minecraft.world.item.ItemStack> otherOutputs) Set all possible main outputs (one of these will be generated).- Parameters:
firstOutput- one of the possible recipe outputs.otherOutputs- the other possible recipe outputs.- Returns:
- this
-
withAdditionalOutputs
public GenericRecipe.Builder withAdditionalOutputs(@NotNull @NotNull List<net.minecraft.world.item.ItemStack> additionalOutputs) Set outputs generated in addition to the main outputs (e.g. containers, byproducts).- Parameters:
additionalOutputs- the additional recipe outputs.- Returns:
- this
-
withInputs
public GenericRecipe.Builder withInputs(@NotNull @NotNull List<List<net.minecraft.world.item.ItemStack>> inputs) Set recipe inputs.- Parameters:
inputs- the recipe inputs, as a list of slots each containing a list of acceptable variants.- Returns:
- this
-
withGridSize
Set input grid size (e.g. 3 for 3x3 grid).- Parameters:
gridSize- the grid size.- Returns:
- this
-
withIntermediate
public GenericRecipe.Builder withIntermediate(@NotNull @NotNull net.minecraft.world.level.block.Block intermediate) Set required intermediate crafting block.- Parameters:
intermediate- the intermediate block.- Returns:
- this
-
withLootTable
public GenericRecipe.Builder withLootTable(@Nullable @Nullable net.minecraft.resources.ResourceLocation lootTable) Set the loot table produced by this recipe.- Parameters:
lootTable- the loot table id.- Returns:
- this
-
withRequiredTool
Set the tool required to craft this recipe.- Parameters:
requiredTool- the tool entry.- Returns:
- this
-
withRequiredEntity
public GenericRecipe.Builder withRequiredEntity(@Nullable @Nullable net.minecraft.world.entity.EntityType<?> requiredEntity) Set the entity required to craft this recipe.- Parameters:
requiredEntity- the entity type.- Returns:
- this
-
withRestrictions
public GenericRecipe.Builder withRestrictions(@NotNull @NotNull List<net.minecraft.network.chat.Component> restrictions) Set the restrictions on crafting this recipe.- Parameters:
restrictions- the restrictions.- Returns:
- this
-
withRestrictions
public GenericRecipe.Builder withRestrictions(@NotNull @NotNull Supplier<List<net.minecraft.network.chat.Component>> restrictions) Set the restrictions on crafting this recipe.- Parameters:
restrictions- the restrictions.- Returns:
- this
-
withLevelSort
Sets a value that helps sort this recipe relative to others.- Parameters:
levelSort- the sorting value.- Returns:
- this
-
build
Builds a recipe from the current builder state.- Returns:
- the recipe.
-