mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Fixed #767 Players move laggy [gh#767]
This commit is contained in:
parent
7f15b27ff0
commit
56d829eec6
2 changed files with 15 additions and 5 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue