|
static | parseLayers (string $layers) |
|
static | addGenerator ($object, $name) |
|
static | getGeneratorList () |
|
static | getGenerator ($name) |
|
static | getGeneratorName ($class) |
|
static | getFastNoise1D (Noise $noise, $xSize, $samplingRate, $x, $y, $z) |
|
static | getFastNoise2D (Noise $noise, $xSize, $zSize, $samplingRate, $x, $y, $z) |
|
static | getFastNoise3D (Noise $noise, $xSize, $ySize, $zSize, $xSamplingRate, $ySamplingRate, $zSamplingRate, $x, $y, $z) |
|
◆ __construct()
__construct |
( |
array |
$options = [] | ) |
|
Flat constructor.
- Parameters
-
71 $this->preset =
"2;7,2x3,2;1;";
75 if(isset($this->options[
"decoration"])){
78 new object\OreType(
new CoalOre(), 20, 16, 0, 128),
79 new object\OreType(New IronOre(), 20, 8, 0, 64),
80 new object\OreType(
new RedstoneOre(), 8, 7, 0, 16),
81 new object\OreType(
new LapisOre(), 1, 6, 0, 32),
82 new object\OreType(
new GoldOre(), 2, 8, 0, 32),
83 new object\OreType(
new DiamondOre(), 1, 7, 0, 16),
84 new object\OreType(
new Dirt(), 20, 32, 0, 128),
85 new object\OreType(
new Gravel(), 10, 16, 0, 128),
87 $this->populators[] = $ores;
◆ generateChunk()
generateChunk |
( |
|
$chunkX, |
|
|
|
$chunkZ |
|
) |
| |
- Parameters
-
- Returns
- mixed|void
191 if($this->chunk === null){
192 if(isset($this->options[
"preset"]) and $this->options[
"preset"] !=
""){
193 $this->
parsePreset($this->options[
"preset"], $chunkX, $chunkZ);
195 $this->
parsePreset($this->preset, $chunkX, $chunkZ);
198 $chunk = clone $this->chunk;
199 $chunk->setX($chunkX);
200 $chunk->setZ($chunkZ);
201 $this->level->setChunk($chunkX, $chunkZ, $chunk);
◆ getName()
◆ getSettings()
◆ getSpawn()
- Returns
- Vector3
222 return new Vector3(128, $this->floorLevel, 128);
◆ init()
- Parameters
-
- Returns
- mixed|void
171 $this->level = $level;
172 $this->random = $random;
◆ parseLayers()
static parseLayers |
( |
string |
$layers | ) |
|
|
static |
- Parameters
-
- Returns
- array
99 preg_match_all(
'#^(([0-9]*x|)([0-9]{1,3})(|:[0-9]{0,2}))$#m', str_replace(
",",
"\n", $layers), $matches);
101 foreach($matches[3] as $i => $b){
103 $cnt = $matches[2][$i] ===
"" ? 1 : intval($matches[2][$i]);
104 for($cY = $y, $y += $cnt; $cY < $y; ++$cY){
105 $result[$cY] = [$b->getId(), $b->getDamage()];
◆ parsePreset()
parsePreset |
( |
|
$preset, |
|
|
|
$chunkX, |
|
|
|
$chunkZ |
|
) |
| |
|
protected |
- Parameters
-
123 $this->structure = self::parseLayers($blocks);
127 $this->floorLevel = $y = count($this->structure);
129 for(; $y < 0xFF; ++$y){
130 $this->structure[$y] = [0, 0];
134 $this->chunk = clone $this->level->getChunk($chunkX, $chunkZ);
135 $this->chunk->setGenerated();
137 for($Z = 0; $Z < 16; ++$Z){
138 for($X = 0; $X < 16; ++$X){
139 $this->chunk->setBiomeId($X, $Z, $biome);
140 for($y = 0; $y < 128; ++$y){
141 $this->chunk->setBlock($X, $y, $Z, ...$this->structure[$y]);
147 preg_match_all(
'#(([0-9a-z_]{1,})\(?([0-9a-z_ =:]{0,})\)?),?#',
$options, $matches);
148 foreach($matches[2] as $i => $option){
150 if($matches[3][$i] !==
""){
152 $p = explode(
" ", $matches[3][$i]);
154 $k = explode(
"=", $k);
156 $params[$k[0]] = $k[1];
160 $this->options[$option] = $params;
◆ populateChunk()
populateChunk |
( |
|
$chunkX, |
|
|
|
$chunkZ |
|
) |
| |
- Parameters
-
- Returns
- mixed|void
211 $this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed());
212 foreach($this->populators as $populator){
213 $populator->populate($this->level, $chunkX, $chunkZ, $this->random);
◆ $chunks
◆ $floorLevel
◆ $options
◆ $preset
The documentation for this class was generated from the following file:
- src/pocketmine/level/generator/Flat.php