forked from unresolved3169/Altay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1231828
commit e173577
Showing
1 changed file
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
/* | ||
* _ _ | ||
* /\ | | | | ||
* / \ | | |_ __ _ _ _ | ||
* / /\ \ | | __/ _` | | | | | ||
* / ____ \| | || (_| | |_| | | ||
* /_/ \_|_|\__\__,_|\__, | | ||
* __/ | | ||
* |___/ | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* @author TuranicTeam | ||
* @link https://github.com/TuranicTeam/Altay | ||
* | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace pocketmine\level\generator; | ||
|
||
use pocketmine\block\Block; | ||
use pocketmine\level\ChunkManager; | ||
use pocketmine\level\format\Chunk; | ||
use pocketmine\math\Vector3; | ||
use pocketmine\utils\Random; | ||
|
||
class VoidGenerator extends Generator{ | ||
/** @var Chunk */ | ||
private $emptyChunk = null; | ||
|
||
public function __construct(array $options = []){ | ||
$this->generateEmptyChunk(); | ||
} | ||
|
||
public function init(ChunkManager $level, Random $random) : void{ | ||
parent::init($level, $random); | ||
} | ||
|
||
public function getSettings() : array{ | ||
return []; | ||
} | ||
|
||
public function getName() : string{ | ||
return "Void"; | ||
} | ||
|
||
public function generateEmptyChunk() : void{ | ||
$chunk = new Chunk(0, 0); | ||
$chunk->setGenerated(); | ||
|
||
for($Z = 0; $Z < 16; ++$Z){ | ||
for($X = 0; $X < 16; ++$X){ | ||
$chunk->setBiomeId($X, $Z, 1); | ||
for($y = 0; $y < 256; ++$y){ | ||
$chunk->setBlock($X, $y, $Z, Block::AIR, 0); | ||
} | ||
} | ||
} | ||
|
||
$this->emptyChunk = $chunk; | ||
} | ||
|
||
public function generateChunk(int $chunkX, int $chunkZ) : void{ | ||
$chunk = clone $this->emptyChunk; | ||
|
||
$spawn = $this->getSpawn(); | ||
if(($spawn->x >> 4) === $chunkX and ($spawn->z >> 4) === $chunkZ){ | ||
//why? | ||
} | ||
|
||
$chunk->setX($chunkX); | ||
$chunk->setZ($chunkZ); | ||
|
||
$this->level->setChunk($chunkX, $chunkZ, $chunk); | ||
} | ||
|
||
public function populateChunk(int $chunkX, int $chunkZ) : void{ | ||
|
||
} | ||
|
||
public function getSpawn() : Vector3{ | ||
return new Vector3(128, 72, 128); | ||
} | ||
|
||
} |