public class ShapedRecipe extends Object implements CraftingRecipe
| Constructor and Description |
|---|
ShapedRecipe(String recipeId,
int priority,
Item primaryResult,
String[] shape,
io.netty.util.collection.CharObjectMap<Item> ingredients,
List<Item> extraResults,
Identifier block)
Constructs a ShapedRecipe instance.
|
| Modifier and Type | Method and Description |
|---|---|
List<Item> |
getAllResults() |
Identifier |
getBlock() |
List<Item> |
getExtraResults() |
int |
getHeight() |
UUID |
getId() |
Item |
getIngredient(int x,
int y) |
List<Item> |
getIngredientList() |
Map<Integer,Map<Integer,Item>> |
getIngredientMap() |
int |
getPriority() |
String |
getRecipeId() |
Item |
getResult() |
String[] |
getShape() |
RecipeType |
getType() |
int |
getWidth() |
boolean |
matchItems(Item[][] input,
Item[][] output)
Returns whether the specified list of crafting grid inputs and outputs matches this recipe.
|
void |
registerToCraftingManager(CraftingManager manager) |
boolean |
requiresCraftingTable() |
void |
setId(UUID id) |
ShapedRecipe |
setIngredient(char key,
Item item) |
ShapedRecipe |
setIngredient(String key,
Item item) |
com.nukkitx.protocol.bedrock.data.inventory.CraftingData |
toNetwork(int netId) |
String |
toString() |
public ShapedRecipe(String recipeId, int priority, Item primaryResult, String[] shape, io.netty.util.collection.CharObjectMap<Item> ingredients, List<Item> extraResults, Identifier block)
primaryResult - Primary result of the recipeshape
- 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.
public int getWidth()
public int getHeight()
public String getRecipeId()
getRecipeId in interface CraftingRecipepublic UUID getId()
getId in interface CraftingRecipepublic void setId(UUID id)
setId in interface CraftingRecipepublic ShapedRecipe setIngredient(String key, Item item)
public ShapedRecipe setIngredient(char key, Item item)
public Item getIngredient(int x, int y)
public String[] getShape()
public void registerToCraftingManager(CraftingManager manager)
registerToCraftingManager in interface Recipepublic RecipeType getType()
public List<Item> getExtraResults()
getExtraResults in interface CraftingRecipepublic List<Item> getAllResults()
getAllResults in interface CraftingRecipepublic int getPriority()
getPriority in interface CraftingRecipepublic boolean matchItems(Item[][] input, Item[][] output)
CraftingRecipematchItems in interface CraftingRecipeinput - 2D array of items taken from the crafting gridoutput - 2D array of items put back into the crafting grid (secondary results)public Identifier getBlock()
public boolean requiresCraftingTable()
requiresCraftingTable in interface CraftingRecipeCopyright © 2020. All rights reserved.