Level rewrite middle step

This commit is contained in:
Shoghi Cervantes
2014-05-22 17:53:56 +02:00
parent c1546aac9c
commit 387677e957
17 changed files with 1919 additions and 1111 deletions

View File

@ -71,13 +71,29 @@ abstract class BaseChunk implements Chunk{
}
public function getBlock($x, $y, $z, &$blockId, &$meta = null){
$this->sections[$y >> 4]->getBlock($x, $y - ($y >> 4), $z, $blockId, $meta);
return $this->sections[$y >> 4]->getBlock($x, $y - ($y >> 4), $z, $blockId, $meta);
}
public function setBlock($x, $y, $z, $blockId = null, $meta = null){
$this->sections[$y >> 4]->setBlock($x, $y - ($y >> 4), $z, $blockId, $meta);
}
public function getBlockId($x, $y, $z){
return $this->sections[$y >> 4]->getBlockId($x, $y - ($y >> 4), $z);
}
public function setBlockId($x, $y, $z, $id){
$this->sections[$y >> 4]->setBlockId($x, $y - ($y >> 4), $z, $id);
}
public function getBlockData($x, $y, $z){
return $this->sections[$y >> 4]->getBlockData($x, $y - ($y >> 4), $z);
}
public function setBlockData($x, $y, $z, $data){
$this->sections[$y >> 4]->setBlockData($x, $y - ($y >> 4), $z, $data);
}
public function getBlockSkyLight($x, $y, $z){
return $this->sections[$y >> 4]->getBlockSkyLight($x, $y - ($y >> 4), $z);
}
@ -120,4 +136,9 @@ abstract class BaseChunk implements Chunk{
public function setSection($fY, ChunkSection $section){
$this->sections[(int) $fY] = $section;
}
public function getSections(){
return $this->sections;
}
}

View File

@ -0,0 +1,64 @@
<?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 PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\format\generic;
use pocketmine\level\format\ChunkSnapshot;
abstract class BaseChunkSnapshot implements ChunkSnapshot{
protected $blockId;
protected $blockData;
protected $skyLight;
protected $light;
protected $x;
protected $z;
protected $levelName;
protected $levelTime;
public function __construct($x, $z, $levelName, $levelTime, $blockId, $blockData, $skyLight, $light, $heightMap, $biome, $biomeTemp, $biomeRain){
$this->x = $x;
$this->z = $z;
$this->levelName = $levelName;
$this->levelTime = $levelTime;
$this->blockId = $blockId;
$this->blockData = $blockData;
$this->skyLight = $skyLight;
$this->light = $light;
}
public function getX(){
return $this->x;
}
public function getZ(){
return $this->z;
}
public function getLevelName(){
return $this->levelName;
}
public function getLevelTime(){
return $this->levelTime;
}
}

View File

@ -0,0 +1,36 @@
<?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 PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\format\generic;
use pocketmine\level\format\LevelProvider;
use pocketmine\Server;
abstract class BaseLevelProvider implements LevelProvider{
/** @var Server */
protected $server;
/** @var string */
protected $path;
public function __construct(Server $server, $path){
$this->server = $server;
$this->path = $path;
}
}

View File

@ -38,6 +38,22 @@ class EmptyChunkSection implements ChunkSection{
return "\x00\x00\x00\x00\x00\x00\x00\x00";
}
public function getIdArray(){
return str_repeat("\x00", 4096);
}
public function getDataArray(){
return str_repeat("\x00", 2048);
}
public function getSkyLightArray(){
return str_repeat("\x00", 2048);
}
public function getLightArray(){
return str_repeat("\x00", 2048);
}
final public function setBlockId($x, $y, $z, $id){
}