Skip to content

Commit 964cb68

Browse files
committed
ジェネレーターを追加するための関数を用意
1 parent 5aac0ad commit 964cb68

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/NeiroNetwork/MiniatureWorld/ui/form/BaseWorldForm.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@ abstract class BaseWorldForm extends CustomForm{
2525

2626
public function __construct(string $title, protected ?World $world = null, protected int $backPage = 0){
2727
if(class_exists("\\NeiroNetwork\\VoidGenerator\\Main")){
28-
$this->generators[] = "奈落";
29-
$this->generatorMaps[] = "void";
28+
$this->addGenerator("奈落", "void");
3029
}
3130
if(class_exists('\muqsit\vanillagenerator\Loader')){
32-
$this->generators[] = "オーバーワールド (実験的)";
33-
$this->generatorMaps[] = "vanilla_overworld";
34-
$this->generators[] = "ネザー (実験的)";
35-
$this->generatorMaps[] = "vanilla_nether";
31+
$this->addGenerator("オーバーワールド (実験的)", "vanilla_overworld");
32+
$this->addGenerator("ネザー (実験的)", "vanilla_nether");
3633
}
3734

3835
$data = $world?->getProvider()->getWorldData();
@@ -43,6 +40,11 @@ public function __construct(string $title, protected ?World $world = null, prote
4340
]);
4441
}
4542

43+
private function addGenerator(string $description, string $generator) : void{
44+
$this->generators[] = $description;
45+
$this->generatorMaps[] = $generator;
46+
}
47+
4648
protected function validateResponse(Player $player, CustomFormResponse $response) : bool|array{
4749
$name = trim($response->getString("world_name"));
4850
$type = $this->generatorMaps[$response->getInt("world_type")];

0 commit comments

Comments
 (0)