PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
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.

@phpstan-param list<string> $shape @phpstan-param array<string, RecipeIngredient> $ingredients @phpstan-param list<Item> $results

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

Member Function Documentation

◆ getHeight()

pocketmine\crafting\ShapedRecipe::getHeight ( )

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

◆ getIngredient()

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

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

◆ getIngredientList()

pocketmine\crafting\ShapedRecipe::getIngredientList ( )

Returns a list of items needed to craft this recipe. This MUST NOT include Air items or items with a zero count.

Returns
RecipeIngredient[] @phpstan-return list<RecipeIngredient>

Implements pocketmine\crafting\CraftingRecipe.

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

◆ getIngredientMap()

pocketmine\crafting\ShapedRecipe::getIngredientMap ( )
Returns
(RecipeIngredient|null)[][] @phpstan-return list<list<RecipeIngredient|null>>

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

◆ getResults()

pocketmine\crafting\ShapedRecipe::getResults ( )
Returns
Item[] @phpstan-return list<Item>

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

◆ getResultsFor()

pocketmine\crafting\ShapedRecipe::getResultsFor ( CraftingGrid $grid)
Returns
Item[] @phpstan-return list<Item>

Implements pocketmine\crafting\CraftingRecipe.

Definition at line 131 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[] @phpstan-return list<string>

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

◆ getWidth()

pocketmine\crafting\ShapedRecipe::getWidth ( )

Definition at line 111 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 199 of file src/crafting/ShapedRecipe.php.


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