mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 08:49:42 +00:00
Entity: make use of MoveActorAbsolutePacket::create()
This commit is contained in:
parent
d8ee657d20
commit
cbc6ebebad
@ -735,25 +735,21 @@ abstract class Entity{
|
||||
}
|
||||
|
||||
protected function broadcastMovement(bool $teleport = false) : void{
|
||||
$pk = new MoveActorAbsolutePacket();
|
||||
$pk->entityRuntimeId = $this->id;
|
||||
$pk->position = $this->getOffsetPosition($this->location);
|
||||
$this->server->broadcastPackets($this->hasSpawned, [MoveActorAbsolutePacket::create(
|
||||
$this->id,
|
||||
$this->getOffsetPosition($this->location),
|
||||
|
||||
//this looks very odd but is correct as of 1.5.0.7
|
||||
//for arrows this is actually x/y/z rotation
|
||||
//for mobs x and z are used for pitch and yaw, and y is used for headyaw
|
||||
$pk->xRot = $this->location->pitch;
|
||||
$pk->yRot = $this->location->yaw; //TODO: head yaw
|
||||
$pk->zRot = $this->location->yaw;
|
||||
|
||||
if($teleport){
|
||||
$pk->flags |= MoveActorAbsolutePacket::FLAG_TELEPORT;
|
||||
}
|
||||
if($this->onGround){
|
||||
$pk->flags |= MoveActorAbsolutePacket::FLAG_GROUND;
|
||||
}
|
||||
|
||||
$this->server->broadcastPackets($this->hasSpawned, [$pk]);
|
||||
//this looks very odd but is correct as of 1.5.0.7
|
||||
//for arrows this is actually x/y/z rotation
|
||||
//for mobs x and z are used for pitch and yaw, and y is used for headyaw
|
||||
$this->location->pitch,
|
||||
$this->location->yaw,
|
||||
$this->location->yaw,
|
||||
(
|
||||
($teleport ? MoveActorAbsolutePacket::FLAG_TELEPORT : 0) |
|
||||
($this->onGround ? MoveActorAbsolutePacket::FLAG_GROUND : 0)
|
||||
)
|
||||
)]);
|
||||
}
|
||||
|
||||
protected function broadcastMotion() : void{
|
||||
|
Loading…
x
Reference in New Issue
Block a user