Remove offset for crafting grid

This commit is contained in:
Stephen 2019-11-28 19:42:34 -05:00
parent a303c4b294
commit 3dd53ad998
2 changed files with 2 additions and 16 deletions

@ -1 +1 @@
Subproject commit 185d7419914005530298bd5e069449bdf4c0be56
Subproject commit 8666ae5add7a8b5213d68b491ebf0de211998cc9

View File

@ -33,15 +33,10 @@ class CraftingGrid extends BaseInventory{
public const SIZE_SMALL = 2;
public const SIZE_BIG = 3;
private const SMALL_OFFSET = 28;
private const BIG_OFFSET = 32;
/** @var Player */
protected $holder;
/** @var int */
private $gridWidth;
/** @var int */
private $offset;
/** @var int|null */
private $startX;
@ -55,11 +50,6 @@ class CraftingGrid extends BaseInventory{
public function __construct(Player $holder, int $gridWidth){
$this->holder = $holder;
$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();
}
@ -79,12 +69,8 @@ class CraftingGrid extends BaseInventory{
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{
if(parent::setItem($index + $this->offset, $item, $send)){
if(parent::setItem($index, $item, $send)){
$this->seekRecipeBounds();
return true;