Class GenericRecipe.Builder

java.lang.Object
com.minecolonies.api.crafting.GenericRecipe.Builder
Enclosing class:
GenericRecipe

public static class GenericRecipe.Builder extends Object
Generic recipe builder
  • Constructor Details

    • Builder

      public Builder()
      Default constructor
    • Builder

      public Builder(@NotNull @NotNull IGenericRecipe recipe)
      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

      public GenericRecipe.Builder withGridSize(int gridSize)
      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

      public GenericRecipe.Builder withRequiredTool(@NotNull @NotNull EquipmentTypeEntry requiredTool)
      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

      public GenericRecipe.Builder withLevelSort(int levelSort)
      Sets a value that helps sort this recipe relative to others.
      Parameters:
      levelSort - the sorting value.
      Returns:
      this
    • build

      @NotNull public @NotNull IGenericRecipe build()
      Builds a recipe from the current builder state.
      Returns:
      the recipe.