GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
Nether Class Reference

Public Member Functions

 __construct (array $options=[])
 
 getName ()
 
 getWaterHeight ()
 
 getSettings ()
 
 init (ChunkManager $level, Random $random)
 
 generateChunk ($chunkX, $chunkZ)
 
 populateChunk ($chunkX, $chunkZ)
 
 getSpawn ()
 
- Public Member Functions inherited from Generator
 getWaterHeight ()
 
 __construct (array $settings=[])
 
 init (ChunkManager $level, Random $random)
 
 generateChunk ($chunkX, $chunkZ)
 
 populateChunk ($chunkX, $chunkZ)
 
 getSettings ()
 
 getName ()
 
 getSpawn ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Generator
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)
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( array  $options = [])

Nether constructor.

Parameters
array$options
69  {
70  if(self::$GAUSSIAN_KERNEL === null){
71  self::generateKernel();
72  }
73  }

Member Function Documentation

◆ generateChunk()

generateChunk (   $chunkX,
  $chunkZ 
)
Parameters
$chunkX
$chunkZ
Returns
mixed|void
151  {
152  $this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed());
153 
154  $noise = Generator::getFastNoise3D($this->noiseBase, 16, 128, 16, 4, 8, 4, $chunkX * 16, 0, $chunkZ * 16);
155 
156  $chunk = $this->level->getChunk($chunkX, $chunkZ);
157 
158  for($x = 0; $x < 16; ++$x){
159  for($z = 0; $z < 16; ++$z){
160 
161  $biome = Biome::getBiome(Biome::HELL);
162  $chunk->setBiomeId($x, $z, $biome->getId());
163 
164  for($y = 0; $y < 128; ++$y){
165  if($y === 0 or $y === 127){
166  $chunk->setBlockId($x, $y, $z, Block::BEDROCK);
167  continue;
168  }
169  $noiseValue = (abs($this->emptyHeight - $y) / $this->emptyHeight) * $this->emptyAmplitude - $noise[$x][$z][$y];
170  $noiseValue -= 1 - $this->density;
171 
172  if($noiseValue > 0){
173  $chunk->setBlockId($x, $y, $z, Block::NETHERRACK);
174  }elseif($y <= $this->waterHeight){
175  $chunk->setBlockId($x, $y, $z, Block::STILL_LAVA);
176  $chunk->setBlockLight($x, $y + 1, $z, 15);
177  }
178  }
179  }
180  }
181 
182  foreach($this->generationPopulators as $populator){
183  $populator->populate($this->level, $chunkX, $chunkZ, $this->random);
184  }
185  }

◆ getName()

getName ( )
Returns
string
95  : string{
96  return "Nether";
97  }

◆ getSettings()

getSettings ( )
Returns
array
109  {
110  return [];
111  }

◆ getSpawn()

getSpawn ( )
Returns
Vector3
207  {
208  return new Vector3(127.5, 128, 127.5);
209  }

◆ getWaterHeight()

getWaterHeight ( )
Returns
int
102  : int{
103  return $this->waterHeight;
104  }

◆ init()

init ( ChunkManager  $level,
Random  $random 
)
Parameters
ChunkManager$level
Random$random
Returns
mixed|void
119  {
120  $this->level = $level;
121  $this->random = $random;
122  $this->random->setSeed($this->level->getSeed());
123  $this->noiseBase = new Simplex($this->random, 4, 1 / 4, 1 / 64);
124  $this->random->setSeed($this->level->getSeed());
125 
126  $ores = new NetherOre();
127  $ores->setOreTypes([
128  new OreType(new NetherQuartzOre(), 20, 16, 0, 128),
129  new OreType(new SoulSand(), 5, 64, 0, 128),
130  new OreType(new Gravel(), 5, 64, 0, 128),
131  new OreType(new Lava(), 1, 16, 0, $this->waterHeight),
132  ]);
133  $this->populators[] = $ores;
134  $this->populators[] = new NetherGlowStone();
135  $groundFire = new GroundFire();
136  $groundFire->setBaseAmount(1);
137  $groundFire->setRandomAmount(1);
138  $this->populators[] = $groundFire;
139  $lava = new NetherLava();
140  $lava->setBaseAmount(0);
141  $lava->setRandomAmount(0);
142  $this->populators[] = $lava;
143  }

◆ populateChunk()

populateChunk (   $chunkX,
  $chunkZ 
)
Parameters
$chunkX
$chunkZ
Returns
mixed|void
193  {
194  $this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed());
195  foreach($this->populators as $populator){
196  $populator->populate($this->level, $chunkX, $chunkZ, $this->random);
197  }
198 
199  $chunk = $this->level->getChunk($chunkX, $chunkZ);
200  $biome = Biome::getBiome($chunk->getBiomeId(7, 7));
201  $biome->populateChunk($this->level, $chunkX, $chunkZ, $this->random);
202  }

The documentation for this class was generated from the following file: