Chunk: remove column methods

these were (mostly) unused, and the places they were used breaks the interface definitions. It also exposes internals that are sensitive to change.
This commit is contained in:
Dylan K. Taylor 2018-10-03 18:35:39 +01:00
parent 77fd57e11a
commit 8a062f440d
2 changed files with 6 additions and 64 deletions

View File

@ -461,66 +461,6 @@ class Chunk{
$this->biomeIds{($z << 4) | $x} = chr($biomeId & 0xff); $this->biomeIds{($z << 4) | $x} = chr($biomeId & 0xff);
} }
/**
* Returns a column of block IDs from bottom to top at the specified X/Z chunk block coordinates.
* @param int $x 0-15
* @param int $z 0-15
*
* @return string
*/
public function getBlockIdColumn(int $x, int $z) : string{
$result = "";
foreach($this->subChunks as $subChunk){
$result .= $subChunk->getBlockIdColumn($x, $z);
}
return $result;
}
/**
* Returns a column of block meta values from bottom to top at the specified X/Z chunk block coordinates.
* @param int $x 0-15
* @param int $z 0-15
*
* @return string
*/
public function getBlockDataColumn(int $x, int $z) : string{
$result = "";
foreach($this->subChunks as $subChunk){
$result .= $subChunk->getBlockDataColumn($x, $z);
}
return $result;
}
/**
* Returns a column of sky light values from bottom to top at the specified X/Z chunk block coordinates.
* @param int $x 0-15
* @param int $z 0-15
*
* @return string
*/
public function getBlockSkyLightColumn(int $x, int $z) : string{
$result = "";
foreach($this->subChunks as $subChunk){
$result .= $subChunk->getBlockSkyLightColumn($x, $z);
}
return $result;
}
/**
* Returns a column of block light values from bottom to top at the specified X/Z chunk block coordinates.
* @param int $x 0-15
* @param int $z 0-15
*
* @return string
*/
public function getBlockLightColumn(int $x, int $z) : string{
$result = "";
foreach($this->subChunks as $subChunk){
$result .= $subChunk->getBlockLightColumn($x, $z);
}
return $result;
}
/** /**
* @return bool * @return bool
*/ */

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\level\generator\populator; namespace pocketmine\level\generator\populator;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory; use pocketmine\block\BlockFactory;
use pocketmine\block\Liquid; use pocketmine\block\Liquid;
use pocketmine\level\biome\Biome; use pocketmine\level\biome\Biome;
@ -43,9 +44,9 @@ class GroundCover extends Populator{
$diffY = 1; $diffY = 1;
} }
$column = $chunk->getBlockIdColumn($x, $z);
for($y = 127; $y > 0; --$y){ for($y = 127; $y > 0; --$y){
if($column{$y} !== "\x00" and !BlockFactory::get(ord($column{$y}))->isTransparent()){ $id = $chunk->getBlockId($x, $y, $z);
if($id !== Block::AIR and !BlockFactory::get($id)->isTransparent()){
break; break;
} }
} }
@ -53,10 +54,11 @@ class GroundCover extends Populator{
$endY = $startY - count($cover); $endY = $startY - count($cover);
for($y = $startY; $y > $endY and $y >= 0; --$y){ for($y = $startY; $y > $endY and $y >= 0; --$y){
$b = $cover[$startY - $y]; $b = $cover[$startY - $y];
if($column{$y} === "\x00" and $b->isSolid()){ $id = $chunk->getBlockId($x, $y, $z);
if($id === Block::AIR and $b->isSolid()){
break; break;
} }
if($b->canBeFlowedInto() and BlockFactory::get(ord($column{$y})) instanceof Liquid){ if($b->canBeFlowedInto() and BlockFactory::get($id) instanceof Liquid){
continue; continue;
} }
if($b->getDamage() === 0){ if($b->getDamage() === 0){