24 use GetTypeIdFromConstTrait;
26 public const ID = ItemStackRequestActionType::MINE_BLOCK;
28 public function __construct(
29 private int $hotbarSlot,
30 private int $predictedDurability,
34 public function getHotbarSlot() :
int{
return $this->hotbarSlot; }
36 public function getPredictedDurability() :
int{
return $this->predictedDurability; }
38 public function getStackId() :
int{
return $this->stackId; }
40 public static function read(ByteBufferReader $in) :
self{
41 $hotbarSlot = VarInt::readSignedInt($in);
42 $predictedDurability = VarInt::readSignedInt($in);
43 $stackId = CommonTypes::readItemStackNetIdVariant($in);
44 return new self($hotbarSlot, $predictedDurability, $stackId);
47 public function write(ByteBufferWriter $out) :
void{
48 VarInt::writeSignedInt($out, $this->hotbarSlot);
49 VarInt::writeSignedInt($out, $this->predictedDurability);
50 CommonTypes::writeItemStackNetIdVariant($out, $this->stackId);