mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
Fixed ShapedRecipe constructor
This commit is contained in:
parent
e597314331
commit
1082e32fd7
@ -22,9 +22,9 @@
|
|||||||
namespace pocketmine\inventory;
|
namespace pocketmine\inventory;
|
||||||
|
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
|
use pocketmine\math\Vector2;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\utils\UUID;
|
use pocketmine\utils\UUID;
|
||||||
use pocketmine\math\Vector2;
|
|
||||||
|
|
||||||
class ShapedRecipe implements Recipe{
|
class ShapedRecipe implements Recipe{
|
||||||
/** @var Item */
|
/** @var Item */
|
||||||
@ -41,16 +41,16 @@ class ShapedRecipe implements Recipe{
|
|||||||
private $shapeItems = [];
|
private $shapeItems = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Item $result
|
* @param Item $result
|
||||||
* @param int $height
|
* @param int $height
|
||||||
* @param int $width
|
* @param int $width
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function __construct(Item $result, $height, $width){
|
public function __construct(Item $result, $height, $width){
|
||||||
for($h =0; $h < $height; $h++){
|
for($h = 0; $h < $height; $h++){
|
||||||
if(strlen($width) === 0 or strlen($width) > 3){
|
if($width === 0 or $width > 3){
|
||||||
throw new \InvalidStateException("Crafting rows should be 1, 2, 3 characters, not " . count($row));
|
throw new \InvalidStateException("Crafting rows should be 1, 2, 3 wide, not $width");
|
||||||
}
|
}
|
||||||
$this->ingredients[] = array_fill(0, $width, null);
|
$this->ingredients[] = array_fill(0, $width, null);
|
||||||
}
|
}
|
||||||
@ -148,4 +148,4 @@ class ShapedRecipe implements Recipe{
|
|||||||
public function registerToCraftingManager(){
|
public function registerToCraftingManager(){
|
||||||
Server::getInstance()->getCraftingManager()->registerShapedRecipe($this);
|
Server::getInstance()->getCraftingManager()->registerShapedRecipe($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user