PocketMine-MP
5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
Loading...
Searching...
No Matches
MoveActorAbsolutePacket.php
1
<?php
2
3
/*
4
* This file is part of BedrockProtocol.
5
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6
*
7
* BedrockProtocol is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*/
12
13
declare(strict_types=1);
14
15
namespace
pocketmine\network\mcpe\protocol;
16
17
use
pocketmine\math\Vector3
;
18
use
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
;
19
20
class
MoveActorAbsolutePacket
extends
DataPacket
implements
ClientboundPacket
,
ServerboundPacket
{
21
public
const
NETWORK_ID = ProtocolInfo::MOVE_ACTOR_ABSOLUTE_PACKET;
22
23
public
const
FLAG_GROUND = 0x01;
24
public
const
FLAG_TELEPORT = 0x02;
25
public
const
FLAG_FORCE_MOVE_LOCAL_ENTITY = 0x04;
26
27
public
int
$actorRuntimeId;
28
public
Vector3
$position;
29
public
float
$pitch;
30
public
float
$yaw;
31
public
float
$headYaw;
//always zero for non-mobs
32
public
int
$flags = 0;
33
37
public
static
function
create
(
int
$actorRuntimeId,
Vector3
$position,
float
$pitch,
float
$yaw,
float
$headYaw,
int
$flags) : self{
38
$result = new self;
39
$result->actorRuntimeId = $actorRuntimeId;
40
$result->position = $position;
41
$result->pitch = $pitch;
42
$result->yaw = $yaw;
43
$result->headYaw = $headYaw;
44
$result->flags = $flags;
45
return
$result;
46
}
47
48
protected
function
decodePayload
(
PacketSerializer
$in) : void{
49
$this->actorRuntimeId = $in->getActorRuntimeId();
50
$this->flags = $in->
getByte
();
51
$this->position = $in->
getVector3
();
52
$this->pitch = $in->
getRotationByte
();
53
$this->yaw = $in->
getRotationByte
();
54
$this->headYaw = $in->
getRotationByte
();
55
}
56
57
protected
function
encodePayload
(
PacketSerializer
$out) : void{
58
$out->putActorRuntimeId($this->actorRuntimeId);
59
$out->putByte($this->flags);
60
$out->
putVector3
($this->position);
61
$out->putRotationByte($this->pitch);
62
$out->putRotationByte($this->yaw);
63
$out->putRotationByte($this->headYaw);
64
}
65
66
public
function
handle
(
PacketHandlerInterface
$handler) : bool{
67
return $handler->handleMoveActorAbsolute($this);
68
}
69
}
pocketmine\math\Vector3
Definition
Vector3.php:36
pocketmine\network\mcpe\protocol\DataPacket
Definition
DataPacket.php:21
pocketmine\network\mcpe\protocol\MoveActorAbsolutePacket
Definition
MoveActorAbsolutePacket.php:20
pocketmine\network\mcpe\protocol\MoveActorAbsolutePacket\handle
handle(PacketHandlerInterface $handler)
Definition
MoveActorAbsolutePacket.php:66
pocketmine\network\mcpe\protocol\MoveActorAbsolutePacket\encodePayload
encodePayload(PacketSerializer $out)
Definition
MoveActorAbsolutePacket.php:57
pocketmine\network\mcpe\protocol\MoveActorAbsolutePacket\create
static create(int $actorRuntimeId, Vector3 $position, float $pitch, float $yaw, float $headYaw, int $flags)
Definition
MoveActorAbsolutePacket.php:37
pocketmine\network\mcpe\protocol\MoveActorAbsolutePacket\decodePayload
decodePayload(PacketSerializer $in)
Definition
MoveActorAbsolutePacket.php:48
pocketmine\network\mcpe\protocol\serializer\PacketSerializer
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:66
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\getVector3
getVector3()
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:478
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\getRotationByte
getRotationByte()
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:534
pocketmine\network\mcpe\protocol\serializer\PacketSerializer\putVector3
putVector3(Vector3 $vector)
Definition
bedrock-protocol/src/serializer/PacketSerializer.php:517
pocketmine\utils\BinaryStream\getByte
getByte()
Definition
BinaryStream.php:117
pocketmine\network\mcpe\protocol\ClientboundPacket
Definition
ClientboundPacket.php:17
pocketmine\network\mcpe\protocol\PacketHandlerInterface
Definition
PacketHandlerInterface.php:20
pocketmine\network\mcpe\protocol\ServerboundPacket
Definition
ServerboundPacket.php:17
vendor
pocketmine
bedrock-protocol
src
MoveActorAbsolutePacket.php
Generated by
1.12.0