mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
MobSpawner rewrite
This commit is contained in:
parent
a75b4cc4de
commit
4835c15747
6 changed files with 98 additions and 131 deletions
|
|
@ -31,6 +31,7 @@ class Level{
|
|||
$this->usedChunks = [];
|
||||
$this->changedBlocks = [];
|
||||
$this->changedCount = [];
|
||||
$this->mobSpawner = new MobSpawner($this);
|
||||
}
|
||||
|
||||
public function close(){
|
||||
|
|
@ -77,6 +78,7 @@ class Level{
|
|||
$this->level->close();
|
||||
unset($this->level);
|
||||
}
|
||||
unset($this->mobSpawner->level);
|
||||
}
|
||||
|
||||
public function save($force = false, $extra = true){
|
||||
|
|
@ -268,6 +270,10 @@ class Level{
|
|||
$e->update();
|
||||
}
|
||||
}
|
||||
|
||||
if(Entity::$updateOnTick && $server->ticks % 40 === 0){ //40 ticks delay
|
||||
$this->mobSpawner->handle();
|
||||
}
|
||||
}
|
||||
|
||||
public function setBlock(Vector3 $pos, Block $block, $update = true, $tiles = false, $direct = false){
|
||||
|
|
@ -536,4 +542,4 @@ class Level{
|
|||
}
|
||||
return $this->server->api->block->scheduleBlockUpdate($pos, $delay, $type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue