24 public function __construct(
26 private int $hotbarSlot,
28 private int $itemStackId,
29 private string $customName,
30 private string $filteredCustomName,
31 private int $durabilityCorrection
34 public function getSlot() :
int{
return $this->slot; }
36 public function getHotbarSlot() :
int{
return $this->hotbarSlot; }
38 public function getCount() :
int{
return $this->count; }
40 public function getItemStackId() :
int{
return $this->itemStackId; }
42 public function getCustomName() :
string{
return $this->customName; }
44 public function getFilteredCustomName() :
string{
return $this->filteredCustomName; }
46 public function getDurabilityCorrection() :
int{
return $this->durabilityCorrection; }
48 public static function read(ByteBufferReader $in) :
self{
49 $slot = Byte::readUnsigned($in);
50 $hotbarSlot = Byte::readUnsigned($in);
51 $count = Byte::readUnsigned($in);
52 $itemStackId = CommonTypes::readServerItemStackId($in);
53 $customName = CommonTypes::getString($in);
54 $filteredCustomName = CommonTypes::getString($in);
55 $durabilityCorrection = VarInt::readSignedInt($in);
56 return new self($slot, $hotbarSlot, $count, $itemStackId, $customName, $filteredCustomName, $durabilityCorrection);
59 public function write(ByteBufferWriter $out) :
void{
60 Byte::writeUnsigned($out, $this->slot);
61 Byte::writeUnsigned($out, $this->hotbarSlot);
62 Byte::writeUnsigned($out, $this->count);
63 CommonTypes::writeServerItemStackId($out, $this->itemStackId);
64 CommonTypes::putString($out, $this->customName);
65 CommonTypes::putString($out, $this->filteredCustomName);
66 VarInt::writeSignedInt($out, $this->durabilityCorrection);