Package org.cloudburstmc.server.crafting
Class ShapedRecipe
java.lang.Object
org.cloudburstmc.server.crafting.ShapedRecipe
- All Implemented Interfaces:
org.cloudburstmc.api.crafting.CraftingRecipe,org.cloudburstmc.api.crafting.Recipe
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)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 interfaceorg.cloudburstmc.api.crafting.CraftingRecipe
-
getAllResults
- Specified by:
getAllResultsin interfaceorg.cloudburstmc.api.crafting.CraftingRecipe
-
getPriority
public int getPriority()- Specified by:
getPriorityin interfaceorg.cloudburstmc.api.crafting.CraftingRecipe
-
matchItems
public boolean matchItems(org.cloudburstmc.api.item.ItemStack[][] input, org.cloudburstmc.api.item.ItemStack[][] output)- Specified by:
matchItemsin interfaceorg.cloudburstmc.api.crafting.CraftingRecipe
-
getBlock
public org.cloudburstmc.api.util.Identifier getBlock()- Specified by:
getBlockin interfaceorg.cloudburstmc.api.crafting.Recipe
-
toString
-
requiresCraftingTable
public boolean requiresCraftingTable()- Specified by:
requiresCraftingTablein interfaceorg.cloudburstmc.api.crafting.CraftingRecipe
-