Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/pocketmine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ worlds:
# seed: 404
# generator: FLAT
# preset: 2;bedrock,59xstone,3xdirt,grass;1
# blocks-per-subchunk-per-tick: 3

plugins:
#Setting this to true will cause the legacy structure to be used where plugin data is placed inside the --plugins dir.
Expand Down
21 changes: 20 additions & 1 deletion src/world/World.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ public function __construct(
$this->logger->warning("\"chunk-ticking.per-tick\" setting is deprecated, but you've used it to disable chunk ticking. Set \"chunk-ticking.tick-radius\" to 0 in \"pocketmine.yml\" instead.");
$this->chunkTickRadius = 0;
}
$this->tickedBlocksPerSubchunkPerTick = $cfg->getPropertyInt(YmlServerProperties::CHUNK_TICKING_BLOCKS_PER_SUBCHUNK_PER_TICK, self::DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK);
$this->initTickedBlocksPerSubchunkPerTick($cfg);
$this->maxConcurrentChunkPopulationTasks = $cfg->getPropertyInt(YmlServerProperties::CHUNK_GENERATION_POPULATION_QUEUE_SIZE, 2);

$this->initRandomTickBlocksFromConfig($cfg);
Expand Down Expand Up @@ -3461,4 +3461,23 @@ public function unloadChunks(bool $force = false) : void{
}
}
}

private function initTickedBlocksPerSubchunkPerTick(ServerConfigGroup $cfg) : void {
$this->tickedBlocksPerSubchunkPerTick = $cfg->getPropertyInt(YmlServerProperties::CHUNK_TICKING_BLOCKS_PER_SUBCHUNK_PER_TICK, self::DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK);
$specificTick = $cfg->getPropertyInt("worlds." . $this->getFolderName() . ".blocks-per-subchunk-per-tick", -1);
if($specificTick >= 0){
$this->tickedBlocksPerSubchunkPerTick = $specificTick;
}
}

public function setTickedBlocksPerSubchunkPerTick(int $tickedBlocksPerSubchunkPerTick) : void{
if($tickedBlocksPerSubchunkPerTick < 0){
throw new \InvalidArgumentException("Ticked blocks per subchunk per tick must be non-negative");
}
$this->tickedBlocksPerSubchunkPerTick = $tickedBlocksPerSubchunkPerTick;
}

public function getTickedBlocksPerSubchunkPerTick() : int{
return $this->tickedBlocksPerSubchunkPerTick;
}
}