Created
April 26, 2020 16:00
-
-
Save PJZ9n/73d343213256e48056be258a24f9804b to your computer and use it in GitHub Desktop.
1チャンクしか生成させないやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace sample; | |
use pocketmine\level\generator\GeneratorManager; | |
use pocketmine\level\generator\normal\Normal; | |
use pocketmine\plugin\PluginBase; | |
class Main extends PluginBase | |
{ | |
public function onEnable(): void | |
{ | |
//ジェネレーターを登録する | |
GeneratorManager::addGenerator(SingleChunkNormal::class, "SingleChunkNormal"); | |
} | |
} | |
class SingleChunkNormal extends Normal | |
{ | |
public function getName(): string | |
{ | |
return "SingleChunkNormal"; | |
} | |
public function populateChunk(int $chunkX, int $chunkZ): void | |
{ | |
//チャンクを生成するときの処理 | |
if ($chunkX === 0 || $chunkZ === 0) { | |
//X,Zが両方とも0だった場合のみチャンクを生成する | |
parent::populateChunk($chunkX, $chunkZ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment