22declare(strict_types=1);
24namespace pocketmine\world\particle;
37 public function __construct(
int $xDiff,
int $yDiff,
int $zDiff){
38 $this->xDiff = self::boundOrThrow($xDiff);
39 $this->yDiff = self::boundOrThrow($yDiff);
40 $this->zDiff = self::boundOrThrow($zDiff);
43 private static function boundOrThrow(
int $v) :
int{
44 if($v < -255 || $v > 255){
45 throw new \InvalidArgumentException(
"Value must be between -255 and 255");
51 $data = ($this->zDiff < 0 ? 1 << 26 : 0) |
52 ($this->yDiff < 0 ? 1 << 25 : 0) |
53 ($this->xDiff < 0 ? 1 << 24 : 0) |
54 (abs($this->xDiff) << 16) |
55 (abs($this->yDiff) << 8) |
static create(int $eventId, int $eventData, ?Vector3 $position)