|
| | __construct (Item $result, $height, $width) |
| |
| | getWidth () |
| |
| | getHeight () |
| |
| | getResult () |
| |
| | getId () |
| |
| | setId (UUID $id) |
| |
| | addIngredient ($x, $y, Item $item) |
| |
| | setIngredient ($key, Item $item) |
| |
| | getIngredientMap () |
| |
| | getIngredient ($x, $y) |
| |
| | getShape () |
| |
| | registerToCraftingManager () |
| |
| | __construct (Item $result, $height, $width) |
| |
| | getWidth () |
| |
| | getHeight () |
| |
| | getResult () |
| |
| | getId () |
| |
| | setId (UUID $id) |
| |
| | addIngredient ($x, $y, Item $item) |
| |
| | setIngredient ($key, Item $item) |
| |
| | getIngredientMap () |
| |
| | getIngredientList () |
| |
| | getIngredient ($x, $y) |
| |
| | getShape () |
| |
| | registerToCraftingManager () |
| |
◆ __construct()
| __construct |
( |
Item |
$result, |
|
|
|
$height, |
|
|
|
$width |
|
) |
| |
- Parameters
-
| Item | $result | |
| int | $height | |
| int | $width | |
- Exceptions
-
51 for($h = 0; $h < $height; $h++){
52 if($width === 0 or $width > 3){
53 throw new \InvalidStateException(
"Crafting rows should be 1, 2, 3 wide, not $width");
55 $this->ingredients[] = array_fill(0, $width, null);
58 $this->output = clone $result;
◆ addIngredient()
| addIngredient |
( |
|
$x, |
|
|
|
$y, |
|
|
Item |
$item |
|
) |
| |
- Parameters
-
- Returns
- $this
108 $this->ingredients[$y][$x] = clone $item;
◆ fixRecipe()
| fixRecipe |
( |
|
$key, |
|
|
|
$item |
|
) |
| |
|
protected |
- Parameters
-
134 foreach($this->shapeItems[$key] as $entry){
135 $this->ingredients[$entry->y][$entry->x] = clone $item;
◆ getHeight()
- Returns
- int
72 return count($this->ingredients);
◆ getId()
- Returns
- null
Implements Recipe.
◆ getIngredient()
- Parameters
-
- Returns
- null|Item
165 return isset($this->ingredients[$y][$x]) ? $this->ingredients[$y][$x] :
Item::get(
Item::AIR);
◆ getIngredientMap()
- Returns
- Item[][]
144 foreach($this->ingredients as $y => $row){
145 $ingredients[$y] = [];
146 foreach($row as $x => $ingredient){
147 if($ingredient !== null){
148 $ingredients[$y][$x] = clone $ingredient;
◆ getResult()
- Returns
- Item
Implements Recipe.
◆ getShape()
◆ getWidth()
- Returns
- int
65 return count($this->ingredients[0]);
◆ registerToCraftingManager()
| registerToCraftingManager |
( |
| ) |
|
◆ setId()
- Parameters
-
93 if($this->
id !== null){
94 throw new \InvalidStateException(
"Id is already set");
◆ setIngredient()
| setIngredient |
( |
|
$key, |
|
|
Item |
$item |
|
) |
| |
- Parameters
-
- Returns
- $this
- Exceptions
-
120 if(!array_key_exists($key, $this->shape)){
121 throw new \Exception(
"Symbol does not appear in the shape: " . $key);
The documentation for this class was generated from the following file:
- src/pocketmine/inventory/ShapedRecipeFromJson.php