mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
changes to skeleton ai, theoretical performance increase with huge amount of mobs and players
This commit is contained in:
parent
c9da91378d
commit
da28b3b0ff
9 changed files with 89 additions and 96 deletions
|
|
@ -553,6 +553,18 @@ class Level{
|
|||
unset($this->entityListPositioned[$index][$e->eid]);
|
||||
$this->entityListPositioned[$newIndex][$e->eid] = $e->eid; //set to e->eid to avoid possible memory leaks
|
||||
}
|
||||
|
||||
if($e->searchForClosestPlayers){
|
||||
$e->handlePrePlayerSearcher();
|
||||
|
||||
foreach($this->players as $player){
|
||||
$dist = ($e->x - $player->entity->x)*($e->x - $player->entity->x) + ($e->y - $player->entity->y) + ($e->z - $player->entity->z);
|
||||
$e->handlePlayerSearcher($player, $dist);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}elseif(isset($this->entityListPositioned["$curChunkX $curChunkZ"])){
|
||||
unset($this->entityListPositioned["$curChunkX $curChunkZ"][$k]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue