mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 04:15:04 +00:00
Remove offset for crafting grid
This commit is contained in:
Submodule build/php updated: 185d741991...8666ae5add
@@ -33,15 +33,10 @@ class CraftingGrid extends BaseInventory{
|
|||||||
public const SIZE_SMALL = 2;
|
public const SIZE_SMALL = 2;
|
||||||
public const SIZE_BIG = 3;
|
public const SIZE_BIG = 3;
|
||||||
|
|
||||||
private const SMALL_OFFSET = 28;
|
|
||||||
private const BIG_OFFSET = 32;
|
|
||||||
|
|
||||||
/** @var Player */
|
/** @var Player */
|
||||||
protected $holder;
|
protected $holder;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
private $gridWidth;
|
private $gridWidth;
|
||||||
/** @var int */
|
|
||||||
private $offset;
|
|
||||||
|
|
||||||
/** @var int|null */
|
/** @var int|null */
|
||||||
private $startX;
|
private $startX;
|
||||||
@@ -55,11 +50,6 @@ class CraftingGrid extends BaseInventory{
|
|||||||
public function __construct(Player $holder, int $gridWidth){
|
public function __construct(Player $holder, int $gridWidth){
|
||||||
$this->holder = $holder;
|
$this->holder = $holder;
|
||||||
$this->gridWidth = $gridWidth;
|
$this->gridWidth = $gridWidth;
|
||||||
if($this->gridWidth === self::SIZE_SMALL){
|
|
||||||
$this->offset = self::SMALL_OFFSET;
|
|
||||||
}elseif($this->gridWidth === self::SIZE_BIG){
|
|
||||||
$this->offset = self::BIG_OFFSET;
|
|
||||||
}
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,12 +69,8 @@ class CraftingGrid extends BaseInventory{
|
|||||||
return "Crafting";
|
return "Crafting";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getItem(int $index) : Item{
|
|
||||||
return parent::getItem($index + $this->offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setItem(int $index, Item $item, bool $send = true) : bool{
|
public function setItem(int $index, Item $item, bool $send = true) : bool{
|
||||||
if(parent::setItem($index + $this->offset, $item, $send)){
|
if(parent::setItem($index, $item, $send)){
|
||||||
$this->seekRecipeBounds();
|
$this->seekRecipeBounds();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user