mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
mobs will spawn only in loaded chunks, entities in unloaded chunks will automatically *rip*
This commit is contained in:
parent
bc979c2853
commit
8d1e76f84d
7 changed files with 21 additions and 12 deletions
|
|
@ -508,6 +508,12 @@ class Entity extends Position
|
|||
$this->lastUpdate = $now;
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$this->isPlayer() && !isset($this->level->usedChunks[((int)$this->x >> 4).".".((int)$this->z >> 4)])){
|
||||
$this->close();
|
||||
return false;
|
||||
}
|
||||
|
||||
$tdiff = $now - $this->lastUpdate;
|
||||
if($this->tickCounter === 0){
|
||||
$this->tickCounter = 1;
|
||||
|
|
@ -1003,6 +1009,10 @@ class Entity extends Position
|
|||
{
|
||||
if($this->closed === false){
|
||||
$this->closed = true;
|
||||
if($this?->linkedEntity?->linkedEntity?->eid === $this->eid){
|
||||
$this->linkedEntity->linkedEntity = false;
|
||||
}
|
||||
$this->linkedEntity = false;
|
||||
$this->server->api->entity->remove($this->eid);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue