13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol;
21 public const NETWORK_ID = ProtocolInfo::CHANGE_DIMENSION_PACKET;
23 public int $dimension;
25 public bool $respawn =
false;
26 private ?
int $loadingScreenId =
null;
31 public static function create(
int $dimension,
Vector3 $position,
bool $respawn, ?
int $loadingScreenId) : self{
33 $result->dimension = $dimension;
34 $result->position = $position;
35 $result->respawn = $respawn;
36 $result->loadingScreenId = $loadingScreenId;
41 $this->dimension = $in->getVarInt();
43 $this->respawn = $in->
getBool();
48 $out->putVarInt($this->dimension);
50 $out->putBool($this->respawn);
51 $out->
writeOptional($this->loadingScreenId, $out->putLInt(...));
55 return $handler->handleChangeDimension($this);
static create(int $dimension, Vector3 $position, bool $respawn, ?int $loadingScreenId)
encodePayload(PacketSerializer $out)
handle(PacketHandlerInterface $handler)
decodePayload(PacketSerializer $in)
writeOptional(mixed $value, \Closure $writer)
putVector3(Vector3 $vector)
readOptional(\Closure $reader)