35 protected const TAG_LEVEL_NAME =
"LevelName";
36 protected const TAG_GENERATOR_NAME =
"generatorName";
37 protected const TAG_GENERATOR_OPTIONS =
"generatorOptions";
38 protected const TAG_RANDOM_SEED =
"RandomSeed";
39 protected const TAG_TIME =
"Time";
40 protected const TAG_SPAWN_X =
"SpawnX";
41 protected const TAG_SPAWN_Y =
"SpawnY";
42 protected const TAG_SPAWN_Z =
"SpawnZ";
51 protected string $dataPath
53 if(!file_exists($this->dataPath)){
58 $this->compoundTag = $this->
load();
75 abstract protected function fix() : void;
99 case 'pocketmine\level\generator\normal\Normal':
102 case 'pocketmine\level\generator\Flat':
110 return $this->compoundTag;
115 public function getName() : string{
116 return $this->compoundTag->getString(self::TAG_LEVEL_NAME);
119 public function setName(
string $value) : void{
120 $this->compoundTag->setString(self::TAG_LEVEL_NAME, $value);
124 return $this->compoundTag->getString(self::TAG_GENERATOR_NAME,
"DEFAULT");
127 public function getGeneratorOptions() : string{
128 return $this->compoundTag->getString(self::TAG_GENERATOR_OPTIONS,
"");
131 public function getSeed() : int{
132 return $this->compoundTag->getLong(self::TAG_RANDOM_SEED);
135 public function getTime() : int{
136 if(($timeTag = $this->compoundTag->getTag(self::TAG_TIME)) instanceof
IntTag){
137 return $timeTag->getValue();
139 return $this->compoundTag->getLong(self::TAG_TIME, 0);
142 public function setTime(
int $value) : void{
143 $this->compoundTag->setLong(self::TAG_TIME, $value);
146 public function getSpawn() : Vector3{
147 return new Vector3($this->compoundTag->getInt(self::TAG_SPAWN_X), $this->compoundTag->getInt(self::TAG_SPAWN_Y), $this->compoundTag->getInt(self::TAG_SPAWN_Z));
150 public function setSpawn(Vector3 $pos) : void{
151 $this->compoundTag->setInt(self::TAG_SPAWN_X, $pos->getFloorX());
152 $this->compoundTag->setInt(self::TAG_SPAWN_Y, $pos->getFloorY());
153 $this->compoundTag->setInt(self::TAG_SPAWN_Z, $pos->getFloorZ());