PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
WorldCreationOptions.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
24namespace pocketmine\world;
25
31use function random_int;
32
37
39 private string $generatorClass = Normal::class;
40 private int $seed;
41 private int $difficulty = World::DIFFICULTY_NORMAL;
42 private string $generatorOptions = "";
43 private Vector3 $spawnPosition;
44
45 public function __construct(){
46 $this->seed = random_int(Limits::INT32_MIN, Limits::INT32_MAX);
47 $this->spawnPosition = new Vector3(256, 70, 256);
48 }
49
50 public static function create() : self{
51 return new self();
52 }
53
55 public function getGeneratorClass() : string{ return $this->generatorClass; }
56
61 public function setGeneratorClass(string $generatorClass) : self{
62 Utils::testValidInstance($generatorClass, Generator::class);
63 $this->generatorClass = $generatorClass;
64 return $this;
65 }
66
67 public function getSeed() : int{ return $this->seed; }
68
70 public function setSeed(int $seed) : self{
71 $this->seed = $seed;
72 return $this;
73 }
74
75 public function getDifficulty() : int{ return $this->difficulty; }
76
78 public function setDifficulty(int $difficulty) : self{
79 $this->difficulty = $difficulty;
80 return $this;
81 }
82
83 public function getGeneratorOptions() : string{ return $this->generatorOptions; }
84
86 public function setGeneratorOptions(string $generatorOptions) : self{
87 $this->generatorOptions = $generatorOptions;
88 return $this;
89 }
90
91 public function getSpawnPosition() : Vector3{ return $this->spawnPosition; }
92
94 public function setSpawnPosition(Vector3 $spawnPosition) : self{
95 $this->spawnPosition = $spawnPosition;
96 return $this;
97 }
98}
setGeneratorOptions(string $generatorOptions)