mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Added options and API to enable/disable random ticking for specific block IDs
This commit is contained in:
parent
4dd0a13511
commit
21f5be27b6
@ -346,6 +346,13 @@ class Level implements ChunkManager, Metadatable{
|
||||
$this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", true);
|
||||
$this->cacheChunks = (bool) $this->server->getProperty("chunk-sending.cache-chunks", false);
|
||||
|
||||
$dontTickBlocks = $this->server->getProperty("chunk-ticking.disable-block-ticking", []);
|
||||
foreach($dontTickBlocks as $id){
|
||||
if(isset($this->randomTickBlocks[$id])){
|
||||
unset($this->randomTickBlocks[$id]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->timings = new LevelTimings($this);
|
||||
$this->temporalPosition = new Position(0, 0, 0, $this);
|
||||
$this->temporalVector = new Vector3(0, 0, 0);
|
||||
@ -877,6 +884,14 @@ class Level implements ChunkManager, Metadatable{
|
||||
unset($this->chunkCache[Level::chunkHash($chunkX, $chunkZ)]);
|
||||
}
|
||||
|
||||
public function addRandomTickedBlock(int $id){
|
||||
$this->randomTickBlocks[$id] = Block::$list[$id];
|
||||
}
|
||||
|
||||
public function removeRandomTickedBlock(int $id){
|
||||
unset($this->randomTickBlocks[$id]);
|
||||
}
|
||||
|
||||
private function tickChunks(){
|
||||
if($this->chunksPerTick <= 0 or count($this->loaders) === 0){
|
||||
$this->chunkTickList = [];
|
||||
|
@ -131,6 +131,9 @@ chunk-ticking:
|
||||
tick-radius: 3
|
||||
light-updates: false
|
||||
clear-tick-list: true
|
||||
#IDs of blocks not to perform random ticking on.
|
||||
disable-block-ticking:
|
||||
#- 2 # grass
|
||||
|
||||
chunk-generation:
|
||||
#Max. amount of chunks in the waiting queue to be generated
|
||||
|
Loading…
x
Reference in New Issue
Block a user