tile: populate missing return type information

This commit is contained in:
Dylan K. Taylor 2020-01-19 17:08:40 +00:00
parent 0b9d0f3cdc
commit 8776b71d63
9 changed files with 57 additions and 1 deletions

View File

@ -38,6 +38,9 @@ class Bed extends Spawnable{
return $this->color; return $this->color;
} }
/**
* @return void
*/
public function setColor(int $color){ public function setColor(int $color){
$this->color = $color & 0xf; $this->color = $color & 0xf;
$this->onChanged(); $this->onChanged();

View File

@ -117,6 +117,9 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
return $this->inventory; return $this->inventory;
} }
/**
* @return void
*/
protected function checkPairing(){ protected function checkPairing(){
if($this->isPaired() and !$this->getLevel()->isInLoadedTerrain(new Vector3($this->pairX, $this->y, $this->pairZ))){ if($this->isPaired() and !$this->getLevel()->isInLoadedTerrain(new Vector3($this->pairX, $this->y, $this->pairZ))){
//paired to a tile in an unloaded chunk //paired to a tile in an unloaded chunk
@ -151,6 +154,9 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
return "Chest"; return "Chest";
} }
/**
* @return bool
*/
public function isPaired(){ public function isPaired(){
return $this->pairX !== null and $this->pairZ !== null; return $this->pairX !== null and $this->pairZ !== null;
} }
@ -169,6 +175,9 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
return null; return null;
} }
/**
* @return bool
*/
public function pairWith(Chest $tile){ public function pairWith(Chest $tile){
if($this->isPaired() or $tile->isPaired()){ if($this->isPaired() or $tile->isPaired()){
return false; return false;
@ -183,7 +192,7 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
return true; return true;
} }
private function createPair(Chest $tile){ private function createPair(Chest $tile) : void{
$this->pairX = $tile->x; $this->pairX = $tile->x;
$this->pairZ = $tile->z; $this->pairZ = $tile->z;
@ -191,6 +200,9 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
$tile->pairZ = $this->z; $tile->pairZ = $this->z;
} }
/**
* @return bool
*/
public function unpair(){ public function unpair(){
if(!$this->isPaired()){ if(!$this->isPaired()){
return false; return false;

View File

@ -70,11 +70,19 @@ class FlowerPot extends Spawnable{
return clone $this->item; return clone $this->item;
} }
/**
* @param Item $item
*
* @return void
*/
public function setItem(Item $item){ public function setItem(Item $item){
$this->item = clone $item; $this->item = clone $item;
$this->onChanged(); $this->onChanged();
} }
/**
* @return void
*/
public function removeItem(){ public function removeItem(){
$this->setItem(ItemFactory::get(Item::AIR, 0, 0)); $this->setItem(ItemFactory::get(Item::AIR, 0, 0));
} }

View File

@ -138,6 +138,11 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
return $this->getInventory(); return $this->getInventory();
} }
/**
* @param Item $fuel
*
* @return void
*/
protected function checkFuel(Item $fuel){ protected function checkFuel(Item $fuel){
$ev = new FurnaceBurnEvent($this, $fuel, $fuel->getFuelTime()); $ev = new FurnaceBurnEvent($this, $fuel, $fuel->getFuelTime());
$ev->call(); $ev->call();

View File

@ -63,6 +63,11 @@ class ItemFrame extends Spawnable{
return clone $this->item; return clone $this->item;
} }
/**
* @param Item|null $item
*
* @return void
*/
public function setItem(Item $item = null){ public function setItem(Item $item = null){
if($item !== null and !$item->isNull()){ if($item !== null and !$item->isNull()){
$this->item = clone $item; $this->item = clone $item;
@ -76,6 +81,11 @@ class ItemFrame extends Spawnable{
return $this->itemRotation; return $this->itemRotation;
} }
/**
* @param int $rotation
*
* @return void
*/
public function setItemRotation(int $rotation){ public function setItemRotation(int $rotation){
$this->itemRotation = $rotation; $this->itemRotation = $rotation;
$this->onChanged(); $this->onChanged();
@ -85,6 +95,11 @@ class ItemFrame extends Spawnable{
return $this->itemDropChance; return $this->itemDropChance;
} }
/**
* @param float $chance
*
* @return void
*/
public function setItemDropChance(float $chance){ public function setItemDropChance(float $chance){
$this->itemDropChance = $chance; $this->itemDropChance = $chance;
$this->onChanged(); $this->onChanged();

View File

@ -38,6 +38,8 @@ interface Nameable{
/** /**
* @param string $str * @param string $str
*
* @return void
*/ */
public function setName(string $str); public function setName(string $str);

View File

@ -57,6 +57,11 @@ class Skull extends Spawnable{
$nbt->setByte(self::TAG_ROT, $this->skullRotation); $nbt->setByte(self::TAG_ROT, $this->skullRotation);
} }
/**
* @param int $type
*
* @return void
*/
public function setType(int $type){ public function setType(int $type){
$this->skullType = $type; $this->skullType = $type;
$this->onChanged(); $this->onChanged();

View File

@ -62,6 +62,9 @@ abstract class Spawnable extends Tile{
$this->spawnToAll(); $this->spawnToAll();
} }
/**
* @return void
*/
public function spawnToAll(){ public function spawnToAll(){
if($this->closed){ if($this->closed){
return; return;

View File

@ -84,6 +84,9 @@ abstract class Tile extends Position{
/** @var TimingsHandler */ /** @var TimingsHandler */
protected $timings; protected $timings;
/**
* @return void
*/
public static function init(){ public static function init(){
self::registerTile(Banner::class, [self::BANNER, "minecraft:banner"]); self::registerTile(Banner::class, [self::BANNER, "minecraft:banner"]);
self::registerTile(Bed::class, [self::BED, "minecraft:bed"]); self::registerTile(Bed::class, [self::BED, "minecraft:bed"]);