39 public const TAG_FACING =
"facing";
41 protected int $facing = Facing::NORTH;
46 parent::__construct($world, $pos);
50 public function readSaveData(
CompoundTag $nbt) :
void{
51 $this->loadName($nbt);
52 $this->loadItems($nbt);
53 $this->facing = $nbt->getByte(self::TAG_FACING, $this->facing);
57 $this->saveName($nbt);
58 $this->saveItems($nbt);
59 $nbt->
setByte(self::TAG_FACING, $this->facing);
63 $this->readSaveData($item->getNamedTag());
64 if($item->hasCustomName()){
65 $this->setName($item->getCustomName());
69 public function close() : void{
71 $this->inventory->removeAllViewers();
81 $nbt = parent::getCleanedNBT();
88 public function getFacing() : int{
92 public function setFacing(
int $facing) : void{
93 $this->facing = $facing;
96 public function getInventory() : ShulkerBoxInventory{
97 return $this->inventory;
100 public function getRealInventory() : ShulkerBoxInventory{
101 return $this->inventory;
104 public function getDefaultName() : string{
105 return
"Shulker Box";
109 $nbt->setByte(self::TAG_FACING, $this->facing);
110 $this->addNameSpawnData($nbt);