public class ShapedRecipe extends Object implements CraftingRecipe
| Constructor and Description |
|---|
ShapedRecipe(org.cloudburstmc.api.util.Identifier recipeId,
int priority,
org.cloudburstmc.api.item.ItemStack primaryResult,
String[] shape,
io.netty.util.collection.CharObjectMap<org.cloudburstmc.api.item.ItemStack> ingredients,
List<org.cloudburstmc.api.item.ItemStack> extraResults,
org.cloudburstmc.api.util.Identifier block)
Constructs a ShapedRecipe instance.
|
| Modifier and Type | Method and Description |
|---|---|
List<org.cloudburstmc.api.item.ItemStack> |
getAllResults() |
org.cloudburstmc.api.util.Identifier |
getBlock() |
List<org.cloudburstmc.api.item.ItemStack> |
getExtraResults() |
int |
getHeight() |
org.cloudburstmc.api.util.Identifier |
getId() |
org.cloudburstmc.api.item.ItemStack |
getIngredient(int x,
int y) |
List<org.cloudburstmc.api.item.ItemStack> |
getIngredientList() |
Map<Integer,Map<Integer,org.cloudburstmc.api.item.ItemStack>> |
getIngredientMap() |
int |
getPriority() |
org.cloudburstmc.api.item.ItemStack |
getResult() |
String[] |
getShape() |
org.cloudburstmc.api.inventory.RecipeType |
getType() |
int |
getWidth() |
boolean |
matchItems(org.cloudburstmc.api.item.ItemStack[][] input,
org.cloudburstmc.api.item.ItemStack[][] output)
Returns whether the specified list of crafting grid inputs and outputs matches this recipe.
|
boolean |
requiresCraftingTable() |
ShapedRecipe |
setIngredient(char key,
org.cloudburstmc.api.item.ItemStack item) |
ShapedRecipe |
setIngredient(String key,
org.cloudburstmc.api.item.ItemStack item) |
String |
toString() |
public ShapedRecipe(org.cloudburstmc.api.util.Identifier recipeId,
int priority,
org.cloudburstmc.api.item.ItemStack primaryResult,
String[] shape,
io.netty.util.collection.CharObjectMap<org.cloudburstmc.api.item.ItemStack> ingredients,
List<org.cloudburstmc.api.item.ItemStack> extraResults,
org.cloudburstmc.api.util.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 org.cloudburstmc.api.item.ItemStack getResult()
getResult in interface org.cloudburstmc.api.inventory.Recipepublic org.cloudburstmc.api.util.Identifier getId()
getId in interface org.cloudburstmc.api.inventory.Recipepublic ShapedRecipe setIngredient(String key, org.cloudburstmc.api.item.ItemStack item)
public ShapedRecipe setIngredient(char key, org.cloudburstmc.api.item.ItemStack item)
public List<org.cloudburstmc.api.item.ItemStack> getIngredientList()
public Map<Integer,Map<Integer,org.cloudburstmc.api.item.ItemStack>> getIngredientMap()
public org.cloudburstmc.api.item.ItemStack getIngredient(int x,
int y)
public String[] getShape()
public org.cloudburstmc.api.inventory.RecipeType getType()
getType in interface org.cloudburstmc.api.inventory.Recipepublic List<org.cloudburstmc.api.item.ItemStack> getExtraResults()
getExtraResults in interface CraftingRecipepublic List<org.cloudburstmc.api.item.ItemStack> getAllResults()
getAllResults in interface CraftingRecipepublic int getPriority()
getPriority in interface CraftingRecipepublic boolean matchItems(org.cloudburstmc.api.item.ItemStack[][] input,
org.cloudburstmc.api.item.ItemStack[][] 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 org.cloudburstmc.api.util.Identifier getBlock()
getBlock in interface org.cloudburstmc.api.inventory.Recipepublic boolean requiresCraftingTable()
requiresCraftingTable in interface CraftingRecipeCopyright © 2021. All rights reserved.