Ejemplo n.º 1
0
 public function testChunkGeneration()
 {
     $chunkCoordinates = new Coordinates2D(0, 0);
     $blockCoordinates = new Coordinates3D(10, 10, 10);
     $chunk = new Chunk($chunkCoordinates);
     $this->assertEquals($chunk->getBlockID($blockCoordinates), 0x0, "Expects block to be air in the chunk");
 }
 public function generateChunk($Coordinates2DPos)
 {
     $newC = new Chunk($Coordinates2DPos);
     $y = 0;
     // Flatland, dirt from layer 1 - 8, grass on layer 9.
     while ($y < 10) {
         for ($x = 0; $x < 16; $x++) {
             for ($z = 0; $z < 16; $z++) {
                 if ($y < 9) {
                     $newC->setBlockID(new Coordinates3D($x, $y, $z), 0x3);
                 } else {
                     $newC->setBlockID(new Coordinates3D($x, $y, $z), 0x2);
                 }
             }
         }
         $y++;
     }
     return $newC;
 }