Class ShapedRecipe

java.lang.Object
cn.nukkit.inventory.ShapedRecipe
All Implemented Interfaces:
CraftingRecipe, Recipe

public class ShapedRecipe extends Object implements CraftingRecipe
Author:
MagicDroidX (Nukkit Project)
  • Constructor Details

    • ShapedRecipe

      public ShapedRecipe(Item primaryResult, String[] shape, Map<Character,Item> ingredients, List<Item> extraResults)
    • ShapedRecipe

      public ShapedRecipe(String recipeId, int priority, Item primaryResult, String[] shape, Map<Character,Item> ingredients, List<Item> extraResults)
      Constructs a ShapedRecipe instance.
      Parameters:
      primaryResult - Primary result of the recipe
      shape -
      Array of 1, 2, or 3 strings representing the rows of the recipe. This accepts an array of 1, 2 or 3 strings. Each string should be of the same length and must be at most 3 characters long. Each character represents a unique type of ingredient. Spaces are interpreted as air.
      ingredients -
      Char => Item map of items to be set into the shape. This accepts an array of Items, indexed by character. Every unique character (except space) in the shape array MUST have a corresponding item in this list. Space character is automatically treated as air.
      extraResults -
      List of additional result items to leave in the crafting grid afterwards. Used for things like cake recipe empty buckets.

      Note: Recipes **do not** need to be square. Do NOT add padding for empty rows/columns.

  • Method Details