mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
ShulkerBoxInventory: avoid usage of legacy ItemIds
This commit is contained in:
parent
2a0b500010
commit
af8f2c47f3
@ -23,9 +23,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\block\inventory;
|
namespace pocketmine\block\inventory;
|
||||||
|
|
||||||
|
use pocketmine\block\BlockTypeIds;
|
||||||
use pocketmine\inventory\SimpleInventory;
|
use pocketmine\inventory\SimpleInventory;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\item\ItemIds;
|
use pocketmine\item\ItemBlock;
|
||||||
use pocketmine\network\mcpe\protocol\BlockEventPacket;
|
use pocketmine\network\mcpe\protocol\BlockEventPacket;
|
||||||
use pocketmine\network\mcpe\protocol\types\BlockPosition;
|
use pocketmine\network\mcpe\protocol\types\BlockPosition;
|
||||||
use pocketmine\world\Position;
|
use pocketmine\world\Position;
|
||||||
@ -50,9 +51,12 @@ class ShulkerBoxInventory extends SimpleInventory implements BlockInventory{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function canAddItem(Item $item) : bool{
|
public function canAddItem(Item $item) : bool{
|
||||||
if($item->getId() === ItemIds::UNDYED_SHULKER_BOX || $item->getId() === ItemIds::SHULKER_BOX){
|
if($item instanceof ItemBlock){
|
||||||
|
$blockTypeId = $item->getBlock()->getTypeId();
|
||||||
|
if($blockTypeId === BlockTypeIds::SHULKER_BOX || $blockTypeId === BlockTypeIds::DYED_SHULKER_BOX){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return parent::canAddItem($item);
|
return parent::canAddItem($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user