mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
small rewrite of how movement packets are sent to players
This commit is contained in:
parent
5b8aee19fa
commit
6c08b74394
3 changed files with 96 additions and 14 deletions
|
|
@ -362,6 +362,7 @@ class Level{
|
|||
}
|
||||
}
|
||||
$this->totalMobsAmount = 0;
|
||||
$post = [];
|
||||
foreach($this->entityList as $k => $e){
|
||||
if(!($e instanceof Entity)){
|
||||
unset($this->entityList[$k]);
|
||||
|
|
@ -373,8 +374,20 @@ class Level{
|
|||
}
|
||||
if($e->isPlayer() || $e->needsUpdate){
|
||||
$e->update();
|
||||
if(!$e->isPlayer()) $post[] = $k;
|
||||
}
|
||||
}
|
||||
foreach($this->players as $player){
|
||||
foreach($post as $eid){
|
||||
$e = $this->entityList[$eid] ?? false;
|
||||
if(!($e instanceof Entity)){
|
||||
continue;
|
||||
}
|
||||
$player->addEntityMovementUpdateToQueue($e);
|
||||
}
|
||||
$player->sendEntityMovementUpdateQueue();
|
||||
}
|
||||
|
||||
|
||||
$this->checkSleep();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue