mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
phpdoc armageddon for master, pass 1
This commit is contained in:
@ -98,8 +98,6 @@ class Banner extends Spawnable{
|
||||
|
||||
/**
|
||||
* Returns the color of the banner base.
|
||||
*
|
||||
* @return DyeColor
|
||||
*/
|
||||
public function getBaseColor() : DyeColor{
|
||||
return $this->baseColor;
|
||||
@ -107,8 +105,6 @@ class Banner extends Spawnable{
|
||||
|
||||
/**
|
||||
* Sets the color of the banner base.
|
||||
*
|
||||
* @param DyeColor $color
|
||||
*/
|
||||
public function setBaseColor(DyeColor $color) : void{
|
||||
$this->baseColor = $color;
|
||||
|
@ -163,9 +163,6 @@ class Chest extends Spawnable implements Container, Nameable{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultName() : string{
|
||||
return "Chest";
|
||||
}
|
||||
@ -174,9 +171,6 @@ class Chest extends Spawnable implements Container, Nameable{
|
||||
return $this->pairX !== null and $this->pairZ !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Chest|null
|
||||
*/
|
||||
public function getPair() : ?Chest{
|
||||
if($this->isPaired()){
|
||||
$tile = $this->pos->getWorld()->getTileAt($this->pairX, $this->pos->y, $this->pairZ);
|
||||
|
@ -36,16 +36,10 @@ class Comparator extends Tile{
|
||||
/** @var int */
|
||||
protected $signalStrength = 0;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSignalStrength() : int{
|
||||
return $this->signalStrength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $signalStrength
|
||||
*/
|
||||
public function setSignalStrength(int $signalStrength) : void{
|
||||
$this->signalStrength = $signalStrength;
|
||||
}
|
||||
|
@ -37,10 +37,6 @@ interface Container extends InventoryHolder{
|
||||
|
||||
/**
|
||||
* Returns whether this container can be opened by an item with the given custom name.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canOpenWith(string $key) : bool;
|
||||
}
|
||||
|
@ -78,10 +78,6 @@ trait ContainerTrait{
|
||||
|
||||
/**
|
||||
* @see Container::canOpenWith()
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canOpenWith(string $key) : bool{
|
||||
return $this->lock === null or $this->lock === $key;
|
||||
@ -89,7 +85,6 @@ trait ContainerTrait{
|
||||
|
||||
/**
|
||||
* @see Position::asPosition()
|
||||
* @return Position
|
||||
*/
|
||||
abstract protected function getPos() : Position;
|
||||
|
||||
|
@ -29,9 +29,6 @@ class EnchantTable extends Spawnable implements Nameable{
|
||||
saveName as writeSaveData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultName() : string{
|
||||
return "Enchanting Table";
|
||||
}
|
||||
|
@ -90,9 +90,6 @@ class Furnace extends Spawnable implements Container, Nameable{
|
||||
$this->saveItems($nbt);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultName() : string{
|
||||
return "Furnace";
|
||||
}
|
||||
|
@ -26,23 +26,11 @@ namespace pocketmine\block\tile;
|
||||
interface Nameable{
|
||||
public const TAG_CUSTOM_NAME = "CustomName";
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultName() : string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName() : string;
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
*/
|
||||
public function setName(string $str) : void;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasName() : bool;
|
||||
}
|
||||
|
@ -34,21 +34,12 @@ trait NameableTrait{
|
||||
/** @var string|null */
|
||||
private $customName = null;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getDefaultName() : string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName() : string{
|
||||
return $this->customName ?? $this->getDefaultName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName(string $name) : void{
|
||||
if($name === ""){
|
||||
$this->customName = null;
|
||||
@ -57,9 +48,6 @@ trait NameableTrait{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasName() : bool{
|
||||
return $this->customName !== null;
|
||||
}
|
||||
@ -83,7 +71,6 @@ trait NameableTrait{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Item $item
|
||||
* @see Tile::copyDataFromItem()
|
||||
*/
|
||||
public function copyDataFromItem(Item $item) : void{
|
||||
|
@ -43,16 +43,10 @@ class Note extends Tile{
|
||||
$nbt->setByte("note", $this->pitch);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPitch() : int{
|
||||
return $this->pitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $pitch
|
||||
*/
|
||||
public function setPitch(int $pitch) : void{
|
||||
if($pitch < BlockNote::MIN_PITCH or $pitch > BlockNote::MAX_PITCH){
|
||||
throw new \InvalidArgumentException("Pitch must be in range " . BlockNote::MIN_PITCH . " - " . BlockNote::MAX_PITCH);
|
||||
|
@ -78,16 +78,10 @@ class Sign extends Spawnable{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SignText
|
||||
*/
|
||||
public function getText() : SignText{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SignText $text
|
||||
*/
|
||||
public function setText(SignText $text) : void{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
@ -39,16 +39,11 @@ abstract class Spawnable extends Tile{
|
||||
|
||||
/**
|
||||
* Returns whether the tile needs to be respawned to viewers.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDirty() : bool{
|
||||
return $this->dirty;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $dirty
|
||||
*/
|
||||
public function setDirty(bool $dirty = true) : void{
|
||||
if($dirty){
|
||||
$this->spawnCompoundCache = null;
|
||||
@ -74,9 +69,6 @@ abstract class Spawnable extends Tile{
|
||||
return $this->spawnCompoundCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CompoundTag
|
||||
*/
|
||||
final public function getSpawnCompound() : CompoundTag{
|
||||
$nbt = CompoundTag::create()
|
||||
->setString(self::TAG_ID, TileFactory::getSaveId(get_class($this))) //TODO: disassociate network ID from save ID
|
||||
@ -90,8 +82,6 @@ abstract class Spawnable extends Tile{
|
||||
/**
|
||||
* An extension to getSpawnCompound() for
|
||||
* further modifying the generic tile NBT.
|
||||
*
|
||||
* @param CompoundTag $nbt
|
||||
*/
|
||||
abstract protected function addAdditionalSpawnData(CompoundTag $nbt) : void;
|
||||
}
|
||||
|
@ -59,15 +59,11 @@ abstract class Tile{
|
||||
/**
|
||||
* @internal
|
||||
* Reads additional data from the CompoundTag on tile creation.
|
||||
*
|
||||
* @param CompoundTag $nbt
|
||||
*/
|
||||
abstract public function readSaveData(CompoundTag $nbt) : void;
|
||||
|
||||
/**
|
||||
* Writes additional save data to a CompoundTag, not including generic things like ID and coordinates.
|
||||
*
|
||||
* @param CompoundTag $nbt
|
||||
*/
|
||||
abstract protected function writeSaveData(CompoundTag $nbt) : void;
|
||||
|
||||
@ -90,8 +86,6 @@ abstract class Tile{
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param Item $item
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function copyDataFromItem(Item $item) : void{
|
||||
@ -100,16 +94,10 @@ abstract class Tile{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Block
|
||||
*/
|
||||
public function getBlock() : Block{
|
||||
return $this->pos->getWorld()->getBlock($this->pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Position
|
||||
*/
|
||||
public function getPos() : Position{
|
||||
return $this->pos;
|
||||
}
|
||||
|
@ -89,7 +89,6 @@ final class TileFactory{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string[] $saveNames
|
||||
*/
|
||||
public static function register(string $className, array $saveNames = []) : void{
|
||||
@ -125,10 +124,6 @@ final class TileFactory{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseClass
|
||||
* @param World $world
|
||||
* @param Vector3 $pos
|
||||
*
|
||||
* @return Tile (will be an instanceof $baseClass)
|
||||
* @throws \InvalidArgumentException if the specified class is not a registered tile
|
||||
*/
|
||||
@ -149,12 +144,7 @@ final class TileFactory{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param World $world
|
||||
* @param CompoundTag $nbt
|
||||
*
|
||||
* @return Tile|null
|
||||
*@internal
|
||||
*
|
||||
*/
|
||||
public static function createFromData(World $world, CompoundTag $nbt) : ?Tile{
|
||||
$type = $nbt->getString(Tile::TAG_ID, "", true);
|
||||
|
Reference in New Issue
Block a user