mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Faster packet broadcast
This commit is contained in:
parent
86469a1031
commit
e4871ee0c4
@ -471,19 +471,6 @@ class Player{
|
||||
$data["slot"] = 0;
|
||||
$this->dataPacket(MC_PLAYER_EQUIPMENT, $data);
|
||||
|
||||
break;
|
||||
case "entity.move":
|
||||
if($data->eid === $this->eid or $data->level !== $this->level){
|
||||
break;
|
||||
}
|
||||
$this->dataPacket(MC_MOVE_ENTITY_POSROT, array(
|
||||
"eid" => $data->eid,
|
||||
"x" => $data->x,
|
||||
"y" => $data->y,
|
||||
"z" => $data->z,
|
||||
"yaw" => $data->yaw,
|
||||
"pitch" => $data->pitch,
|
||||
));
|
||||
break;
|
||||
case "entity.motion":
|
||||
if($data->eid === $this->eid or $data->level !== $this->level){
|
||||
@ -1126,7 +1113,6 @@ class Player{
|
||||
$this->entity->data["CID"] = $this->CID;
|
||||
$this->evid[] = $this->server->event("server.chat", array($this, "eventHandler"));
|
||||
$this->evid[] = $this->server->event("entity.remove", array($this, "eventHandler"));
|
||||
$this->evid[] = $this->server->event("entity.move", array($this, "eventHandler"));
|
||||
$this->evid[] = $this->server->event("entity.motion", array($this, "eventHandler"));
|
||||
$this->evid[] = $this->server->event("entity.animate", array($this, "eventHandler"));
|
||||
$this->evid[] = $this->server->event("entity.event", array($this, "eventHandler"));
|
||||
|
@ -508,7 +508,7 @@ class Entity extends Position{
|
||||
}
|
||||
|
||||
if($this->isStatic === false and ($this->last[0] != $this->x or $this->last[1] != $this->y or $this->last[2] != $this->z or $this->last[3] != $this->yaw or $this->last[4] != $this->pitch)){
|
||||
if($this->class === ENTITY_PLAYER or ($this->last[5] + 8) < $now){
|
||||
if($this->class === ENTITY_PLAYER or ($this->last[5] + 8) < $now){
|
||||
if($this->server->api->handle("entity.move", $this) === false){
|
||||
if($this->class === ENTITY_PLAYER){
|
||||
$this->player->teleport(new Vector3($this->last[0], $this->last[1], $this->last[2]), $this->last[3], $this->last[4]);
|
||||
@ -517,6 +517,18 @@ class Entity extends Position{
|
||||
}
|
||||
}else{
|
||||
$this->updateLast();
|
||||
$players = $this->server->api->player->getAll($this->level);
|
||||
if($this->player instanceof Player){
|
||||
unset($players[$this->player->CID]);
|
||||
}
|
||||
$this->server->api->player->broadcastPacket($players, MC_MOVE_ENTITY_POSROT, array(
|
||||
"eid" => $this->eid,
|
||||
"x" => $this->x,
|
||||
"y" => $this->y,
|
||||
"z" => $this->z,
|
||||
"yaw" => $this->yaw,
|
||||
"pitch" => $this->pitch,
|
||||
));
|
||||
}
|
||||
}else{
|
||||
$this->updatePosition($this->x, $this->y, $this->z, $this->yaw, $this->pitch);
|
||||
|
Loading…
x
Reference in New Issue
Block a user