Package org.cloudburstmc.server.crafting
Class ShapedRecipe
java.lang.Object
org.cloudburstmc.server.crafting.ShapedRecipe
- All Implemented Interfaces:
org.cloudburstmc.api.crafting.Recipe,CraftingRecipe
author: MagicDroidX
Nukkit Project
-
Constructor Summary
ConstructorsConstructorDescriptionShapedRecipe(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. -
Method Summary
Modifier and TypeMethodDescriptionList<org.cloudburstmc.api.item.ItemStack>org.cloudburstmc.api.util.IdentifiergetBlock()List<org.cloudburstmc.api.item.ItemStack>intorg.cloudburstmc.api.util.IdentifiergetId()org.cloudburstmc.api.item.ItemStackgetIngredient(int x, int y)List<org.cloudburstmc.api.item.ItemStack>intorg.cloudburstmc.api.item.ItemStackString[]getShape()org.cloudburstmc.api.crafting.RecipeTypegetType()intgetWidth()booleanmatchItems(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.booleansetIngredient(char key, org.cloudburstmc.api.item.ItemStack item)setIngredient(String key, org.cloudburstmc.api.item.ItemStack item)toString()
-
Constructor Details
-
ShapedRecipe
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)Constructs a ShapedRecipe instance.- Parameters:
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.
-
-
Method Details
-
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getResult
public org.cloudburstmc.api.item.ItemStack getResult()- Specified by:
getResultin interfaceorg.cloudburstmc.api.crafting.Recipe
-
getId
public org.cloudburstmc.api.util.Identifier getId()- Specified by:
getIdin interfaceorg.cloudburstmc.api.crafting.Recipe
-
setIngredient
-
setIngredient
-
getIngredientList
-
getIngredientMap
-
getIngredient
public org.cloudburstmc.api.item.ItemStack getIngredient(int x, int y) -
getShape
-
getType
public org.cloudburstmc.api.crafting.RecipeType getType()- Specified by:
getTypein interfaceorg.cloudburstmc.api.crafting.Recipe
-
getExtraResults
- Specified by:
getExtraResultsin interfaceCraftingRecipe
-
getAllResults
- Specified by:
getAllResultsin interfaceCraftingRecipe
-
getPriority
public int getPriority()- Specified by:
getPriorityin interfaceCraftingRecipe
-
matchItems
public boolean matchItems(org.cloudburstmc.api.item.ItemStack[][] input, org.cloudburstmc.api.item.ItemStack[][] output)Description copied from interface:CraftingRecipeReturns whether the specified list of crafting grid inputs and outputs matches this recipe. Outputs DO NOT include the primary result item.- Specified by:
matchItemsin interfaceCraftingRecipe- Parameters:
input- 2D array of items taken from the crafting gridoutput- 2D array of items put back into the crafting grid (secondary results)- Returns:
- bool
-
getBlock
public org.cloudburstmc.api.util.Identifier getBlock()- Specified by:
getBlockin interfaceorg.cloudburstmc.api.crafting.Recipe
-
toString
-
requiresCraftingTable
public boolean requiresCraftingTable()- Specified by:
requiresCraftingTablein interfaceCraftingRecipe
-