Skip to content

Commit ee48ebe

Browse files
committed
1 parent b63f2e9 commit ee48ebe

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Additions
6464
> https://github.com/pmmp/PocketMine-MP/pull/6076
6565
> https://github.com/pmmp/PocketMine-MP/pull/6187
6666
> https://github.com/pmmp/PocketMine-MP/pull/6194
67+
> https://github.com/pmmp/PocketMine-MP/pull/6204
6768
6869

6970
## What is this?

resources/pocketmine.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ worlds:
219219
# seed: 404
220220
# generator: FLAT
221221
# preset: 2;bedrock,59xstone,3xdirt,grass;1
222+
# blocks-per-subchunk-per-tick: 3
222223

223224
plugins:
224225
#Setting this to true will cause the legacy structure to be used where plugin data is placed inside the --plugins dir.

src/world/World.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ public function __construct(
520520
$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.");
521521
$this->chunkTickRadius = 0;
522522
}
523-
$this->tickedBlocksPerSubchunkPerTick = $cfg->getPropertyInt(YmlServerProperties::CHUNK_TICKING_BLOCKS_PER_SUBCHUNK_PER_TICK, self::DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK);
523+
$this->initTickedBlocksPerSubchunkPerTick($cfg);
524524
$this->maxConcurrentChunkPopulationTasks = $cfg->getPropertyInt(YmlServerProperties::CHUNK_GENERATION_POPULATION_QUEUE_SIZE, 2);
525525

526526
$this->initRandomTickBlocksFromConfig($cfg);
@@ -3521,4 +3521,23 @@ public function unloadChunks(bool $force = false) : void{
35213521
}
35223522
}
35233523
}
3524+
3525+
private function initTickedBlocksPerSubchunkPerTick(ServerConfigGroup $cfg) : void {
3526+
$this->tickedBlocksPerSubchunkPerTick = $cfg->getPropertyInt(YmlServerProperties::CHUNK_TICKING_BLOCKS_PER_SUBCHUNK_PER_TICK, self::DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK);
3527+
$specificTick = $cfg->getPropertyInt("worlds." . $this->getFolderName() . ".blocks-per-subchunk-per-tick", -1);
3528+
if($specificTick >= 0){
3529+
$this->tickedBlocksPerSubchunkPerTick = $specificTick;
3530+
}
3531+
}
3532+
3533+
public function setTickedBlocksPerSubchunkPerTick(int $tickedBlocksPerSubchunkPerTick) : void{
3534+
if($tickedBlocksPerSubchunkPerTick < 0){
3535+
throw new \InvalidArgumentException("Ticked blocks per subchunk per tick must be non-negative");
3536+
}
3537+
$this->tickedBlocksPerSubchunkPerTick = $tickedBlocksPerSubchunkPerTick;
3538+
}
3539+
3540+
public function getTickedBlocksPerSubchunkPerTick() : int{
3541+
return $this->tickedBlocksPerSubchunkPerTick;
3542+
}
35243543
}

0 commit comments

Comments
 (0)