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:
Dylan K. Taylor
2018-01-22 19:42:48 +00:00
parent e5ca22a9a6
commit 2fb580db26
11 changed files with 50 additions and 72 deletions

View File

@ -29,11 +29,11 @@ use pocketmine\Player;
class AnvilInventory extends ContainerInventory{
/** @var FakeBlockMenu */
/** @var Position */
protected $holder;
public function __construct(Position $pos){
parent::__construct(new FakeBlockMenu($this, $pos));
parent::__construct($pos->asPosition());
}
public function getNetworkType() : int{
@ -50,7 +50,7 @@ class AnvilInventory extends ContainerInventory{
/**
* This override is here for documentation and code completion purposes only.
* @return FakeBlockMenu
* @return Position
*/
public function getHolder(){
return $this->holder;