PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
pocketmine\crafting\ShapedRecipe Class Reference
+ Inheritance diagram for pocketmine\crafting\ShapedRecipe:
+ Collaboration diagram for pocketmine\crafting\ShapedRecipe:

Public Member Functions

 __construct (array $shape, array $ingredients, array $results)
 
 getHeight ()
 
 getIngredient (int $x, int $y)
 
 getIngredientList ()
 
 getIngredientMap ()
 
 getResults ()
 
 getResultsFor (CraftingGrid $grid)
 
 getShape ()
 
 getWidth ()
 
 matchesCraftingGrid (CraftingGrid $grid)
 

Detailed Description

Definition at line 34 of file src/crafting/ShapedRecipe.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\crafting\ShapedRecipe::__construct ( array $shape,
array $ingredients,
array $results )

Constructs a ShapedRecipe instance.

Parameters
string[]$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.
RecipeIngredient[]$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.
Item[]$resultsList of items that this recipe produces when crafted.

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

Definition at line 60 of file src/crafting/ShapedRecipe.php.

Member Function Documentation

◆ getHeight()

pocketmine\crafting\ShapedRecipe::getHeight ( )

Definition at line 102 of file src/crafting/ShapedRecipe.php.

◆ getIngredient()

pocketmine\crafting\ShapedRecipe::getIngredient ( int $x,
int $y )

Definition at line 153 of file src/crafting/ShapedRecipe.php.

◆ getIngredientList()

pocketmine\crafting\ShapedRecipe::getIngredientList ( )
Returns
RecipeIngredient[]

Implements pocketmine\crafting\CraftingRecipe.

Definition at line 138 of file src/crafting/ShapedRecipe.php.

◆ getIngredientMap()

pocketmine\crafting\ShapedRecipe::getIngredientMap ( )
Returns
(RecipeIngredient|null)[][]

Definition at line 123 of file src/crafting/ShapedRecipe.php.

◆ getResults()

pocketmine\crafting\ShapedRecipe::getResults ( )
Returns
Item[]

Definition at line 109 of file src/crafting/ShapedRecipe.php.

◆ getResultsFor()

pocketmine\crafting\ShapedRecipe::getResultsFor ( CraftingGrid $grid)
Returns
Item[]

Implements pocketmine\crafting\CraftingRecipe.

Definition at line 116 of file src/crafting/ShapedRecipe.php.

◆ getShape()

pocketmine\crafting\ShapedRecipe::getShape ( )

Returns an array of strings containing characters representing the recipe's shape.

Returns
string[]

Definition at line 161 of file src/crafting/ShapedRecipe.php.

◆ getWidth()

pocketmine\crafting\ShapedRecipe::getWidth ( )

Definition at line 98 of file src/crafting/ShapedRecipe.php.

◆ matchesCraftingGrid()

pocketmine\crafting\ShapedRecipe::matchesCraftingGrid ( CraftingGrid $grid)

Returns whether the given crafting grid meets the requirements to craft this recipe.

Implements pocketmine\crafting\CraftingRecipe.

Definition at line 185 of file src/crafting/ShapedRecipe.php.


The documentation for this class was generated from the following file: