◆ __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
-
135 foreach($this->shapeItems[$key] as $entry){
136 $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
183 return isset($this->ingredients[$y][$x]) ? $this->ingredients[$y][$x] :
Item::get(
Item::AIR);
◆ getIngredientList()
- Returns
- Item[]
164 for($x = 0; $x < 3; ++$x){
165 for($y = 0; $y < 3; ++$y){
166 if(!empty($this->ingredients[$x][$y])){
168 $ingredients[] = clone $this->ingredients[$x][$y];
◆ getIngredientMap()
- Returns
- Item[][]
145 foreach($this->ingredients as $y => $row){
146 $ingredients[$y] = [];
147 foreach($row as $x => $ingredient){
148 if($ingredient !== null){
149 $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/ShapedRecipe.php