mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Inventory: Removed need for Inventory to have an InventoryHolder
Inventory holders are now freed from BaseInventory. They are now declared by subclasses by convention, but are not required in most cases. Ideally, this would be followed by the removal of the need for inventories to know their holders at all. They should just be simple containers of items. This fixes #1560 by removing FakeBlockMenu.
This commit is contained in:
@ -26,9 +26,12 @@ namespace pocketmine\inventory;
|
||||
use pocketmine\Player;
|
||||
|
||||
class CraftingGrid extends BaseInventory{
|
||||
/** @var Player */
|
||||
protected $holder;
|
||||
|
||||
public function __construct(Player $holder){
|
||||
parent::__construct($holder);
|
||||
$this->holder = $holder;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getGridWidth() : int{
|
||||
@ -54,4 +57,11 @@ class CraftingGrid extends BaseInventory{
|
||||
public function sendContents($target) : void{
|
||||
//no way to do this
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Player
|
||||
*/
|
||||
public function getHolder(){
|
||||
return $this->holder;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user