Use typed properties in block namespace

This commit is contained in:
Dylan K. Taylor 2021-05-22 23:52:31 +01:00
parent 73c229a236
commit f68b9e79e1
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
68 changed files with 134 additions and 246 deletions

View File

@ -39,8 +39,7 @@ class Anvil extends Transparent implements Fallable{
use FallableTrait;
use HorizontalFacingTrait;
/** @var int */
private $damage = 0;
private int $damage = 0;
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) | ($this->damage << 2);

View File

@ -48,12 +48,9 @@ class Bamboo extends Transparent{
public const SMALL_LEAVES = 1;
public const LARGE_LEAVES = 2;
/** @var bool */
protected $thick = false; //age in PC, but this is 0/1
/** @var bool */
protected $ready = false;
/** @var int */
protected $leafSize = self::NO_LEAVES;
protected bool $thick = false; //age in PC, but this is 0/1
protected bool $ready = false;
protected int $leafSize = self::NO_LEAVES;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->thick = ($stateMeta & BlockLegacyMetadata::BAMBOO_FLAG_THICK) !== 0;

View File

@ -32,8 +32,7 @@ use pocketmine\world\BlockTransaction;
final class BambooSapling extends Flowable{
/** @var bool */
private $ready = false;
private bool $ready = false;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->ready = ($stateMeta & BlockLegacyMetadata::SAPLING_FLAG_READY) !== 0;

View File

@ -36,8 +36,7 @@ use function abs;
class Barrel extends Opaque{
use AnyFacingTrait;
/** @var bool */
protected $open = false;
protected bool $open = false;
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeFacing($this->facing) | ($this->open ? BlockLegacyMetadata::BARREL_FLAG_OPEN : 0);

View File

@ -40,14 +40,14 @@ use function assert;
use function count;
abstract class BaseBanner extends Transparent{
/** @var DyeColor */
protected $baseColor;
protected DyeColor $baseColor;
/**
* @var BannerPatternLayer[]
* @phpstan-var list<BannerPatternLayer>
*/
protected $patterns = [];
protected array $patterns = [];
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
parent::__construct($idInfo, $name, $breakInfo);

View File

@ -72,7 +72,7 @@ abstract class BaseRail extends Flowable{
];
/** @var int[] */
protected $connections = [];
protected array $connections = [];
protected function writeStateToMeta() : int{
if(count($this->connections) === 0){

View File

@ -39,11 +39,8 @@ use function strlen;
abstract class BaseSign extends Transparent{
//TODO: conditionally useless properties, find a way to fix
/** @var SignText */
protected $text;
/** @var int|null */
protected $editorEntityRuntimeId = null;
protected SignText $text;
protected ?int $editorEntityRuntimeId = null;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
parent::__construct($idInfo, $name, $breakInfo);

View File

@ -43,12 +43,9 @@ use pocketmine\world\World;
class Bed extends Transparent{
use HorizontalFacingTrait;
/** @var bool */
protected $occupied = false;
/** @var bool */
protected $head = false;
/** @var DyeColor */
protected $color;
protected bool $occupied = false;
protected bool $head = false;
protected DyeColor $color;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
parent::__construct($idInfo, $name, $breakInfo);

View File

@ -25,8 +25,7 @@ namespace pocketmine\block;
class Bedrock extends Opaque{
/** @var bool */
private $burnsForever = false;
private bool $burnsForever = false;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->burnsForever = ($stateMeta & BlockLegacyMetadata::BEDROCK_FLAG_INFINIBURN) !== 0;

View File

@ -49,20 +49,13 @@ use const PHP_INT_MAX;
class Block{
/** @var BlockIdentifier */
protected $idInfo;
/** @var string */
protected $fallbackName;
/** @var BlockBreakInfo */
protected $breakInfo;
/** @var Position */
protected $pos;
protected BlockIdentifier $idInfo;
protected string $fallbackName;
protected BlockBreakInfo $breakInfo;
protected Position $pos;
/** @var AxisAlignedBB[]|null */
protected $collisionBoxes = null;
protected ?array $collisionBoxes = null;
/**
* @param string $name English name of the block type (TODO: implement translations)

View File

@ -28,14 +28,10 @@ use function get_class;
class BlockBreakInfo{
/** @var float */
private $hardness;
/** @var float */
private $blastResistance;
/** @var int */
private $toolType;
/** @var int */
private $toolHarvestLevel;
private float $hardness;
private float $blastResistance;
private int $toolType;
private int $toolHarvestLevel;
/**
* @param float|null $blastResistance default 5x hardness

View File

@ -27,17 +27,11 @@ use pocketmine\block\tile\Tile;
class BlockIdentifier{
/** @var int */
private $blockId;
/** @var int */
private $variant;
/** @var int|null */
private $itemId;
/**
* @var string|null
* @phpstan-var class-string<Tile>|null
*/
private $tileClass;
private int $blockId;
private int $variant;
private ?int $itemId;
/** @phpstan-var class-string<Tile>|null */
private ?string $tileClass;
/**
* @phpstan-param class-string<Tile>|null $tileClass

View File

@ -36,7 +36,7 @@ class BrewingStand extends Transparent{
* @var BrewingStandSlot[]
* @phpstan-var array<int, BrewingStandSlot>
*/
protected $slots = [];
protected array $slots = [];
protected function writeStateToMeta() : int{
$flags = 0;

View File

@ -36,8 +36,7 @@ use pocketmine\world\sound\RedstonePowerOnSound;
abstract class Button extends Flowable{
use AnyFacingTrait;
/** @var bool */
protected $pressed = false;
protected bool $pressed = false;
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeFacing($this->facing) | ($this->pressed ? BlockLegacyMetadata::BUTTON_FLAG_POWERED : 0);

View File

@ -37,8 +37,7 @@ use pocketmine\world\BlockTransaction;
class Cactus extends Transparent{
/** @var int */
protected $age = 0;
protected int $age = 0;
protected function writeStateToMeta() : int{
return $this->age;

View File

@ -36,8 +36,7 @@ use pocketmine\world\BlockTransaction;
class Cake extends Transparent implements FoodSource{
/** @var int */
protected $bites = 0;
protected int $bites = 0;
protected function writeStateToMeta() : int{
return $this->bites;

View File

@ -40,8 +40,7 @@ use function mt_rand;
class CocoaBlock extends Transparent{
use HorizontalFacingTrait;
/** @var int */
protected $age = 0;
protected int $age = 0;
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeLegacyHorizontalFacing(Facing::opposite($this->facing)) | ($this->age << 2);

View File

@ -31,11 +31,8 @@ use function mt_rand;
final class CoralBlock extends Opaque{
/** @var CoralType */
private $coralType;
/** @var bool */
private $dead = false;
private CoralType $coralType;
private bool $dead = false;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->coralType = CoralType::TUBE();

View File

@ -34,8 +34,8 @@ use pocketmine\world\BlockTransaction;
use function mt_rand;
abstract class Crops extends Flowable{
/** @var int */
protected $age = 0;
protected int $age = 0;
protected function writeStateToMeta() : int{
return $this->age;

View File

@ -38,11 +38,9 @@ use const M_PI;
class DaylightSensor extends Transparent{
use AnalogRedstoneSignalEmitterTrait;
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
protected BlockIdentifierFlattened $idInfoFlattened;
/** @var bool */
protected $inverted = false;
protected bool $inverted = false;
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->idInfoFlattened = $idInfo;

View File

@ -38,13 +38,9 @@ class Door extends Transparent{
use HorizontalFacingTrait;
use PoweredByRedstoneTrait;
/** @var bool */
protected $top = false;
/** @var bool */
protected $hingeRight = false;
/** @var bool */
protected $open = false;
protected bool $top = false;
protected bool $hingeRight = false;
protected bool $open = false;
protected function writeStateToMeta() : int{
if($this->top){

View File

@ -31,8 +31,7 @@ use pocketmine\world\BlockTransaction;
class DoublePlant extends Flowable{
/** @var bool */
protected $top = false;
protected bool $top = false;
protected function writeStateToMeta() : int{
return ($this->top ? BlockLegacyMetadata::DOUBLE_PLANT_FLAG_TOP : 0);

View File

@ -25,12 +25,9 @@ namespace pocketmine\block;
class Element extends Opaque{
/** @var int */
private $atomicWeight;
/** @var int */
private $group;
/** @var string */
private $symbol;
private int $atomicWeight;
private int $group;
private string $symbol;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, string $symbol, int $atomicWeight, int $group){
parent::__construct($idInfo, $name, $breakInfo);

View File

@ -33,8 +33,7 @@ class EndPortalFrame extends Opaque{
use FacesOppositePlacingPlayerTrait;
use HorizontalFacingTrait;
/** @var bool */
protected $eye = false;
protected bool $eye = false;
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) | ($this->eye ? BlockLegacyMetadata::END_PORTAL_FRAME_FLAG_EYE : 0);

View File

@ -30,8 +30,7 @@ use pocketmine\math\Facing;
class Farmland extends Transparent{
/** @var int */
protected $wetness = 0; //"moisture" blockstate property in PC
protected int $wetness = 0; //"moisture" blockstate property in PC
protected function writeStateToMeta() : int{
return $this->wetness;

View File

@ -30,7 +30,7 @@ use function count;
class Fence extends Transparent{
/** @var bool[] facing => dummy */
protected $connections = [];
protected array $connections = [];
public function getThickness() : float{
return 0.25;

View File

@ -36,10 +36,8 @@ use pocketmine\world\sound\DoorSound;
class FenceGate extends Transparent{
use HorizontalFacingTrait;
/** @var bool */
protected $open = false;
/** @var bool */
protected $inWall = false;
protected bool $open = false;
protected bool $inWall = false;
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) |

View File

@ -37,8 +37,7 @@ use function mt_rand;
class Fire extends Flowable{
/** @var int */
protected $age = 0;
protected int $age = 0;
protected function writeStateToMeta() : int{
return $this->age;

View File

@ -36,8 +36,8 @@ use function atan2;
use function rad2deg;
final class FloorCoralFan extends BaseCoral{
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
protected BlockIdentifierFlattened $idInfoFlattened;
private int $axis = Axis::X;

View File

@ -36,12 +36,9 @@ class FlowerPot extends Flowable{
/**
* TODO: get rid of this hack (it's currently needed to deal with blockfactory state handling)
* @var bool
*/
protected $occupied = false;
/** @var Block|null */
protected $plant = null;
protected bool $occupied = false;
protected ?Block $plant = null;
protected function writeStateToMeta() : int{
return $this->occupied ? BlockLegacyMetadata::FLOWER_POT_FLAG_OCCUPIED : 0;

View File

@ -28,8 +28,7 @@ use function mt_rand;
class FrostedIce extends Ice{
/** @var int */
protected $age = 0;
protected int $age = 0;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->age = BlockDataSerializer::readBoundedInt("age", $stateMeta, 0, 3);

View File

@ -36,11 +36,9 @@ class Furnace extends Opaque{
readStateFromData as readFacingStateFromData;
}
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
protected BlockIdentifierFlattened $idInfoFlattened;
/** @var bool */
protected $lit = false; //this is set based on the blockID
protected bool $lit = false; //this is set based on the blockID
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->idInfoFlattened = $idInfo;

View File

@ -37,8 +37,7 @@ use pocketmine\world\BlockTransaction;
class Hopper extends Transparent{
use PoweredByRedstoneTrait;
/** @var int */
private $facing = Facing::DOWN;
private int $facing = Facing::DOWN;
public function readStateFromData(int $id, int $stateMeta) : void{
$facing = BlockDataSerializer::readFacing($stateMeta & 0x07);

View File

@ -38,14 +38,11 @@ class ItemFrame extends Flowable{
public const ROTATIONS = 8;
/** @var bool */
protected $hasMap = false; //makes frame appear large if set
/** @var Item|null */
protected $framedItem = null;
/** @var int */
protected $itemRotation = 0;
/** @var float */
protected $itemDropChance = 1.0;
protected bool $hasMap = false; //makes frame appear large if set
protected ?Item $framedItem = null;
protected int $itemRotation = 0;
protected float $itemDropChance = 1.0;
protected function writeStateToMeta() : int{
return BlockDataSerializer::write5MinusHorizontalFacing($this->facing) | ($this->hasMap ? BlockLegacyMetadata::ITEM_FRAME_FLAG_HAS_MAP : 0);

View File

@ -32,8 +32,8 @@ use pocketmine\world\sound\RecordSound;
use pocketmine\world\sound\RecordStopSound;
class Jukebox extends Opaque{
/** @var Record|null */
private $record = null;
private ?Record $record = null;
public function getFuelTime() : int{
return 300;

View File

@ -33,8 +33,7 @@ use pocketmine\world\BlockTransaction;
class Lantern extends Transparent{
/** @var bool */
protected $hanging = false;
protected bool $hanging = false;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->hanging = ($stateMeta & BlockLegacyMetadata::LANTERN_FLAG_HANGING) !== 0;

View File

@ -37,13 +37,10 @@ use pocketmine\world\World;
use function mt_rand;
class Leaves extends Transparent{
/** @var TreeType */
protected $treeType;
/** @var bool */
protected $noDecay = false;
/** @var bool */
protected $checkDecay = false;
protected TreeType $treeType;
protected bool $noDecay = false;
protected bool $checkDecay = false;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, TreeType $treeType){
parent::__construct($idInfo, $name, $breakInfo);

View File

@ -38,12 +38,9 @@ class Lever extends Flowable{
protected const SIDE = 1;
protected const TOP = 2;
/** @var int */
protected $leverPos = self::BOTTOM;
/** @var int */
protected $facing = Facing::NORTH;
/** @var bool */
protected $powered = false;
protected int $leverPos = self::BOTTOM;
protected int $facing = Facing::NORTH;
protected bool $powered = false;
protected function writeStateToMeta() : int{
if($this->leverPos === self::BOTTOM){

View File

@ -39,28 +39,23 @@ use function lcg_value;
use function min;
abstract class Liquid extends Transparent{
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
/** @var int */
public $adjacentSources = 0;
protected BlockIdentifierFlattened $idInfoFlattened;
/** @var Vector3|null */
protected $flowVector = null;
public int $adjacentSources = 0;
protected ?Vector3 $flowVector = null;
/** @var int[] */
private $flowCostVisited = [];
private array $flowCostVisited = [];
private const CAN_FLOW_DOWN = 1;
private const CAN_FLOW = 0;
private const BLOCKED = -1;
/** @var bool */
protected $falling = false;
/** @var int */
protected $decay = 0; //PC "level" property
/** @var bool */
protected $still = false;
protected bool $falling = false;
protected int $decay = 0; //PC "level" property
protected bool $still = false;
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->idInfoFlattened = $idInfo;

View File

@ -29,8 +29,8 @@ use pocketmine\math\Axis;
use pocketmine\math\AxisAlignedBB;
class NetherPortal extends Transparent{
/** @var int */
protected $axis = Axis::X;
protected int $axis = Axis::X;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->axis = $stateMeta === BlockLegacyMetadata::NETHER_PORTAL_AXIS_Z ? Axis::Z : Axis::X; //mojang u dumb

View File

@ -29,8 +29,7 @@ use pocketmine\item\VanillaItems;
class NetherReactor extends Opaque{
/** @var int */
protected $state = BlockLegacyMetadata::NETHER_REACTOR_INACTIVE;
protected int $state = BlockLegacyMetadata::NETHER_REACTOR_INACTIVE;
protected function writeStateToMeta() : int{
return $this->state;

View File

@ -34,8 +34,7 @@ use function mt_rand;
class NetherWartPlant extends Flowable{
/** @var int */
protected $age = 0;
protected int $age = 0;
protected function writeStateToMeta() : int{
return $this->age;

View File

@ -30,8 +30,7 @@ class Note extends Opaque{
public const MIN_PITCH = 0;
public const MAX_PITCH = 24;
/** @var int */
private $pitch = self::MIN_PITCH;
private int $pitch = self::MIN_PITCH;
public function readStateFromWorld() : void{
parent::readStateFromWorld();

View File

@ -35,7 +35,7 @@ class RedMushroomBlock extends Opaque{
* the legacy crap for now.
* TODO: change this once proper blockstates are implemented
*/
protected $rotationData = 0;
protected int $rotationData = 0;
protected function writeStateToMeta() : int{
return $this->rotationData;

View File

@ -41,11 +41,9 @@ class RedstoneComparator extends Flowable{
use AnalogRedstoneSignalEmitterTrait;
use PoweredByRedstoneTrait;
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
protected BlockIdentifierFlattened $idInfoFlattened;
/** @var bool */
protected $isSubtractMode = false;
protected bool $isSubtractMode = false;
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->idInfoFlattened = $idInfo;

View File

@ -28,8 +28,7 @@ use pocketmine\block\utils\PoweredByRedstoneTrait;
class RedstoneLamp extends Opaque{
use PoweredByRedstoneTrait;
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
protected BlockIdentifierFlattened $idInfoFlattened;
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->idInfoFlattened = $idInfo;

View File

@ -30,11 +30,10 @@ use pocketmine\player\Player;
use function mt_rand;
class RedstoneOre extends Opaque{
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
/** @var bool */
protected $lit = false;
protected BlockIdentifierFlattened $idInfoFlattened;
protected bool $lit = false;
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->idInfoFlattened = $idInfo;

View File

@ -37,11 +37,9 @@ class RedstoneRepeater extends Flowable{
use HorizontalFacingTrait;
use PoweredByRedstoneTrait;
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
protected BlockIdentifierFlattened $idInfoFlattened;
/** @var int */
protected $delay = 1;
protected int $delay = 1;
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->idInfoFlattened = $idInfo;

View File

@ -25,11 +25,9 @@ namespace pocketmine\block;
class RedstoneTorch extends Torch{
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
protected BlockIdentifierFlattened $idInfoFlattened;
/** @var bool */
protected $lit = true;
protected bool $lit = true;
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->idInfoFlattened = $idInfo;

View File

@ -36,10 +36,9 @@ use function mt_rand;
class Sapling extends Flowable{
/** @var bool */
protected $ready = false;
/** @var TreeType */
private $treeType;
protected bool $ready = false;
private TreeType $treeType;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, TreeType $treeType){
parent::__construct($idInfo, $name, $breakInfo);

View File

@ -30,10 +30,9 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class SeaPickle extends Transparent{
/** @var int */
protected $count = 1;
/** @var bool */
protected $underwater = false;
protected int $count = 1;
protected bool $underwater = false;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->count = ($stateMeta & 0x03) + 1;

View File

@ -25,8 +25,7 @@ namespace pocketmine\block;
abstract class SimplePressurePlate extends PressurePlate{
/** @var bool */
protected $pressed = false;
protected bool $pressed = false;
protected function writeStateToMeta() : int{
return $this->pressed ? BlockLegacyMetadata::PRESSURE_PLATE_FLAG_POWERED : 0;

View File

@ -39,16 +39,12 @@ use function assert;
use function floor;
class Skull extends Flowable{
/** @var SkullType */
protected $skullType;
/** @var int */
protected $facing = Facing::NORTH;
protected SkullType $skullType;
protected int $facing = Facing::NORTH;
protected bool $noDrops = false;
/** @var int */
protected $rotation = 0; //TODO: split this into floor skull and wall skull handling
protected int $rotation = 0; //TODO: split this into floor skull and wall skull handling
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->skullType = SkullType::SKELETON(); //TODO: this should be a parameter

View File

@ -32,11 +32,10 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class Slab extends Transparent{
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
/** @var SlabType */
protected $slabType;
protected BlockIdentifierFlattened $idInfoFlattened;
protected SlabType $slabType;
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->idInfoFlattened = $idInfo;

View File

@ -39,8 +39,7 @@ use function max;
class SnowLayer extends Flowable implements Fallable{
use FallableTrait;
/** @var int */
protected $layers = 1;
protected int $layers = 1;
protected function writeStateToMeta() : int{
return $this->layers - 1;

View File

@ -25,8 +25,7 @@ namespace pocketmine\block;
class Sponge extends Opaque{
/** @var bool */
protected $wet = false;
protected bool $wet = false;
protected function writeStateToMeta() : int{
return $this->wet ? BlockLegacyMetadata::SPONGE_FLAG_WET : 0;

View File

@ -36,11 +36,8 @@ use pocketmine\world\BlockTransaction;
class Stair extends Transparent{
use HorizontalFacingTrait;
/** @var bool */
protected $upsideDown = false;
/** @var StairShape */
protected $shape;
protected bool $upsideDown = false;
protected StairShape $shape;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->shape = StairShape::STRAIGHT();

View File

@ -34,8 +34,7 @@ use pocketmine\world\BlockTransaction;
class Sugarcane extends Flowable{
/** @var int */
protected $age = 0;
protected int $age = 0;
protected function writeStateToMeta() : int{
return $this->age;

View File

@ -41,8 +41,7 @@ use const M_PI;
class TNT extends Opaque{
/** @var bool */
protected $unstable = false; //TODO: Usage unclear, seems to be a weird hack in vanilla
protected bool $unstable = false; //TODO: Usage unclear, seems to be a weird hack in vanilla
protected bool $worksUnderwater = false;
public function readStateFromData(int $id, int $stateMeta) : void{

View File

@ -30,7 +30,7 @@ use function count;
class Thin extends Transparent{
/** @var bool[] facing => dummy */
protected $connections = [];
protected array $connections = [];
public function readStateFromWorld() : void{
parent::readStateFromWorld();

View File

@ -32,8 +32,7 @@ use pocketmine\world\BlockTransaction;
class Torch extends Flowable{
/** @var int */
protected $facing = Facing::UP;
protected int $facing = Facing::UP;
protected function writeStateToMeta() : int{
return $this->facing === Facing::UP ? 5 : 6 - BlockDataSerializer::writeHorizontalFacing($this->facing);

View File

@ -36,10 +36,8 @@ use pocketmine\world\sound\DoorSound;
class Trapdoor extends Transparent{
use HorizontalFacingTrait;
/** @var bool */
protected $open = false;
/** @var bool */
protected $top = false;
protected bool $open = false;
protected bool $top = false;
protected function writeStateToMeta() : int{
return BlockDataSerializer::write5MinusHorizontalFacing($this->facing) | ($this->top ? BlockLegacyMetadata::TRAPDOOR_FLAG_UPPER : 0) | ($this->open ? BlockLegacyMetadata::TRAPDOOR_FLAG_OPEN : 0);

View File

@ -25,14 +25,10 @@ namespace pocketmine\block;
class Tripwire extends Flowable{
/** @var bool */
protected $triggered = false;
/** @var bool */
protected $suspended = false; //unclear usage, makes hitbox bigger if set
/** @var bool */
protected $connected = false;
/** @var bool */
protected $disarmed = false;
protected bool $triggered = false;
protected bool $suspended = false; //unclear usage, makes hitbox bigger if set
protected bool $connected = false;
protected bool $disarmed = false;
protected function writeStateToMeta() : int{
return ($this->triggered ? BlockLegacyMetadata::TRIPWIRE_FLAG_TRIGGERED : 0) |

View File

@ -35,10 +35,8 @@ use pocketmine\world\BlockTransaction;
class TripwireHook extends Flowable{
use HorizontalFacingTrait;
/** @var bool */
protected $connected = false;
/** @var bool */
protected $powered = false;
protected bool $connected = false;
protected bool $powered = false;
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) |

View File

@ -36,7 +36,7 @@ use function count;
class Vine extends Flowable{
/** @var int[] */
protected $faces = [];
protected array $faces = [];
protected function writeStateToMeta() : int{
return

View File

@ -29,9 +29,8 @@ use pocketmine\math\Facing;
class Wall extends Transparent{
/** @var int[] facing => facing */
protected $connections = [];
/** @var bool */
protected $up = false;
protected array $connections = [];
protected bool $up = false;
public function readStateFromWorld() : void{
parent::readStateFromWorld();

View File

@ -41,8 +41,7 @@ use pocketmine\world\BlockTransaction;
final class WallCoralFan extends BaseCoral{
use HorizontalFacingTrait;
/** @var BlockIdentifierFlattened */
protected $idInfoFlattened;
protected BlockIdentifierFlattened $idInfoFlattened;
public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->idInfoFlattened = $idInfo;

View File

@ -30,8 +30,7 @@ use pocketmine\player\Player;
class Wood extends Opaque{
/** @var TreeType */
private $treeType;
private TreeType $treeType;
private bool $stripped;