mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 17:06:16 +00:00
Cleaned up implementations for EnderChestInventory/DoubleChestInventory
previously, these were forced to extend BaseInventory because of the amount of crap in Inventory's interface. This meant that these inventories had their own slots storage, which would be _mostly_ unused because these inventories aren't real inventories, but rather just delegates. This lead to a variety of bugs in the past, such as certain API methods on BaseInventory not working correctly for DoubleChestInventory in particular. Now, BaseInventory just implements the functional part of the inventory implementation, leaving the storage system up to the implementation. A SimpleInventory class is provided with a simple SplFixedArray storage backing, which is used by most inventories. EnderChestInventory and DoubleChestInventory now extend BaseInventory directly, and implement custom methods for dealing with their delegates.
This commit is contained in:
@ -30,7 +30,7 @@ use pocketmine\item\ItemIds;
|
||||
class BaseInventoryTest extends TestCase{
|
||||
|
||||
public function testAddItemDifferentUserData() : void{
|
||||
$inv = new class(1) extends BaseInventory{
|
||||
$inv = new class(1) extends SimpleInventory{
|
||||
|
||||
};
|
||||
$item1 = ItemFactory::getInstance()->get(ItemIds::ARROW, 0, 1);
|
||||
|
Reference in New Issue
Block a user