13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol\types\inventory\stackrequest;
19trait TakeOrPlaceStackRequestActionTrait{
20 final public function __construct(
22 private ItemStackRequestSlotInfo $source,
23 private ItemStackRequestSlotInfo $destination
26 final public function getCount() : int{ return $this->count; }
28 final public function getSource() : ItemStackRequestSlotInfo{ return $this->source; }
30 final public function getDestination() : ItemStackRequestSlotInfo{ return $this->destination; }
32 public static function read(PacketSerializer $in) : self{
33 $count = $in->getByte();
34 $src = ItemStackRequestSlotInfo::read($in);
35 $dst = ItemStackRequestSlotInfo::read($in);
36 return new self($count, $src, $dst);
39 public function write(PacketSerializer $out) : void{
40 $out->putByte($this->count);
41 $this->source->write($out);
42 $this->destination->write($out);