Skip to content

Commit

Permalink
add pmmp#6204
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshy3282 committed Oct 3, 2024
1 parent b63f2e9 commit ee48ebe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Additions
> https://github.com/pmmp/PocketMine-MP/pull/6076
> https://github.com/pmmp/PocketMine-MP/pull/6187
> https://github.com/pmmp/PocketMine-MP/pull/6194
> https://github.com/pmmp/PocketMine-MP/pull/6204

## What is this?
Expand Down
1 change: 1 addition & 0 deletions resources/pocketmine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,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 @@ -3521,4 +3521,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;
}
}

0 comments on commit ee48ebe

Please sign in to comment.