mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
phpdoc armageddon for master, pass 1
This commit is contained in:
@ -90,12 +90,9 @@ class Chunk{
|
||||
protected $NBTentities;
|
||||
|
||||
/**
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param SubChunk[] $subChunks
|
||||
* @param CompoundTag[] $entities
|
||||
* @param CompoundTag[] $tiles
|
||||
* @param string $biomeIds
|
||||
* @param int[] $heightMap
|
||||
*/
|
||||
public function __construct(int $chunkX, int $chunkZ, array $subChunks = [], ?array $entities = null, ?array $tiles = null, string $biomeIds = "", array $heightMap = []){
|
||||
@ -127,16 +124,10 @@ class Chunk{
|
||||
$this->NBTentities = $entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getX() : int{
|
||||
return $this->x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getZ() : int{
|
||||
return $this->z;
|
||||
}
|
||||
@ -145,17 +136,12 @@ class Chunk{
|
||||
$this->x = $x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $z
|
||||
*/
|
||||
public function setZ(int $z) : void{
|
||||
$this->z = $z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the chunk height in count of subchunks.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight() : int{
|
||||
return $this->subChunks->getSize();
|
||||
@ -176,11 +162,6 @@ class Chunk{
|
||||
|
||||
/**
|
||||
* Sets the blockstate at the given coordinate by internal ID.
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $z
|
||||
* @param int $block
|
||||
*/
|
||||
public function setFullBlock(int $x, int $y, int $z, int $block) : void{
|
||||
$this->getSubChunk($y >> 4)->setFullBlock($x, $y & 0xf, $z, $block);
|
||||
@ -212,9 +193,6 @@ class Chunk{
|
||||
$this->getSubChunk($y >> 4)->getBlockSkyLightArray()->set($x & 0xf, $y & 0x0f, $z & 0xf, $level);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $level
|
||||
*/
|
||||
public function setAllBlockSkyLight(int $level) : void{
|
||||
for($y = $this->subChunks->count() - 1; $y >= 0; --$y){
|
||||
$this->getSubChunk($y)->setBlockSkyLightArray(LightArray::fill($level));
|
||||
@ -246,9 +224,6 @@ class Chunk{
|
||||
$this->getSubChunk($y >> 4)->getBlockLightArray()->set($x & 0xf, $y & 0x0f, $z & 0xf, $level);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $level
|
||||
*/
|
||||
public function setAllBlockLight(int $level) : void{
|
||||
for($y = $this->subChunks->count() - 1; $y >= 0; --$y){
|
||||
$this->getSubChunk($y)->setBlockLightArray(LightArray::fill($level));
|
||||
@ -279,8 +254,6 @@ class Chunk{
|
||||
*
|
||||
* @param int $x 0-15
|
||||
* @param int $z 0-15
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHeightMap(int $x, int $z) : int{
|
||||
return $this->heightMap[($z << 4) | $x];
|
||||
@ -291,7 +264,6 @@ class Chunk{
|
||||
*
|
||||
* @param int $x 0-15
|
||||
* @param int $z 0-15
|
||||
* @param int $value
|
||||
*/
|
||||
public function setHeightMap(int $x, int $z, int $value) : void{
|
||||
$this->heightMap[($z << 4) | $x] = $value;
|
||||
@ -384,51 +356,30 @@ class Chunk{
|
||||
$this->dirtyFlags |= self::DIRTY_FLAG_BIOMES;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isLightPopulated() : bool{
|
||||
return $this->lightPopulated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setLightPopulated(bool $value = true) : void{
|
||||
$this->lightPopulated = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPopulated() : bool{
|
||||
return $this->terrainPopulated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setPopulated(bool $value = true) : void{
|
||||
$this->terrainPopulated = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isGenerated() : bool{
|
||||
return $this->terrainGenerated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setGenerated(bool $value = true) : void{
|
||||
$this->terrainGenerated = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Entity $entity
|
||||
*/
|
||||
public function addEntity(Entity $entity) : void{
|
||||
if($entity->isClosed()){
|
||||
throw new \InvalidArgumentException("Attempted to add a garbage closed Entity to a chunk");
|
||||
@ -439,9 +390,6 @@ class Chunk{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Entity $entity
|
||||
*/
|
||||
public function removeEntity(Entity $entity) : void{
|
||||
unset($this->entities[$entity->getId()]);
|
||||
if(!($entity instanceof Player)){
|
||||
@ -449,9 +397,6 @@ class Chunk{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Tile $tile
|
||||
*/
|
||||
public function addTile(Tile $tile) : void{
|
||||
if($tile->isClosed()){
|
||||
throw new \InvalidArgumentException("Attempted to add a garbage closed Tile to a chunk");
|
||||
@ -465,9 +410,6 @@ class Chunk{
|
||||
$this->dirtyFlags |= self::DIRTY_FLAG_TILES;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Tile $tile
|
||||
*/
|
||||
public function removeTile(Tile $tile) : void{
|
||||
$pos = $tile->getPos();
|
||||
unset($this->tiles[Chunk::blockHash($pos->x, $pos->y, $pos->z)]);
|
||||
@ -503,8 +445,6 @@ class Chunk{
|
||||
* @param int $x 0-15
|
||||
* @param int $y
|
||||
* @param int $z 0-15
|
||||
*
|
||||
* @return Tile|null
|
||||
*/
|
||||
public function getTile(int $x, int $y, int $z) : ?Tile{
|
||||
return $this->tiles[Chunk::blockHash($x, $y, $z)] ?? null;
|
||||
@ -542,8 +482,6 @@ class Chunk{
|
||||
|
||||
/**
|
||||
* Deserializes tiles and entities from NBT
|
||||
*
|
||||
* @param World $world
|
||||
*/
|
||||
public function initChunk(World $world) : void{
|
||||
if($this->NBTentities !== null){
|
||||
@ -586,9 +524,6 @@ class Chunk{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBiomeIdArray() : string{
|
||||
return $this->biomeIds;
|
||||
}
|
||||
@ -611,9 +546,6 @@ class Chunk{
|
||||
$this->heightMap = \SplFixedArray::fromArray($values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDirty() : bool{
|
||||
return $this->dirtyFlags !== 0 or !empty($this->tiles) or !empty($this->getSavableEntities());
|
||||
}
|
||||
@ -622,9 +554,6 @@ class Chunk{
|
||||
return ($this->dirtyFlags & $flag) !== 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDirtyFlags() : int{
|
||||
return $this->dirtyFlags;
|
||||
}
|
||||
@ -647,10 +576,6 @@ class Chunk{
|
||||
|
||||
/**
|
||||
* Returns the subchunk at the specified subchunk Y coordinate, or an empty, unmodifiable stub if it does not exist or the coordinate is out of range.
|
||||
*
|
||||
* @param int $y
|
||||
*
|
||||
* @return SubChunkInterface
|
||||
*/
|
||||
public function getSubChunk(int $y) : SubChunkInterface{
|
||||
if($y < 0 or $y >= $this->subChunks->getSize()){
|
||||
@ -662,9 +587,6 @@ class Chunk{
|
||||
|
||||
/**
|
||||
* Sets a subchunk in the chunk index
|
||||
*
|
||||
* @param int $y
|
||||
* @param SubChunk|null $subChunk
|
||||
*/
|
||||
public function setSubChunk(int $y, ?SubChunk $subChunk) : void{
|
||||
if($y < 0 or $y >= $this->subChunks->getSize()){
|
||||
@ -697,8 +619,6 @@ class Chunk{
|
||||
* @param int $x 0-15
|
||||
* @param int $y
|
||||
* @param int $z 0-15
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function blockHash(int $x, int $y, int $z) : int{
|
||||
return ($y << 8) | (($z & 0x0f) << 4) | ($x & 0x0f);
|
||||
|
Reference in New Issue
Block a user