hopefully fixed entity movement

This commit is contained in:
GameHerobrine 2023-02-21 16:43:07 +03:00
parent 7b5d550fcb
commit 153894c368
2 changed files with 21 additions and 8 deletions

View file

@ -1273,13 +1273,8 @@ class Entity extends Position
$this->player->teleport(new Vector3($this->x, $this->y, $this->z));
return;
}
$pk = new MoveEntityPacket_PosRot();
$pk->eid = $this->eid;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk = new MoveEntityPacket();
$pk->entities = [[$this->eid, $this->x, $this->y, $this->z, $this->yaw, $this->pitch]];
$this->server->api->player->broadcastPacket($this->level->players, $pk);
}

View file

@ -1,7 +1,16 @@
<?php
class MoveEntityPacket extends RakNetDataPacket{
/**
* eid
* x
* y
* z
* yaw
* pitch
* @var array
*/
public $entities;
public function pid(){
return ProtocolInfo::MOVE_ENTITY_PACKET;
}
@ -12,6 +21,15 @@ class MoveEntityPacket extends RakNetDataPacket{
public function encode(){
$this->reset();
$this->putInt(count($this->entities));
foreach($this->entities as $d){
$this->putInt($d[0]); //eid
$this->putFloat($d[1]); //x
$this->putFloat($d[2]); //y
$this->putFloat($d[3]); //z
$this->putFloat($d[4]); //yaw
$this->putFloat($d[5]); //pitch
}
}
}