mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 16:59:44 +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{
|
protected function broadcastMovement(bool $teleport = false) : void{
|
||||||
$pk = new MoveActorAbsolutePacket();
|
$this->server->broadcastPackets($this->hasSpawned, [MoveActorAbsolutePacket::create(
|
||||||
$pk->entityRuntimeId = $this->id;
|
$this->id,
|
||||||
$pk->position = $this->getOffsetPosition($this->location);
|
$this->getOffsetPosition($this->location),
|
||||||
|
|
||||||
//this looks very odd but is correct as of 1.5.0.7
|
//this looks very odd but is correct as of 1.5.0.7
|
||||||
//for arrows this is actually x/y/z rotation
|
//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
|
//for mobs x and z are used for pitch and yaw, and y is used for headyaw
|
||||||
$pk->xRot = $this->location->pitch;
|
$this->location->pitch,
|
||||||
$pk->yRot = $this->location->yaw; //TODO: head yaw
|
$this->location->yaw,
|
||||||
$pk->zRot = $this->location->yaw;
|
$this->location->yaw,
|
||||||
|
(
|
||||||
if($teleport){
|
($teleport ? MoveActorAbsolutePacket::FLAG_TELEPORT : 0) |
|
||||||
$pk->flags |= MoveActorAbsolutePacket::FLAG_TELEPORT;
|
($this->onGround ? MoveActorAbsolutePacket::FLAG_GROUND : 0)
|
||||||
}
|
)
|
||||||
if($this->onGround){
|
)]);
|
||||||
$pk->flags |= MoveActorAbsolutePacket::FLAG_GROUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->server->broadcastPackets($this->hasSpawned, [$pk]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function broadcastMotion() : void{
|
protected function broadcastMotion() : void{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user