level/format: populate missing return type information

This commit is contained in:
Dylan K. Taylor 2020-01-19 19:36:34 +00:00
parent 82e9072223
commit 5334099fbf
3 changed files with 52 additions and 0 deletions

View File

@ -153,12 +153,19 @@ class Chunk{
return $this->z; return $this->z;
} }
/**
* @param int $x
*
* @return void
*/
public function setX(int $x){ public function setX(int $x){
$this->x = $x; $this->x = $x;
} }
/** /**
* @param int $z * @param int $z
*
* @return void
*/ */
public function setZ(int $z){ public function setZ(int $z){
$this->z = $z; $this->z = $z;
@ -225,6 +232,8 @@ class Chunk{
* @param int $y * @param int $y
* @param int $z 0-15 * @param int $z 0-15
* @param int $id 0-255 * @param int $id 0-255
*
* @return void
*/ */
public function setBlockId(int $x, int $y, int $z, int $id){ public function setBlockId(int $x, int $y, int $z, int $id){
if($this->getSubChunk($y >> 4, true)->setBlockId($x, $y & 0x0f, $z, $id)){ if($this->getSubChunk($y >> 4, true)->setBlockId($x, $y & 0x0f, $z, $id)){
@ -252,6 +261,8 @@ class Chunk{
* @param int $y * @param int $y
* @param int $z 0-15 * @param int $z 0-15
* @param int $data 0-15 * @param int $data 0-15
*
* @return void
*/ */
public function setBlockData(int $x, int $y, int $z, int $data){ public function setBlockData(int $x, int $y, int $z, int $data){
if($this->getSubChunk($y >> 4, true)->setBlockData($x, $y & 0x0f, $z, $data)){ if($this->getSubChunk($y >> 4, true)->setBlockData($x, $y & 0x0f, $z, $data)){
@ -279,6 +290,8 @@ class Chunk{
* @param int $y * @param int $y
* @param int $z 0-15 * @param int $z 0-15
* @param int $level 0-15 * @param int $level 0-15
*
* @return void
*/ */
public function setBlockSkyLight(int $x, int $y, int $z, int $level){ public function setBlockSkyLight(int $x, int $y, int $z, int $level){
if($this->getSubChunk($y >> 4, true)->setBlockSkyLight($x, $y & 0x0f, $z, $level)){ if($this->getSubChunk($y >> 4, true)->setBlockSkyLight($x, $y & 0x0f, $z, $level)){
@ -288,6 +301,8 @@ class Chunk{
/** /**
* @param int $level * @param int $level
*
* @return void
*/ */
public function setAllBlockSkyLight(int $level){ public function setAllBlockSkyLight(int $level){
$char = chr(($level & 0x0f) | ($level << 4)); $char = chr(($level & 0x0f) | ($level << 4));
@ -317,6 +332,8 @@ class Chunk{
* @param int $y 0-15 * @param int $y 0-15
* @param int $z 0-15 * @param int $z 0-15
* @param int $level 0-15 * @param int $level 0-15
*
* @return void
*/ */
public function setBlockLight(int $x, int $y, int $z, int $level){ public function setBlockLight(int $x, int $y, int $z, int $level){
if($this->getSubChunk($y >> 4, true)->setBlockLight($x, $y & 0x0f, $z, $level)){ if($this->getSubChunk($y >> 4, true)->setBlockLight($x, $y & 0x0f, $z, $level)){
@ -326,6 +343,8 @@ class Chunk{
/** /**
* @param int $level * @param int $level
*
* @return void
*/ */
public function setAllBlockLight(int $level){ public function setAllBlockLight(int $level){
$char = chr(($level & 0x0f) | ($level << 4)); $char = chr(($level & 0x0f) | ($level << 4));
@ -381,6 +400,8 @@ class Chunk{
* @param int $x 0-15 * @param int $x 0-15
* @param int $z 0-15 * @param int $z 0-15
* @param int $value * @param int $value
*
* @return void
*/ */
public function setHeightMap(int $x, int $z, int $value){ public function setHeightMap(int $x, int $z, int $value){
$this->heightMap[($z << 4) | $x] = $value; $this->heightMap[($z << 4) | $x] = $value;
@ -388,6 +409,8 @@ class Chunk{
/** /**
* Recalculates the heightmap for the whole chunk. * Recalculates the heightmap for the whole chunk.
*
* @return void
*/ */
public function recalculateHeightMap(){ public function recalculateHeightMap(){
for($z = 0; $z < 16; ++$z){ for($z = 0; $z < 16; ++$z){
@ -423,6 +446,8 @@ class Chunk{
* if the chunk is light-populated after being terrain-populated. * if the chunk is light-populated after being terrain-populated.
* *
* TODO: fast adjacent light spread * TODO: fast adjacent light spread
*
* @return void
*/ */
public function populateSkyLight(){ public function populateSkyLight(){
$maxY = $this->getMaxY(); $maxY = $this->getMaxY();
@ -469,6 +494,8 @@ class Chunk{
* @param int $x 0-15 * @param int $x 0-15
* @param int $z 0-15 * @param int $z 0-15
* @param int $biomeId 0-255 * @param int $biomeId 0-255
*
* @return void
*/ */
public function setBiomeId(int $x, int $z, int $biomeId){ public function setBiomeId(int $x, int $z, int $biomeId){
$this->hasChanged = true; $this->hasChanged = true;
@ -549,6 +576,8 @@ class Chunk{
/** /**
* @param bool $value * @param bool $value
*
* @return void
*/ */
public function setLightPopulated(bool $value = true){ public function setLightPopulated(bool $value = true){
$this->lightPopulated = $value; $this->lightPopulated = $value;
@ -563,6 +592,8 @@ class Chunk{
/** /**
* @param bool $value * @param bool $value
*
* @return void
*/ */
public function setPopulated(bool $value = true){ public function setPopulated(bool $value = true){
$this->terrainPopulated = $value; $this->terrainPopulated = $value;
@ -577,6 +608,8 @@ class Chunk{
/** /**
* @param bool $value * @param bool $value
*
* @return void
*/ */
public function setGenerated(bool $value = true){ public function setGenerated(bool $value = true){
$this->terrainGenerated = $value; $this->terrainGenerated = $value;
@ -584,6 +617,8 @@ class Chunk{
/** /**
* @param Entity $entity * @param Entity $entity
*
* @return void
*/ */
public function addEntity(Entity $entity){ public function addEntity(Entity $entity){
if($entity->isClosed()){ if($entity->isClosed()){
@ -597,6 +632,8 @@ class Chunk{
/** /**
* @param Entity $entity * @param Entity $entity
*
* @return void
*/ */
public function removeEntity(Entity $entity){ public function removeEntity(Entity $entity){
unset($this->entities[$entity->getId()]); unset($this->entities[$entity->getId()]);
@ -607,6 +644,8 @@ class Chunk{
/** /**
* @param Tile $tile * @param Tile $tile
*
* @return void
*/ */
public function addTile(Tile $tile){ public function addTile(Tile $tile){
if($tile->isClosed()){ if($tile->isClosed()){
@ -624,6 +663,8 @@ class Chunk{
/** /**
* @param Tile $tile * @param Tile $tile
*
* @return void
*/ */
public function removeTile(Tile $tile){ public function removeTile(Tile $tile){
unset($this->tiles[$tile->getId()]); unset($this->tiles[$tile->getId()]);
@ -690,6 +731,8 @@ class Chunk{
* Deserializes tiles and entities from NBT * Deserializes tiles and entities from NBT
* *
* @param Level $level * @param Level $level
*
* @return void
*/ */
public function initChunk(Level $level){ public function initChunk(Level $level){
if(!$this->isInit){ if(!$this->isInit){
@ -766,6 +809,8 @@ class Chunk{
/** /**
* @param bool $value * @param bool $value
*
* @return void
*/ */
public function setChanged(bool $value = true){ public function setChanged(bool $value = true){
$this->hasChanged = $value; $this->hasChanged = $value;

View File

@ -217,6 +217,9 @@ class SubChunk implements SubChunkInterface{
return "\x00" . $this->ids . $this->data; return "\x00" . $this->ids . $this->data;
} }
/**
* @return mixed[]
*/
public function __debugInfo(){ public function __debugInfo(){
return []; return [];
} }

View File

@ -185,6 +185,8 @@ interface SubChunkInterface{
/** /**
* @param string $data * @param string $data
*
* @return void
*/ */
public function setBlockSkyLightArray(string $data); public function setBlockSkyLightArray(string $data);
@ -195,6 +197,8 @@ interface SubChunkInterface{
/** /**
* @param string $data * @param string $data
*
* @return void
*/ */
public function setBlockLightArray(string $data); public function setBlockLightArray(string $data);