27 private int $requestId,
28 private array $requestChangedSlots,
32 public function getRequestId() : int{
33 return $this->requestId;
40 return $this->requestChangedSlots;
44 return $this->transactionData;
48 $requestId = $in->getVarInt();
49 $requestChangedSlots = [];
52 for($i = 0; $i < $len; ++$i){
53 $requestChangedSlots[] = InventoryTransactionChangedSlotsHack::read($in);
56 $transactionData =
new UseItemTransactionData();
57 $transactionData->decode($in);
58 return new ItemInteractionData($requestId, $requestChangedSlots, $transactionData);
61 public function write(PacketSerializer $out) : void{
62 $out->putVarInt($this->requestId);
63 if($this->requestId !== 0){
64 $out->putUnsignedVarInt(count($this->requestChangedSlots));
65 foreach($this->requestChangedSlots as $changedSlot){
66 $changedSlot->write($out);
69 $this->transactionData->encode($out);