mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
Fixed #767 Players move laggy [gh#767]
This commit is contained in:
parent
7f15b27ff0
commit
56d829eec6
@ -632,7 +632,7 @@ class Player{
|
||||
if($m !== ""){
|
||||
$this->dataPacket(MC_CHAT, array(
|
||||
"player" => ($author instanceof Player) ? $author->username:$author,
|
||||
"message" => $m,
|
||||
"message" => TextFormat::clean($m), //Colors not implemented :(
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -1284,6 +1284,7 @@ class Player{
|
||||
$this->server->api->entity->spawnToAll($this->entity);
|
||||
|
||||
$this->server->schedule(5, array($this->entity, "update"), array(), true);
|
||||
$this->server->schedule(2, array($this->entity, "checkMovement"), array(), true);
|
||||
$this->sendArmor();
|
||||
$this->sendChat($this->server->motd."\n");
|
||||
|
||||
|
@ -507,6 +507,19 @@ class Entity extends Position{
|
||||
}
|
||||
}
|
||||
|
||||
$this->lastUpdate = $now;
|
||||
if($this->class !== ENTITY_PLAYER){
|
||||
$this->updateMovement();
|
||||
if($hasUpdate === true){
|
||||
$this->server->schedule(5, array($this, "update"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function updateMovement(){
|
||||
if($this->closed === true){
|
||||
return false;
|
||||
}
|
||||
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->server->api->handle("entity.move", $this) === false){
|
||||
@ -534,10 +547,6 @@ class Entity extends Position{
|
||||
$this->updatePosition($this->x, $this->y, $this->z, $this->yaw, $this->pitch);
|
||||
}
|
||||
}
|
||||
$this->lastUpdate = $now;
|
||||
if($this->class !== ENTITY_PLAYER and $hasUpdate === true){
|
||||
$this->server->schedule(5, array($this, "update"));
|
||||
}
|
||||
}
|
||||
|
||||
public function getDirection(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user