22declare(strict_types=1);
27use pocketmine\block\utils\AnyFacingTrait;
28use pocketmine\block\utils\SupportType;
44 $shulker = $this->position->getWorld()->getTile($this->position);
45 if($shulker instanceof TileShulkerBox){
46 $shulker->setFacing($this->facing);
51 parent::readStateFromWorld();
52 $shulker = $this->position->getWorld()->getTile($this->position);
53 if($shulker instanceof TileShulkerBox){
54 $this->facing = $shulker->getFacing();
65 $this->facing = $face;
67 return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
70 private function addDataFromTile(TileShulkerBox $tile,
Item $item) : void{
71 $shulkerNBT = $tile->getCleanedNBT();
72 if($shulkerNBT !==
null){
76 $item->setCustomName($tile->getName());
81 $drop = $this->asItem();
82 if(($tile = $this->position->getWorld()->getTile($this->position)) instanceof TileShulkerBox){
83 $this->addDataFromTile($tile, $drop);
89 $result = parent::getPickedItem($addUserData);
90 if($addUserData && ($tile = $this->position->getWorld()->getTile($this->position)) instanceof TileShulkerBox){
91 $this->addDataFromTile($tile, $result);
97 if($player instanceof
Player){
99 $shulker = $this->position->getWorld()->getTile($this->position);
100 if($shulker instanceof TileShulkerBox){
102 $this->getSide($this->facing)->isSolid() ||
103 !$shulker->canOpenWith($item->getCustomName())
108 $player->setCurrentWindow($shulker->getInventory());
116 return SupportType::NONE;
getSupportType(int $facing)
getDropsForCompatibleTool(Item $item)
describeBlockOnlyState(RuntimeDataDescriber $w)
getPickedItem(bool $addUserData=false)
onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player=null, array &$returnedItems=[])
place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player=null)
setNamedTag(CompoundTag $tag)