35 public const TAG_COUNT =
"Count";
36 public const TAG_SLOT =
"Slot";
37 public const TAG_WAS_PICKED_UP =
"WasPickedUp";
38 public const TAG_CAN_PLACE_ON =
"CanPlaceOn";
39 public const TAG_CAN_DESTROY =
"CanDestroy";
49 private ?
bool $wasPickedUp,
50 private array $canPlaceOn,
51 private array $canDestroy
54 public function getTypeData() :
SavedItemData{ return $this->typeData; }
56 public function getCount() : int{ return $this->count; }
58 public function getSlot() : ?int{ return $this->slot; }
60 public function getWasPickedUp() : ?bool{ return $this->wasPickedUp; }
70 $result->
setByte(self::TAG_COUNT, Binary::signByte($this->count));
72 if($this->slot !==
null){
73 $result->setByte(self::TAG_SLOT, Binary::signByte($this->slot));
75 if($this->wasPickedUp !==
null){
76 $result->setByte(self::TAG_WAS_PICKED_UP, $this->wasPickedUp ? 1 : 0);
78 if(count($this->canPlaceOn) !== 0){
79 $result->setTag(self::TAG_CAN_PLACE_ON,
new ListTag(array_map(fn(
string $s) =>
new StringTag($s), $this->canPlaceOn)));
81 if(count($this->canDestroy) !== 0){
82 $result->setTag(self::TAG_CAN_DESTROY,
new ListTag(array_map(fn(
string $s) =>
new StringTag($s), $this->canDestroy)));
85 return $result->merge($this->typeData->toNbt());