From 83af4dcd5955db5249867b41b40b44dbccc5bcb3 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 17 Aug 2017 13:50:19 +0100 Subject: [PATCH] Block API typehints --- src/pocketmine/block/ActivatorRail.php | 2 +- src/pocketmine/block/Air.php | 20 ++--- src/pocketmine/block/Anvil.php | 18 ++--- src/pocketmine/block/Bed.php | 12 +-- src/pocketmine/block/Bedrock.php | 10 +-- src/pocketmine/block/Beetroot.php | 4 +- src/pocketmine/block/Block.php | 76 +++++++++---------- src/pocketmine/block/Bookshelf.php | 8 +- src/pocketmine/block/BrewingStand.php | 8 +- src/pocketmine/block/BrickStairs.php | 10 +-- src/pocketmine/block/Bricks.php | 10 +-- src/pocketmine/block/BrownMushroom.php | 10 +-- src/pocketmine/block/BurningFurnace.php | 14 ++-- src/pocketmine/block/Cactus.php | 12 +-- src/pocketmine/block/Cake.php | 12 +-- src/pocketmine/block/Carpet.php | 12 +-- src/pocketmine/block/Carrot.php | 4 +- src/pocketmine/block/Chest.php | 14 ++-- src/pocketmine/block/Clay.php | 8 +- src/pocketmine/block/Coal.php | 8 +- src/pocketmine/block/CoalOre.php | 8 +- src/pocketmine/block/Cobblestone.php | 8 +- src/pocketmine/block/CobblestoneStairs.php | 8 +- src/pocketmine/block/CobblestoneWall.php | 10 +-- src/pocketmine/block/Cobweb.php | 10 +-- src/pocketmine/block/CocoaBlock.php | 4 +- src/pocketmine/block/CraftingTable.php | 10 +-- src/pocketmine/block/Crops.php | 6 +- src/pocketmine/block/Dandelion.php | 8 +- src/pocketmine/block/DaylightSensor.php | 6 +- src/pocketmine/block/DeadBush.php | 6 +- src/pocketmine/block/DetectorRail.php | 2 +- src/pocketmine/block/Diamond.php | 8 +- src/pocketmine/block/DiamondOre.php | 8 +- src/pocketmine/block/Dirt.php | 10 +-- src/pocketmine/block/Door.php | 10 +-- src/pocketmine/block/DoublePlant.php | 12 +-- src/pocketmine/block/DoubleStoneSlab.php | 8 +- src/pocketmine/block/DoubleWoodenSlab.php | 8 +- src/pocketmine/block/Emerald.php | 8 +- src/pocketmine/block/EmeraldOre.php | 8 +- src/pocketmine/block/EnchantingTable.php | 14 ++-- src/pocketmine/block/EndPortalFrame.php | 12 +-- src/pocketmine/block/EndStone.php | 8 +- src/pocketmine/block/Fallable.php | 2 +- src/pocketmine/block/Farmland.php | 8 +- src/pocketmine/block/Fence.php | 8 +- src/pocketmine/block/FenceGate.php | 8 +- src/pocketmine/block/Fire.php | 14 ++-- src/pocketmine/block/Flowable.php | 8 +- src/pocketmine/block/Flower.php | 8 +- src/pocketmine/block/FlowerPot.php | 10 +-- src/pocketmine/block/Furnace.php | 4 +- src/pocketmine/block/Glass.php | 6 +- src/pocketmine/block/GlassPane.php | 6 +- src/pocketmine/block/GlazedTerracotta.php | 6 +- src/pocketmine/block/GlowingObsidian.php | 6 +- src/pocketmine/block/GlowingRedstoneOre.php | 6 +- src/pocketmine/block/Glowstone.php | 10 +-- src/pocketmine/block/Gold.php | 8 +- src/pocketmine/block/GoldOre.php | 8 +- src/pocketmine/block/Grass.php | 12 +-- src/pocketmine/block/GrassPath.php | 8 +- src/pocketmine/block/Gravel.php | 8 +- src/pocketmine/block/HardenedClay.php | 8 +- src/pocketmine/block/HayBale.php | 8 +- src/pocketmine/block/Ice.php | 12 +-- src/pocketmine/block/Iron.php | 8 +- src/pocketmine/block/IronBars.php | 8 +- src/pocketmine/block/IronDoor.php | 8 +- src/pocketmine/block/IronOre.php | 8 +- src/pocketmine/block/IronTrapdoor.php | 6 +- src/pocketmine/block/ItemFrame.php | 12 +-- src/pocketmine/block/Ladder.php | 16 ++-- src/pocketmine/block/Lapis.php | 8 +- src/pocketmine/block/LapisOre.php | 8 +- src/pocketmine/block/Lava.php | 8 +- src/pocketmine/block/Leaves.php | 14 ++-- src/pocketmine/block/Leaves2.php | 2 +- src/pocketmine/block/Lever.php | 4 +- src/pocketmine/block/Liquid.php | 12 +-- src/pocketmine/block/LitPumpkin.php | 4 +- src/pocketmine/block/LitRedstoneLamp.php | 4 +- src/pocketmine/block/Melon.php | 8 +- src/pocketmine/block/MelonStem.php | 6 +- src/pocketmine/block/MonsterSpawner.php | 8 +- src/pocketmine/block/MossyCobblestone.php | 8 +- src/pocketmine/block/Mycelium.php | 10 +-- src/pocketmine/block/NetherBrick.php | 8 +- src/pocketmine/block/NetherBrickFence.php | 8 +- src/pocketmine/block/NetherBrickStairs.php | 8 +- src/pocketmine/block/NetherReactor.php | 8 +- src/pocketmine/block/NetherWartPlant.php | 6 +- src/pocketmine/block/Netherrack.php | 8 +- src/pocketmine/block/NoteBlock.php | 4 +- src/pocketmine/block/Obsidian.php | 8 +- src/pocketmine/block/PackedIce.php | 8 +- src/pocketmine/block/Planks.php | 8 +- src/pocketmine/block/Podzol.php | 8 +- src/pocketmine/block/Potato.php | 4 +- src/pocketmine/block/PoweredRail.php | 2 +- src/pocketmine/block/Prismarine.php | 8 +- src/pocketmine/block/Pumpkin.php | 10 +-- src/pocketmine/block/PumpkinStem.php | 6 +- src/pocketmine/block/Quartz.php | 8 +- src/pocketmine/block/QuartzStairs.php | 8 +- src/pocketmine/block/Rail.php | 10 +-- src/pocketmine/block/RedMushroom.php | 8 +- src/pocketmine/block/Redstone.php | 8 +- src/pocketmine/block/RedstoneLamp.php | 6 +- src/pocketmine/block/RedstoneOre.php | 12 +-- src/pocketmine/block/RedstoneTorch.php | 4 +- src/pocketmine/block/RedstoneTorchUnlit.php | 4 +- src/pocketmine/block/Sand.php | 8 +- src/pocketmine/block/Sandstone.php | 8 +- src/pocketmine/block/SandstoneStairs.php | 8 +- src/pocketmine/block/Sapling.php | 10 +-- src/pocketmine/block/SeaLantern.php | 8 +- src/pocketmine/block/SignPost.php | 14 ++-- src/pocketmine/block/Skull.php | 8 +- src/pocketmine/block/Snow.php | 8 +- src/pocketmine/block/SnowLayer.php | 14 ++-- src/pocketmine/block/Solid.php | 2 +- src/pocketmine/block/SoulSand.php | 8 +- src/pocketmine/block/Sponge.php | 6 +- src/pocketmine/block/StainedClay.php | 8 +- src/pocketmine/block/Stair.php | 2 +- src/pocketmine/block/StillLava.php | 2 +- src/pocketmine/block/StillWater.php | 2 +- src/pocketmine/block/Stone.php | 8 +- src/pocketmine/block/StoneBrickStairs.php | 8 +- src/pocketmine/block/StoneBricks.php | 8 +- src/pocketmine/block/StoneButton.php | 6 +- src/pocketmine/block/StonePressurePlate.php | 8 +- src/pocketmine/block/StoneSlab.php | 6 +- src/pocketmine/block/Stonecutter.php | 6 +- src/pocketmine/block/Sugarcane.php | 10 +-- src/pocketmine/block/TNT.php | 8 +- src/pocketmine/block/TallGrass.php | 10 +-- src/pocketmine/block/Thin.php | 2 +- src/pocketmine/block/Torch.php | 10 +-- src/pocketmine/block/Transparent.php | 2 +- src/pocketmine/block/Trapdoor.php | 12 +-- src/pocketmine/block/TrappedChest.php | 2 +- src/pocketmine/block/Tripwire.php | 4 +- src/pocketmine/block/TripwireHook.php | 4 +- src/pocketmine/block/UnknownBlock.php | 2 +- src/pocketmine/block/Vine.php | 18 ++--- src/pocketmine/block/WallSign.php | 4 +- src/pocketmine/block/Water.php | 6 +- src/pocketmine/block/WaterLily.php | 10 +-- .../block/WeightedPressurePlateHeavy.php | 2 +- .../block/WeightedPressurePlateLight.php | 8 +- src/pocketmine/block/Wheat.php | 4 +- src/pocketmine/block/Wood.php | 10 +-- src/pocketmine/block/Wood2.php | 2 +- src/pocketmine/block/WoodenButton.php | 2 +- src/pocketmine/block/WoodenDoor.php | 4 +- src/pocketmine/block/WoodenPressurePlate.php | 2 +- src/pocketmine/block/WoodenSlab.php | 10 +-- src/pocketmine/block/WoodenStairs.php | 6 +- src/pocketmine/block/Wool.php | 8 +- 162 files changed, 665 insertions(+), 667 deletions(-) diff --git a/src/pocketmine/block/ActivatorRail.php b/src/pocketmine/block/ActivatorRail.php index 65bdddeb1..56e8a9979 100644 --- a/src/pocketmine/block/ActivatorRail.php +++ b/src/pocketmine/block/ActivatorRail.php @@ -27,7 +27,7 @@ class ActivatorRail extends Rail{ protected $id = self::ACTIVATOR_RAIL; - public function getName(){ + public function getName() : string{ return "Activator Rail"; } } diff --git a/src/pocketmine/block/Air.php b/src/pocketmine/block/Air.php index 21ec6ed84..e8f519a96 100644 --- a/src/pocketmine/block/Air.php +++ b/src/pocketmine/block/Air.php @@ -34,35 +34,35 @@ class Air extends Transparent{ protected $id = self::AIR; protected $meta = 0; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Air"; } - public function canPassThrough(){ + public function canPassThrough() : bool{ return true; } - public function isBreakable(Item $item){ + public function isBreakable(Item $item) : bool{ return false; } - public function canBeFlowedInto(){ + public function canBeFlowedInto() : bool{ return true; } - public function canBeReplaced(){ + public function canBeReplaced() : bool{ return true; } - public function canBePlaced(){ + public function canBePlaced() : bool{ return false; } - public function isSolid(){ + public function isSolid() : bool{ return false; } @@ -70,11 +70,11 @@ class Air extends Transparent{ return null; } - public function getHardness(){ + public function getHardness() : float{ return -1; } - public function getResistance(){ + public function getResistance() : float{ return 0; } diff --git a/src/pocketmine/block/Anvil.php b/src/pocketmine/block/Anvil.php index 28e349769..e89c67916 100644 --- a/src/pocketmine/block/Anvil.php +++ b/src/pocketmine/block/Anvil.php @@ -36,23 +36,23 @@ class Anvil extends Fallable{ protected $id = self::ANVIL; - public function isSolid(){ + public function isSolid() : bool{ return false; } - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 5; } - public function getResistance(){ + public function getResistance() : float{ return 6000; } - public function getName(){ + public function getName() : string{ static $names = [ self::TYPE_NORMAL => "Anvil", self::TYPE_SLIGHTLY_DAMAGED => "Slightly Damaged Anvil", @@ -61,11 +61,11 @@ class Anvil extends Fallable{ return $names[$this->meta & 0x0c] ?? "Anvil"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($player instanceof Player){ $player->addWindow(new AnvilInventory($this)); } @@ -73,10 +73,10 @@ class Anvil extends Fallable{ return true; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $direction = ($player !== null ? $player->getDirection() : 0) & 0x03; $this->meta = ($this->meta & 0x0c) | $direction; - $this->getLevel()->setBlock($block, $this, true, true); + return $this->getLevel()->setBlock($block, $this, true, true); } public function getDrops(Item $item){ diff --git a/src/pocketmine/block/Bed.php b/src/pocketmine/block/Bed.php index 11e202b1a..0bec31d3d 100644 --- a/src/pocketmine/block/Bed.php +++ b/src/pocketmine/block/Bed.php @@ -43,15 +43,15 @@ class Bed extends Transparent{ protected $id = self::BED_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.2; } - public function getName(){ + public function getName() : string{ return "Bed Block"; } @@ -135,7 +135,7 @@ class Bed extends Transparent{ return null; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($player !== null){ $other = $this->getOtherHalf(); if($other === null){ @@ -172,7 +172,7 @@ class Bed extends Transparent{ } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if(!$down->isTransparent()){ $meta = (($player instanceof Player ? $player->getDirection() : 0) - 1) & 0x03; @@ -203,7 +203,7 @@ class Bed extends Transparent{ return false; } - public function onBreak(Item $item){ + public function onBreak(Item $item) : bool{ $this->getLevel()->setBlock($this, Block::get(Block::AIR), true, true); if(($other = $this->getOtherHalf()) !== null){ $this->getLevel()->useBreakOn($other); //make sure tiles get removed diff --git a/src/pocketmine/block/Bedrock.php b/src/pocketmine/block/Bedrock.php index 1196f99ec..aa3d21ef1 100644 --- a/src/pocketmine/block/Bedrock.php +++ b/src/pocketmine/block/Bedrock.php @@ -29,23 +29,23 @@ class Bedrock extends Solid{ protected $id = self::BEDROCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Bedrock"; } - public function getHardness(){ + public function getHardness() : float{ return -1; } - public function getResistance(){ + public function getResistance() : float{ return 18000000; } - public function isBreakable(Item $item){ + public function isBreakable(Item $item) : bool{ return false; } diff --git a/src/pocketmine/block/Beetroot.php b/src/pocketmine/block/Beetroot.php index 0cecf9e00..b1de667e3 100644 --- a/src/pocketmine/block/Beetroot.php +++ b/src/pocketmine/block/Beetroot.php @@ -29,11 +29,11 @@ class Beetroot extends Crops{ protected $id = self::BEETROOT_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Beetroot Block"; } diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 7663737cd..027955ffc 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -375,7 +375,7 @@ class Block extends Position implements BlockIds, Metadatable{ * * @return Block */ - public static function get($id, $meta = 0, Position $pos = null){ + public static function get(int $id, int $meta = 0, Position $pos = null) : Block{ try{ $block = self::$fullList[($id << 4) | $meta]; if($block !== null){ @@ -425,14 +425,14 @@ class Block extends Position implements BlockIds, Metadatable{ /** * @return string */ - public function getName(){ + public function getName() : string{ return $this->fallbackName; } /** * @return int */ - final public function getId(){ + final public function getId() : int{ return $this->id; } @@ -449,32 +449,32 @@ class Block extends Position implements BlockIds, Metadatable{ /** * @return int */ - final public function getDamage(){ + final public function getDamage() : int{ return $this->meta; } /** * @param int $meta */ - final public function setDamage($meta){ + final public function setDamage(int $meta){ $this->meta = $meta & 0x0f; } /** * Places the Block, using block space and block target, and side. Returns if the block has been placed. * - * @param Item $item - * @param Block $block - * @param Block $target - * @param int $face - * @param float $fx - * @param float $fy - * @param float $fz - * @param Player $player = null + * @param Item $item + * @param Block $block + * @param Block $target + * @param int $face + * @param float $fx + * @param float $fy + * @param float $fz + * @param Player|null $player * * @return bool */ - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ return $this->getLevel()->setBlock($this, $this, true, true); } @@ -485,7 +485,7 @@ class Block extends Position implements BlockIds, Metadatable{ * * @return bool */ - public function isBreakable(Item $item){ + public function isBreakable(Item $item) : bool{ return true; } @@ -494,9 +494,9 @@ class Block extends Position implements BlockIds, Metadatable{ * * @param Item $item * - * @return mixed + * @return bool */ - public function onBreak(Item $item){ + public function onBreak(Item $item) : bool{ return $this->getLevel()->setBlock($this, new Air(), true, true); } @@ -505,56 +505,56 @@ class Block extends Position implements BlockIds, Metadatable{ * * @param int $type * - * @return int|bool + * @return bool|int */ - public function onUpdate($type){ + public function onUpdate(int $type){ return false; } /** * Do actions when activated by Item. Returns if it has done anything * - * @param Item $item - * @param Player $player + * @param Item $item + * @param Player|null $player * * @return bool */ - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ return false; } /** * @return float */ - public function getHardness(){ + public function getHardness() : float{ return 10; } /** * @return float */ - public function getResistance(){ + public function getResistance() : float{ return $this->getHardness() * 5; } /** * @return int */ - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_NONE; } /** * @return float */ - public function getFrictionFactor(){ + public function getFrictionFactor() : float{ return 0.6; } /** * @return int 0-15 */ - public function getLightLevel(){ + public function getLightLevel() : int{ return 0; } @@ -583,45 +583,43 @@ class Block extends Position implements BlockIds, Metadatable{ /** * AKA: Block->isPlaceable - * * @return bool */ - public function canBePlaced(){ + public function canBePlaced() : bool{ return true; } /** * @return bool */ - public function canBeReplaced(){ + public function canBeReplaced() : bool{ return false; } /** * @return bool */ - public function isTransparent(){ + public function isTransparent() : bool{ return false; } - public function isSolid(){ + public function isSolid() : bool{ return true; } /** * AKA: Block->isFlowable - * * @return bool */ - public function canBeFlowedInto(){ + public function canBeFlowedInto() : bool{ return false; } - public function hasEntityCollision(){ + public function hasEntityCollision() : bool{ return false; } - public function canPassThrough(){ + public function canPassThrough() : bool{ return false; } @@ -671,7 +669,7 @@ class Block extends Position implements BlockIds, Metadatable{ * * @return float */ - public function getBreakTime(Item $item){ + public function getBreakTime(Item $item) : float{ $base = $this->getHardness() * 1.5; if($this->canBeBrokenWith($item)){ if($this->getToolType() === Tool::TYPE_SHEARS and $item->isShears()){ @@ -710,7 +708,7 @@ class Block extends Position implements BlockIds, Metadatable{ return $base; } - public function canBeBrokenWith(Item $item){ + public function canBeBrokenWith(Item $item) : bool{ return $this->getHardness() !== -1; } @@ -752,7 +750,7 @@ class Block extends Position implements BlockIds, Metadatable{ * * @return bool */ - public function collidesWithBB(AxisAlignedBB $bb){ + public function collidesWithBB(AxisAlignedBB $bb) : bool{ $bb2 = $this->getBoundingBox(); return $bb2 !== null and $bb->intersectsWith($bb2); diff --git a/src/pocketmine/block/Bookshelf.php b/src/pocketmine/block/Bookshelf.php index c110baf21..9a12f7797 100644 --- a/src/pocketmine/block/Bookshelf.php +++ b/src/pocketmine/block/Bookshelf.php @@ -30,19 +30,19 @@ class Bookshelf extends Solid{ protected $id = self::BOOKSHELF; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Bookshelf"; } - public function getHardness(){ + public function getHardness() : float{ return 1.5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } diff --git a/src/pocketmine/block/BrewingStand.php b/src/pocketmine/block/BrewingStand.php index 36d688f01..329f71d61 100644 --- a/src/pocketmine/block/BrewingStand.php +++ b/src/pocketmine/block/BrewingStand.php @@ -29,19 +29,19 @@ class BrewingStand extends Transparent{ protected $id = self::BREWING_STAND_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Brewing Stand"; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } } \ No newline at end of file diff --git a/src/pocketmine/block/BrickStairs.php b/src/pocketmine/block/BrickStairs.php index 87e94afca..b5669e381 100644 --- a/src/pocketmine/block/BrickStairs.php +++ b/src/pocketmine/block/BrickStairs.php @@ -29,23 +29,23 @@ class BrickStairs extends Stair{ protected $id = self::BRICK_STAIRS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getResistance(){ + public function getResistance() : float{ return 30; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Brick Stairs"; } diff --git a/src/pocketmine/block/Bricks.php b/src/pocketmine/block/Bricks.php index 4eb22d928..ff90619eb 100644 --- a/src/pocketmine/block/Bricks.php +++ b/src/pocketmine/block/Bricks.php @@ -30,23 +30,23 @@ class Bricks extends Solid{ protected $id = self::BRICK_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getResistance(){ + public function getResistance() : float{ return 30; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Bricks"; } diff --git a/src/pocketmine/block/BrownMushroom.php b/src/pocketmine/block/BrownMushroom.php index f82ba5913..ff03f18fd 100644 --- a/src/pocketmine/block/BrownMushroom.php +++ b/src/pocketmine/block/BrownMushroom.php @@ -32,19 +32,19 @@ class BrownMushroom extends Flowable{ protected $id = self::BROWN_MUSHROOM; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Brown Mushroom"; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 1; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){ $this->getLevel()->useBreakOn($this); @@ -56,7 +56,7 @@ class BrownMushroom extends Flowable{ return false; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->isTransparent() === false){ $this->getLevel()->setBlock($block, $this, true, true); diff --git a/src/pocketmine/block/BurningFurnace.php b/src/pocketmine/block/BurningFurnace.php index e3075b049..ddc2b91f5 100644 --- a/src/pocketmine/block/BurningFurnace.php +++ b/src/pocketmine/block/BurningFurnace.php @@ -38,27 +38,27 @@ class BurningFurnace extends Solid{ protected $id = self::BURNING_FURNACE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Burning Furnace"; } - public function getHardness(){ + public function getHardness() : float{ return 3.5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 13; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $faces = [ 0 => 4, 1 => 2, @@ -91,7 +91,7 @@ class BurningFurnace extends Solid{ return true; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($player instanceof Player){ $furnace = $this->getLevel()->getTile($this); if(!($furnace instanceof TileFurnace)){ diff --git a/src/pocketmine/block/Cactus.php b/src/pocketmine/block/Cactus.php index 1402dc984..490330237 100644 --- a/src/pocketmine/block/Cactus.php +++ b/src/pocketmine/block/Cactus.php @@ -38,19 +38,19 @@ class Cactus extends Transparent{ protected $id = self::CACTUS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.4; } - public function hasEntityCollision(){ + public function hasEntityCollision() : bool{ return true; } - public function getName(){ + public function getName() : string{ return "Cactus"; } @@ -71,7 +71,7 @@ class Cactus extends Transparent{ $entity->attack($ev->getFinalDamage(), $ev); } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() !== self::SAND and $down->getId() !== self::CACTUS){ @@ -108,7 +108,7 @@ class Cactus extends Transparent{ return false; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === self::SAND or $down->getId() === self::CACTUS){ $block0 = $this->getSide(Vector3::SIDE_NORTH); diff --git a/src/pocketmine/block/Cake.php b/src/pocketmine/block/Cake.php index 390373913..40f254e2b 100644 --- a/src/pocketmine/block/Cake.php +++ b/src/pocketmine/block/Cake.php @@ -36,15 +36,15 @@ class Cake extends Transparent implements FoodSource{ protected $id = self::CAKE_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } - public function getName(){ + public function getName() : string{ return "Cake Block"; } @@ -62,7 +62,7 @@ class Cake extends Transparent implements FoodSource{ ); } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() !== self::AIR){ $this->getLevel()->setBlock($block, $this, true, true); @@ -73,7 +73,7 @@ class Cake extends Transparent implements FoodSource{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method $this->getLevel()->setBlock($this, new Air(), true); @@ -89,7 +89,7 @@ class Cake extends Transparent implements FoodSource{ return []; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($player instanceof Player and $player->getHealth() < $player->getMaxHealth()){ $ev = new EntityEatBlockEvent($player, $this); diff --git a/src/pocketmine/block/Carpet.php b/src/pocketmine/block/Carpet.php index 08ada6a6a..edd54ae79 100644 --- a/src/pocketmine/block/Carpet.php +++ b/src/pocketmine/block/Carpet.php @@ -34,19 +34,19 @@ class Carpet extends Flowable{ protected $id = self::CARPET; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.1; } - public function isSolid(){ + public function isSolid() : bool{ return true; } - public function getName(){ + public function getName() : string{ return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Carpet"; } @@ -62,7 +62,7 @@ class Carpet extends Flowable{ ); } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() !== self::AIR){ $this->getLevel()->setBlock($block, $this, true, true); @@ -73,7 +73,7 @@ class Carpet extends Flowable{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ $this->getLevel()->useBreakOn($this); diff --git a/src/pocketmine/block/Carrot.php b/src/pocketmine/block/Carrot.php index 2e13d5bb2..a9acbc11c 100644 --- a/src/pocketmine/block/Carrot.php +++ b/src/pocketmine/block/Carrot.php @@ -29,11 +29,11 @@ class Carrot extends Crops{ protected $id = self::CARROT_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Carrot Block"; } diff --git a/src/pocketmine/block/Chest.php b/src/pocketmine/block/Chest.php index e2b7688f6..b68864717 100644 --- a/src/pocketmine/block/Chest.php +++ b/src/pocketmine/block/Chest.php @@ -40,19 +40,19 @@ class Chest extends Transparent{ protected $id = self::CHEST; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2.5; } - public function getName(){ + public function getName() : string{ return "Chest"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } @@ -67,7 +67,7 @@ class Chest extends Transparent{ ); } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $faces = [ 0 => 4, 1 => 2, @@ -124,7 +124,7 @@ class Chest extends Transparent{ return true; } - public function onBreak(Item $item){ + public function onBreak(Item $item) : bool{ $t = $this->getLevel()->getTile($this); if($t instanceof TileChest){ $t->unpair(); @@ -134,7 +134,7 @@ class Chest extends Transparent{ return true; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($player instanceof Player){ $top = $this->getSide(Vector3::SIDE_UP); if($top->isTransparent() !== true){ diff --git a/src/pocketmine/block/Clay.php b/src/pocketmine/block/Clay.php index 989b20d52..3afb17a5f 100644 --- a/src/pocketmine/block/Clay.php +++ b/src/pocketmine/block/Clay.php @@ -30,19 +30,19 @@ class Clay extends Solid{ protected $id = self::CLAY_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.6; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } - public function getName(){ + public function getName() : string{ return "Clay Block"; } diff --git a/src/pocketmine/block/Coal.php b/src/pocketmine/block/Coal.php index c0262577a..46b50dc17 100644 --- a/src/pocketmine/block/Coal.php +++ b/src/pocketmine/block/Coal.php @@ -30,19 +30,19 @@ class Coal extends Solid{ protected $id = self::COAL_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Coal Block"; } diff --git a/src/pocketmine/block/CoalOre.php b/src/pocketmine/block/CoalOre.php index d6342c671..2ba2b6209 100644 --- a/src/pocketmine/block/CoalOre.php +++ b/src/pocketmine/block/CoalOre.php @@ -30,19 +30,19 @@ class CoalOre extends Solid{ protected $id = self::COAL_ORE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 3; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Coal Ore"; } diff --git a/src/pocketmine/block/Cobblestone.php b/src/pocketmine/block/Cobblestone.php index c5376b5c0..df6d0ae64 100644 --- a/src/pocketmine/block/Cobblestone.php +++ b/src/pocketmine/block/Cobblestone.php @@ -30,19 +30,19 @@ class Cobblestone extends Solid{ protected $id = self::COBBLESTONE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Cobblestone"; } - public function getHardness(){ + public function getHardness() : float{ return 2; } diff --git a/src/pocketmine/block/CobblestoneStairs.php b/src/pocketmine/block/CobblestoneStairs.php index c13783a7e..2e6b429ef 100644 --- a/src/pocketmine/block/CobblestoneStairs.php +++ b/src/pocketmine/block/CobblestoneStairs.php @@ -29,19 +29,19 @@ class CobblestoneStairs extends Stair{ protected $id = self::COBBLESTONE_STAIRS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Cobblestone Stairs"; } diff --git a/src/pocketmine/block/CobblestoneWall.php b/src/pocketmine/block/CobblestoneWall.php index ff918482d..589b8a691 100644 --- a/src/pocketmine/block/CobblestoneWall.php +++ b/src/pocketmine/block/CobblestoneWall.php @@ -33,23 +33,23 @@ class CobblestoneWall extends Transparent{ protected $id = self::COBBLESTONE_WALL; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function isSolid(){ + public function isSolid() : bool{ return false; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getName(){ + public function getName() : string{ if($this->meta === 0x01){ return "Mossy Cobblestone Wall"; } diff --git a/src/pocketmine/block/Cobweb.php b/src/pocketmine/block/Cobweb.php index 3d2fc189c..70c2163fb 100644 --- a/src/pocketmine/block/Cobweb.php +++ b/src/pocketmine/block/Cobweb.php @@ -31,23 +31,23 @@ class Cobweb extends Flowable{ protected $id = self::COBWEB; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function hasEntityCollision(){ + public function hasEntityCollision() : bool{ return true; } - public function getName(){ + public function getName() : string{ return "Cobweb"; } - public function getHardness(){ + public function getHardness() : float{ return 4; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SWORD; } diff --git a/src/pocketmine/block/CocoaBlock.php b/src/pocketmine/block/CocoaBlock.php index f3b8cafb3..74c349dd9 100644 --- a/src/pocketmine/block/CocoaBlock.php +++ b/src/pocketmine/block/CocoaBlock.php @@ -27,11 +27,11 @@ class CocoaBlock extends Solid{ protected $id = self::COCOA_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Cocoa Block"; } } diff --git a/src/pocketmine/block/CraftingTable.php b/src/pocketmine/block/CraftingTable.php index 658659050..797ef4ee4 100644 --- a/src/pocketmine/block/CraftingTable.php +++ b/src/pocketmine/block/CraftingTable.php @@ -31,23 +31,23 @@ class CraftingTable extends Solid{ protected $id = self::CRAFTING_TABLE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2.5; } - public function getName(){ + public function getName() : string{ return "Crafting Table"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($player instanceof Player){ $player->craftingType = 1; } diff --git a/src/pocketmine/block/Crops.php b/src/pocketmine/block/Crops.php index e6bfd3068..da387e9e7 100644 --- a/src/pocketmine/block/Crops.php +++ b/src/pocketmine/block/Crops.php @@ -32,7 +32,7 @@ use pocketmine\Server; abstract class Crops extends Flowable{ - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($block->getSide(Vector3::SIDE_DOWN)->getId() === Block::FARMLAND){ $this->getLevel()->setBlock($block, $this, true, true); @@ -43,7 +43,7 @@ abstract class Crops extends Flowable{ } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal $block = clone $this; $block->meta += mt_rand(2, 5); @@ -65,7 +65,7 @@ abstract class Crops extends Flowable{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){ $this->getLevel()->useBreakOn($this); diff --git a/src/pocketmine/block/Dandelion.php b/src/pocketmine/block/Dandelion.php index c086784ae..ba8e43e11 100644 --- a/src/pocketmine/block/Dandelion.php +++ b/src/pocketmine/block/Dandelion.php @@ -32,16 +32,16 @@ class Dandelion extends Flowable{ protected $id = self::DANDELION; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Dandelion"; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === 2 or $down->getId() === 3 or $down->getId() === 60){ $this->getLevel()->setBlock($block, $this, true, true); @@ -52,7 +52,7 @@ class Dandelion extends Flowable{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){ $this->getLevel()->useBreakOn($this); diff --git a/src/pocketmine/block/DaylightSensor.php b/src/pocketmine/block/DaylightSensor.php index 29a2093fd..14c41b187 100644 --- a/src/pocketmine/block/DaylightSensor.php +++ b/src/pocketmine/block/DaylightSensor.php @@ -27,15 +27,15 @@ class DaylightSensor extends Transparent{ protected $id = self::DAYLIGHT_SENSOR; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Daylight Sensor"; } - public function getHardness(){ + public function getHardness() : float{ return 0.2; } diff --git a/src/pocketmine/block/DeadBush.php b/src/pocketmine/block/DeadBush.php index 40c5f9ebd..380ed8b65 100644 --- a/src/pocketmine/block/DeadBush.php +++ b/src/pocketmine/block/DeadBush.php @@ -30,16 +30,16 @@ class DeadBush extends Flowable{ protected $id = self::DEAD_BUSH; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Dead Bush"; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){ $this->getLevel()->useBreakOn($this); diff --git a/src/pocketmine/block/DetectorRail.php b/src/pocketmine/block/DetectorRail.php index 9685a02ef..d221b7c94 100644 --- a/src/pocketmine/block/DetectorRail.php +++ b/src/pocketmine/block/DetectorRail.php @@ -27,7 +27,7 @@ class DetectorRail extends Rail{ protected $id = self::DETECTOR_RAIL; - public function getName(){ + public function getName() : string{ return "Detector Rail"; } } diff --git a/src/pocketmine/block/Diamond.php b/src/pocketmine/block/Diamond.php index 1c3fb8cb0..baedad53f 100644 --- a/src/pocketmine/block/Diamond.php +++ b/src/pocketmine/block/Diamond.php @@ -30,19 +30,19 @@ class Diamond extends Solid{ protected $id = self::DIAMOND_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 5; } - public function getName(){ + public function getName() : string{ return "Diamond Block"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/DiamondOre.php b/src/pocketmine/block/DiamondOre.php index 188dd5d12..f9e2992b4 100644 --- a/src/pocketmine/block/DiamondOre.php +++ b/src/pocketmine/block/DiamondOre.php @@ -30,19 +30,19 @@ class DiamondOre extends Solid{ protected $id = self::DIAMOND_ORE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 3; } - public function getName(){ + public function getName() : string{ return "Diamond Ore"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/Dirt.php b/src/pocketmine/block/Dirt.php index 3ee68eeab..004f5f7f7 100644 --- a/src/pocketmine/block/Dirt.php +++ b/src/pocketmine/block/Dirt.php @@ -31,23 +31,23 @@ class Dirt extends Solid{ protected $id = self::DIRT; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } - public function getName(){ + public function getName() : string{ return "Dirt"; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($item->isHoe()){ $item->useOn($this); $this->getLevel()->setBlock($this, Block::get(Block::FARMLAND, 0), true); diff --git a/src/pocketmine/block/Door.php b/src/pocketmine/block/Door.php index 44799bc41..fc02d773e 100644 --- a/src/pocketmine/block/Door.php +++ b/src/pocketmine/block/Door.php @@ -33,7 +33,7 @@ use pocketmine\Player; abstract class Door extends Transparent{ - public function isSolid(){ + public function isSolid() : bool{ return false; } @@ -201,7 +201,7 @@ abstract class Door extends Transparent{ return $bb; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method $this->getLevel()->setBlock($this, new Air(), false); @@ -216,7 +216,7 @@ abstract class Door extends Transparent{ return false; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($face === 1){ $blockUp = $this->getSide(Vector3::SIDE_UP); $blockDown = $this->getSide(Vector3::SIDE_DOWN); @@ -246,7 +246,7 @@ abstract class Door extends Transparent{ return false; } - public function onBreak(Item $item){ + public function onBreak(Item $item) : bool{ if(($this->getDamage() & 0x08) === 0x08){ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === $this->getId()){ @@ -263,7 +263,7 @@ abstract class Door extends Transparent{ return true; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if(($this->getDamage() & 0x08) === 0x08){ //Top $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === $this->getId()){ diff --git a/src/pocketmine/block/DoublePlant.php b/src/pocketmine/block/DoublePlant.php index 7de4912a7..2287da796 100644 --- a/src/pocketmine/block/DoublePlant.php +++ b/src/pocketmine/block/DoublePlant.php @@ -33,15 +33,15 @@ class DoublePlant extends Flowable{ protected $id = self::DOUBLE_PLANT; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function canBeReplaced(){ + public function canBeReplaced() : bool{ return $this->meta === 2 or $this->meta === 3; //grass or fern } - public function getName(){ + public function getName() : string{ static $names = [ 0 => "Sunflower", 1 => "Lilac", @@ -53,7 +53,7 @@ class DoublePlant extends Flowable{ return $names[$this->meta & 0x07] ?? ""; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $id = $block->getSide(Vector3::SIDE_DOWN)->getId(); if(($id === Block::GRASS or $id === Block::DIRT) and $block->getSide(Vector3::SIDE_UP)->canBeReplaced()){ $this->getLevel()->setBlock($block, $this, false, false); @@ -83,7 +83,7 @@ class DoublePlant extends Flowable{ ); } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ $down = $this->getSide(Vector3::SIDE_DOWN); if(!$this->isValidHalfPlant() or (($this->meta & self::BITFLAG_TOP) === 0 and $down->isTransparent())){ @@ -96,7 +96,7 @@ class DoublePlant extends Flowable{ return false; } - public function onBreak(Item $item){ + public function onBreak(Item $item) : bool{ if(parent::onBreak($item) and $this->isValidHalfPlant()){ return $this->getLevel()->setBlock($this->getSide(($this->meta & self::BITFLAG_TOP) !== 0 ? Vector3::SIDE_DOWN : Vector3::SIDE_UP), Block::get(Block::AIR)); } diff --git a/src/pocketmine/block/DoubleStoneSlab.php b/src/pocketmine/block/DoubleStoneSlab.php index 84fb76b04..b2c4e456d 100644 --- a/src/pocketmine/block/DoubleStoneSlab.php +++ b/src/pocketmine/block/DoubleStoneSlab.php @@ -30,19 +30,19 @@ class DoubleStoneSlab extends Solid{ protected $id = self::DOUBLE_STONE_SLAB; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ static $names = [ 0 => "Stone", 1 => "Sandstone", diff --git a/src/pocketmine/block/DoubleWoodenSlab.php b/src/pocketmine/block/DoubleWoodenSlab.php index a0603abc3..a4f431b48 100644 --- a/src/pocketmine/block/DoubleWoodenSlab.php +++ b/src/pocketmine/block/DoubleWoodenSlab.php @@ -30,19 +30,19 @@ class DoubleWoodenSlab extends Solid{ protected $id = self::DOUBLE_WOODEN_SLAB; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } - public function getName(){ + public function getName() : string{ static $names = [ 0 => "Oak", 1 => "Spruce", diff --git a/src/pocketmine/block/Emerald.php b/src/pocketmine/block/Emerald.php index ec516b154..6cb9bd53e 100644 --- a/src/pocketmine/block/Emerald.php +++ b/src/pocketmine/block/Emerald.php @@ -30,19 +30,19 @@ class Emerald extends Solid{ protected $id = self::EMERALD_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Emerald Block"; } diff --git a/src/pocketmine/block/EmeraldOre.php b/src/pocketmine/block/EmeraldOre.php index b10cf1743..3ace4ec7f 100644 --- a/src/pocketmine/block/EmeraldOre.php +++ b/src/pocketmine/block/EmeraldOre.php @@ -30,19 +30,19 @@ class EmeraldOre extends Solid{ protected $id = self::EMERALD_ORE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Emerald Ore"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 3; } diff --git a/src/pocketmine/block/EnchantingTable.php b/src/pocketmine/block/EnchantingTable.php index df2d6aa60..d3f3c263c 100644 --- a/src/pocketmine/block/EnchantingTable.php +++ b/src/pocketmine/block/EnchantingTable.php @@ -36,11 +36,11 @@ class EnchantingTable extends Transparent{ protected $id = self::ENCHANTING_TABLE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $this->getLevel()->setBlock($block, $this, true, true); $nbt = new CompoundTag("", [ new StringTag("id", Tile::ENCHANT_TABLE), @@ -64,23 +64,23 @@ class EnchantingTable extends Transparent{ return true; } - public function getHardness(){ + public function getHardness() : float{ return 5; } - public function getResistance(){ + public function getResistance() : float{ return 6000; } - public function getName(){ + public function getName() : string{ return "Enchanting Table"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($player instanceof Player){ //TODO lock diff --git a/src/pocketmine/block/EndPortalFrame.php b/src/pocketmine/block/EndPortalFrame.php index 858ca375e..3141929ef 100644 --- a/src/pocketmine/block/EndPortalFrame.php +++ b/src/pocketmine/block/EndPortalFrame.php @@ -30,27 +30,27 @@ class EndPortalFrame extends Solid{ protected $id = self::END_PORTAL_FRAME; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 1; } - public function getName(){ + public function getName() : string{ return "End Portal Frame"; } - public function getHardness(){ + public function getHardness() : float{ return -1; } - public function getResistance(){ + public function getResistance() : float{ return 18000000; } - public function isBreakable(Item $item){ + public function isBreakable(Item $item) : bool{ return false; } diff --git a/src/pocketmine/block/EndStone.php b/src/pocketmine/block/EndStone.php index 5487b68f2..3b4910dcc 100644 --- a/src/pocketmine/block/EndStone.php +++ b/src/pocketmine/block/EndStone.php @@ -29,19 +29,19 @@ class EndStone extends Solid{ protected $id = self::END_STONE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "End Stone"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 3; } } \ No newline at end of file diff --git a/src/pocketmine/block/Fallable.php b/src/pocketmine/block/Fallable.php index 2ae79796a..19ee9f737 100644 --- a/src/pocketmine/block/Fallable.php +++ b/src/pocketmine/block/Fallable.php @@ -35,7 +35,7 @@ use pocketmine\nbt\tag\ListTag; abstract class Fallable extends Solid{ - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === self::AIR or ($down instanceof Liquid)){ diff --git a/src/pocketmine/block/Farmland.php b/src/pocketmine/block/Farmland.php index 32a438922..426fa8ae7 100644 --- a/src/pocketmine/block/Farmland.php +++ b/src/pocketmine/block/Farmland.php @@ -31,19 +31,19 @@ class Farmland extends Transparent{ protected $id = self::FARMLAND; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Farmland"; } - public function getHardness(){ + public function getHardness() : float{ return 0.6; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } diff --git a/src/pocketmine/block/Fence.php b/src/pocketmine/block/Fence.php index 34c50949d..771ce24e5 100644 --- a/src/pocketmine/block/Fence.php +++ b/src/pocketmine/block/Fence.php @@ -37,20 +37,20 @@ class Fence extends Transparent{ protected $id = self::FENCE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } - public function getName(){ + public function getName() : string{ static $names = [ self::FENCE_OAK => "Oak Fence", self::FENCE_SPRUCE => "Spruce Fence", diff --git a/src/pocketmine/block/FenceGate.php b/src/pocketmine/block/FenceGate.php index 270c1636d..3153d1929 100644 --- a/src/pocketmine/block/FenceGate.php +++ b/src/pocketmine/block/FenceGate.php @@ -31,11 +31,11 @@ use pocketmine\Player; class FenceGate extends Transparent{ - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } @@ -68,7 +68,7 @@ class FenceGate extends Transparent{ } } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $this->meta = ($player instanceof Player ? ($player->getDirection() - 1) & 0x03 : 0); $this->getLevel()->setBlock($block, $this, true, true); @@ -81,7 +81,7 @@ class FenceGate extends Transparent{ ]; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ $this->meta = (($this->meta ^ 0x04) & ~0x02); if($player !== null){ diff --git a/src/pocketmine/block/Fire.php b/src/pocketmine/block/Fire.php index fb3919e66..f7ceda034 100644 --- a/src/pocketmine/block/Fire.php +++ b/src/pocketmine/block/Fire.php @@ -37,27 +37,27 @@ class Fire extends Flowable{ protected $id = self::FIRE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function hasEntityCollision(){ + public function hasEntityCollision() : bool{ return true; } - public function getName(){ + public function getName() : string{ return "Fire Block"; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 15; } - public function isBreakable(Item $item){ + public function isBreakable(Item $item) : bool{ return false; } - public function canBeReplaced(){ + public function canBeReplaced() : bool{ return true; } @@ -79,7 +79,7 @@ class Fire extends Flowable{ return []; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ for($s = 0; $s <= 5; ++$s){ $side = $this->getSide($s); diff --git a/src/pocketmine/block/Flowable.php b/src/pocketmine/block/Flowable.php index e7cb0de46..73d5e5488 100644 --- a/src/pocketmine/block/Flowable.php +++ b/src/pocketmine/block/Flowable.php @@ -25,19 +25,19 @@ namespace pocketmine\block; abstract class Flowable extends Transparent{ - public function canBeFlowedInto(){ + public function canBeFlowedInto() : bool{ return true; } - public function getHardness(){ + public function getHardness() : float{ return 0; } - public function getResistance(){ + public function getResistance() : float{ return 0; } - public function isSolid(){ + public function isSolid() : bool{ return false; } diff --git a/src/pocketmine/block/Flower.php b/src/pocketmine/block/Flower.php index abcc6aed1..c227e8a8f 100644 --- a/src/pocketmine/block/Flower.php +++ b/src/pocketmine/block/Flower.php @@ -41,11 +41,11 @@ class Flower extends Flowable{ protected $id = self::RED_FLOWER; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ static $names = [ self::TYPE_POPPY => "Poppy", self::TYPE_BLUE_ORCHID => "Blue Orchid", @@ -60,7 +60,7 @@ class Flower extends Flowable{ return $names[$this->meta] ?? "Unknown"; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){ $this->getLevel()->setBlock($block, $this, true); @@ -71,7 +71,7 @@ class Flower extends Flowable{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){ $this->getLevel()->useBreakOn($this); diff --git a/src/pocketmine/block/FlowerPot.php b/src/pocketmine/block/FlowerPot.php index 45f065060..44dd69fd9 100644 --- a/src/pocketmine/block/FlowerPot.php +++ b/src/pocketmine/block/FlowerPot.php @@ -42,11 +42,11 @@ class FlowerPot extends Flowable{ protected $id = self::FLOWER_POT_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Flower Pot Block"; } @@ -61,7 +61,7 @@ class FlowerPot extends Flowable{ ); } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){ return false; } @@ -87,7 +87,7 @@ class FlowerPot extends Flowable{ return true; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){ $this->getLevel()->useBreakOn($this); @@ -99,7 +99,7 @@ class FlowerPot extends Flowable{ return false; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ $pot = $this->getLevel()->getTile($this); if(!($pot instanceof TileFlowerPot)){ return false; diff --git a/src/pocketmine/block/Furnace.php b/src/pocketmine/block/Furnace.php index 3c1fdeae0..c55450025 100644 --- a/src/pocketmine/block/Furnace.php +++ b/src/pocketmine/block/Furnace.php @@ -28,11 +28,11 @@ class Furnace extends BurningFurnace{ protected $id = self::FURNACE; - public function getName(){ + public function getName() : string{ return "Furnace"; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 0; } } \ No newline at end of file diff --git a/src/pocketmine/block/Glass.php b/src/pocketmine/block/Glass.php index ce0884c4e..fe460f1d3 100644 --- a/src/pocketmine/block/Glass.php +++ b/src/pocketmine/block/Glass.php @@ -29,15 +29,15 @@ class Glass extends Transparent{ protected $id = self::GLASS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Glass"; } - public function getHardness(){ + public function getHardness() : float{ return 0.3; } diff --git a/src/pocketmine/block/GlassPane.php b/src/pocketmine/block/GlassPane.php index 2d9d3f8c6..f67faca64 100644 --- a/src/pocketmine/block/GlassPane.php +++ b/src/pocketmine/block/GlassPane.php @@ -29,15 +29,15 @@ class GlassPane extends Thin{ protected $id = self::GLASS_PANE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Glass Pane"; } - public function getHardness(){ + public function getHardness() : float{ return 0.3; } diff --git a/src/pocketmine/block/GlazedTerracotta.php b/src/pocketmine/block/GlazedTerracotta.php index 2525a2f7c..b2df2c0c8 100644 --- a/src/pocketmine/block/GlazedTerracotta.php +++ b/src/pocketmine/block/GlazedTerracotta.php @@ -30,15 +30,15 @@ use pocketmine\Player; class GlazedTerracotta extends Solid{ - public function getHardness(){ + public function getHardness() : float{ return 1.4; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($player !== null){ $faces = [ 0 => 4, diff --git a/src/pocketmine/block/GlowingObsidian.php b/src/pocketmine/block/GlowingObsidian.php index f2f04c25b..c851563c1 100644 --- a/src/pocketmine/block/GlowingObsidian.php +++ b/src/pocketmine/block/GlowingObsidian.php @@ -28,15 +28,15 @@ class GlowingObsidian extends Solid{ protected $id = self::GLOWING_OBSIDIAN; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Glowing Obsidian"; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 12; } diff --git a/src/pocketmine/block/GlowingRedstoneOre.php b/src/pocketmine/block/GlowingRedstoneOre.php index 90bb683ae..161b65c28 100644 --- a/src/pocketmine/block/GlowingRedstoneOre.php +++ b/src/pocketmine/block/GlowingRedstoneOre.php @@ -29,15 +29,15 @@ class GlowingRedstoneOre extends RedstoneOre{ protected $id = self::GLOWING_REDSTONE_ORE; - public function getName(){ + public function getName() : string{ return "Glowing Redstone Ore"; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 9; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_SCHEDULED or $type === Level::BLOCK_UPDATE_RANDOM){ $this->getLevel()->setBlock($this, Block::get(Block::REDSTONE_ORE, $this->meta), false, false); diff --git a/src/pocketmine/block/Glowstone.php b/src/pocketmine/block/Glowstone.php index 592acbeb3..8d850b631 100644 --- a/src/pocketmine/block/Glowstone.php +++ b/src/pocketmine/block/Glowstone.php @@ -30,23 +30,23 @@ class Glowstone extends Transparent{ protected $id = self::GLOWSTONE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Glowstone"; } - public function getHardness(){ + public function getHardness() : float{ return 0.3; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 15; } diff --git a/src/pocketmine/block/Gold.php b/src/pocketmine/block/Gold.php index 6fe7128ec..e000d0526 100644 --- a/src/pocketmine/block/Gold.php +++ b/src/pocketmine/block/Gold.php @@ -30,19 +30,19 @@ class Gold extends Solid{ protected $id = self::GOLD_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Gold Block"; } - public function getHardness(){ + public function getHardness() : float{ return 3; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/GoldOre.php b/src/pocketmine/block/GoldOre.php index a56ecf5b6..59841d708 100644 --- a/src/pocketmine/block/GoldOre.php +++ b/src/pocketmine/block/GoldOre.php @@ -30,19 +30,19 @@ class GoldOre extends Solid{ protected $id = self::GOLD_ORE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Gold Ore"; } - public function getHardness(){ + public function getHardness() : float{ return 3; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/Grass.php b/src/pocketmine/block/Grass.php index 7c9b77f51..97c80a7db 100644 --- a/src/pocketmine/block/Grass.php +++ b/src/pocketmine/block/Grass.php @@ -36,19 +36,19 @@ class Grass extends Solid{ protected $id = self::GRASS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Grass"; } - public function getHardness(){ + public function getHardness() : float{ return 0.6; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } @@ -58,7 +58,7 @@ class Grass extends Solid{ ]; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_RANDOM){ $lightAbove = $this->level->getFullLightAt($this->x, $this->y + 1, $this->z); if($lightAbove < 4 and Block::$lightFilter[$this->level->getBlockIdAt($this->x, $this->y + 1, $this->z)] >= 3){ //2 plus 1 standard filter amount @@ -97,7 +97,7 @@ class Grass extends Solid{ return false; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ $item->count--; TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2); diff --git a/src/pocketmine/block/GrassPath.php b/src/pocketmine/block/GrassPath.php index 489b6a293..3d688c12a 100644 --- a/src/pocketmine/block/GrassPath.php +++ b/src/pocketmine/block/GrassPath.php @@ -31,15 +31,15 @@ class GrassPath extends Transparent{ protected $id = self::GRASS_PATH; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Grass Path"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } @@ -54,7 +54,7 @@ class GrassPath extends Transparent{ ); } - public function getHardness(){ + public function getHardness() : float{ return 0.6; } diff --git a/src/pocketmine/block/Gravel.php b/src/pocketmine/block/Gravel.php index 4c5f4abfd..80b786738 100644 --- a/src/pocketmine/block/Gravel.php +++ b/src/pocketmine/block/Gravel.php @@ -30,19 +30,19 @@ class Gravel extends Fallable{ protected $id = self::GRAVEL; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Gravel"; } - public function getHardness(){ + public function getHardness() : float{ return 0.6; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } diff --git a/src/pocketmine/block/HardenedClay.php b/src/pocketmine/block/HardenedClay.php index 9e1f2aaaa..1e7a1b0bb 100644 --- a/src/pocketmine/block/HardenedClay.php +++ b/src/pocketmine/block/HardenedClay.php @@ -29,19 +29,19 @@ class HardenedClay extends Solid{ protected $id = self::HARDENED_CLAY; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Hardened Clay"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 1.25; } } \ No newline at end of file diff --git a/src/pocketmine/block/HayBale.php b/src/pocketmine/block/HayBale.php index 8192dc443..652700c52 100644 --- a/src/pocketmine/block/HayBale.php +++ b/src/pocketmine/block/HayBale.php @@ -30,19 +30,19 @@ class HayBale extends Solid{ protected $id = self::HAY_BALE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Hay Bale"; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $faces = [ 0 => 0, 1 => 0, diff --git a/src/pocketmine/block/Ice.php b/src/pocketmine/block/Ice.php index 7467a869d..da1941d4d 100644 --- a/src/pocketmine/block/Ice.php +++ b/src/pocketmine/block/Ice.php @@ -31,15 +31,15 @@ class Ice extends Transparent{ protected $id = self::ICE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Ice"; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } @@ -47,17 +47,17 @@ class Ice extends Transparent{ return 2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function onBreak(Item $item){ + public function onBreak(Item $item) : bool{ $this->getLevel()->setBlock($this, new Water(), true); return true; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_RANDOM){ if($this->level->getHighestAdjacentBlockLight($this->x, $this->y, $this->z) >= 12){ $this->level->useBreakOn($this); diff --git a/src/pocketmine/block/Iron.php b/src/pocketmine/block/Iron.php index bf4bc4c16..83a7c1b54 100644 --- a/src/pocketmine/block/Iron.php +++ b/src/pocketmine/block/Iron.php @@ -30,19 +30,19 @@ class Iron extends Solid{ protected $id = self::IRON_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Iron Block"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 5; } diff --git a/src/pocketmine/block/IronBars.php b/src/pocketmine/block/IronBars.php index 47ee0f644..d37aa545d 100644 --- a/src/pocketmine/block/IronBars.php +++ b/src/pocketmine/block/IronBars.php @@ -30,19 +30,19 @@ class IronBars extends Thin{ protected $id = self::IRON_BARS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Iron Bars"; } - public function getHardness(){ + public function getHardness() : float{ return 5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/IronDoor.php b/src/pocketmine/block/IronDoor.php index 381b45ce4..f2b38cb6a 100644 --- a/src/pocketmine/block/IronDoor.php +++ b/src/pocketmine/block/IronDoor.php @@ -30,19 +30,19 @@ class IronDoor extends Door{ protected $id = self::IRON_DOOR_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Iron Door Block"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 5; } diff --git a/src/pocketmine/block/IronOre.php b/src/pocketmine/block/IronOre.php index 7d5a6880f..7d2a43305 100644 --- a/src/pocketmine/block/IronOre.php +++ b/src/pocketmine/block/IronOre.php @@ -30,19 +30,19 @@ class IronOre extends Solid{ protected $id = self::IRON_ORE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Iron Ore"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 3; } diff --git a/src/pocketmine/block/IronTrapdoor.php b/src/pocketmine/block/IronTrapdoor.php index 110102d72..3fd776ea4 100644 --- a/src/pocketmine/block/IronTrapdoor.php +++ b/src/pocketmine/block/IronTrapdoor.php @@ -29,15 +29,15 @@ class IronTrapdoor extends Trapdoor{ protected $id = self::IRON_TRAPDOOR; - public function getName(){ + public function getName() : string{ return "Iron Trapdoor"; } - public function getHardness(){ + public function getHardness() : float{ return 5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } } diff --git a/src/pocketmine/block/ItemFrame.php b/src/pocketmine/block/ItemFrame.php index 940bf897f..97050a14e 100644 --- a/src/pocketmine/block/ItemFrame.php +++ b/src/pocketmine/block/ItemFrame.php @@ -35,15 +35,15 @@ use pocketmine\tile\Tile; class ItemFrame extends Flowable{ protected $id = Block::ITEM_FRAME_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Item Frame"; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ $tile = $this->level->getTile($this); if(!($tile instanceof TileItemFrame)){ $nbt = new CompoundTag("", [ @@ -74,7 +74,7 @@ class ItemFrame extends Flowable{ return true; } - public function onBreak(Item $item){ + public function onBreak(Item $item) : bool{ $tile = $this->level->getTile($this); if($tile instanceof TileItemFrame){ //TODO: add events @@ -85,7 +85,7 @@ class ItemFrame extends Flowable{ return parent::onBreak($item); } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ $sides = [ 0 => 4, @@ -101,7 +101,7 @@ class ItemFrame extends Flowable{ return false; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($face === 0 or $face === 1){ return false; } diff --git a/src/pocketmine/block/Ladder.php b/src/pocketmine/block/Ladder.php index 0ced0e655..2b948bc65 100644 --- a/src/pocketmine/block/Ladder.php +++ b/src/pocketmine/block/Ladder.php @@ -34,23 +34,23 @@ class Ladder extends Transparent{ protected $id = self::LADDER; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Ladder"; } - public function hasEntityCollision(){ + public function hasEntityCollision() : bool{ return true; } - public function isSolid(){ + public function isSolid() : bool{ return false; } - public function getHardness(){ + public function getHardness() : float{ return 0.4; } @@ -109,7 +109,7 @@ class Ladder extends Transparent{ } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($target->isTransparent() === false){ $faces = [ 2 => 2, @@ -128,7 +128,7 @@ class Ladder extends Transparent{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ $sides = [ 2 => 3, @@ -145,7 +145,7 @@ class Ladder extends Transparent{ return false; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } diff --git a/src/pocketmine/block/Lapis.php b/src/pocketmine/block/Lapis.php index b0f4cf52e..2924afe43 100644 --- a/src/pocketmine/block/Lapis.php +++ b/src/pocketmine/block/Lapis.php @@ -30,19 +30,19 @@ class Lapis extends Solid{ protected $id = self::LAPIS_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Lapis Lazuli Block"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 3; } diff --git a/src/pocketmine/block/LapisOre.php b/src/pocketmine/block/LapisOre.php index 5d850e535..a8243ebff 100644 --- a/src/pocketmine/block/LapisOre.php +++ b/src/pocketmine/block/LapisOre.php @@ -30,19 +30,19 @@ class LapisOre extends Solid{ protected $id = self::LAPIS_ORE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 3; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Lapis Lazuli Ore"; } diff --git a/src/pocketmine/block/Lava.php b/src/pocketmine/block/Lava.php index 7d67f4cb6..67601274e 100644 --- a/src/pocketmine/block/Lava.php +++ b/src/pocketmine/block/Lava.php @@ -35,15 +35,15 @@ class Lava extends Liquid{ protected $id = self::FLOWING_LAVA; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 15; } - public function getName(){ + public function getName() : string{ return "Lava"; } @@ -62,7 +62,7 @@ class Lava extends Liquid{ $entity->resetFallDistance(); } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $ret = $this->getLevel()->setBlock($this, $this, true, false); $this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate()); diff --git a/src/pocketmine/block/Leaves.php b/src/pocketmine/block/Leaves.php index d9fc15479..8fb0deb83 100644 --- a/src/pocketmine/block/Leaves.php +++ b/src/pocketmine/block/Leaves.php @@ -41,19 +41,19 @@ class Leaves extends Transparent{ protected $id = self::LEAVES; protected $woodType = self::WOOD; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHEARS; } - public function getName(){ + public function getName() : string{ static $names = [ self::OAK => "Oak Leaves", self::SPRUCE => "Spruce Leaves", @@ -132,7 +132,7 @@ class Leaves extends Transparent{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if(($this->meta & 0b00001100) === 0){ $this->meta |= 0x08; @@ -159,9 +159,9 @@ class Leaves extends Transparent{ return false; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $this->meta |= 0x04; - $this->getLevel()->setBlock($this, $this, true); + return $this->getLevel()->setBlock($this, $this, true); } public function getDrops(Item $item){ diff --git a/src/pocketmine/block/Leaves2.php b/src/pocketmine/block/Leaves2.php index 421870c13..b25668f87 100644 --- a/src/pocketmine/block/Leaves2.php +++ b/src/pocketmine/block/Leaves2.php @@ -30,7 +30,7 @@ class Leaves2 extends Leaves{ protected $id = self::LEAVES2; protected $woodType = self::WOOD2; - public function getName(){ + public function getName() : string{ static $names = [ self::ACACIA => "Acacia Leaves", self::DARK_OAK => "Dark Oak Leaves", diff --git a/src/pocketmine/block/Lever.php b/src/pocketmine/block/Lever.php index 493cd404f..add57cf41 100644 --- a/src/pocketmine/block/Lever.php +++ b/src/pocketmine/block/Lever.php @@ -27,11 +27,11 @@ class Lever extends Flowable{ protected $id = self::LEVER; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Lever"; } } diff --git a/src/pocketmine/block/Liquid.php b/src/pocketmine/block/Liquid.php index a08c6b28b..100e29bee 100644 --- a/src/pocketmine/block/Liquid.php +++ b/src/pocketmine/block/Liquid.php @@ -33,19 +33,19 @@ abstract class Liquid extends Transparent{ /** @var Vector3 */ private $temporalVector = null; - public function hasEntityCollision(){ + public function hasEntityCollision() : bool{ return true; } - public function isBreakable(Item $item){ + public function isBreakable(Item $item) : bool{ return false; } - public function canBeReplaced(){ + public function canBeReplaced() : bool{ return true; } - public function isSolid(){ + public function isSolid() : bool{ return false; } @@ -188,7 +188,7 @@ abstract class Liquid extends Transparent{ return 0; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ $this->checkForHarden(); $this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate()); @@ -358,7 +358,7 @@ abstract class Liquid extends Transparent{ return $cost; } - public function getHardness(){ + public function getHardness() : float{ return 100; } diff --git a/src/pocketmine/block/LitPumpkin.php b/src/pocketmine/block/LitPumpkin.php index 249f05aa7..2ecfa33e8 100644 --- a/src/pocketmine/block/LitPumpkin.php +++ b/src/pocketmine/block/LitPumpkin.php @@ -27,11 +27,11 @@ class LitPumpkin extends Pumpkin{ protected $id = self::LIT_PUMPKIN; - public function getLightLevel(){ + public function getLightLevel() : int{ return 15; } - public function getName(){ + public function getName() : string{ return "Jack o'Lantern"; } } \ No newline at end of file diff --git a/src/pocketmine/block/LitRedstoneLamp.php b/src/pocketmine/block/LitRedstoneLamp.php index 296caca86..ecc8128f0 100644 --- a/src/pocketmine/block/LitRedstoneLamp.php +++ b/src/pocketmine/block/LitRedstoneLamp.php @@ -27,11 +27,11 @@ class LitRedstoneLamp extends RedstoneLamp{ protected $id = self::LIT_REDSTONE_LAMP; - public function getName(){ + public function getName() : string{ return "Lit Redstone Lamp"; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 15; } } diff --git a/src/pocketmine/block/Melon.php b/src/pocketmine/block/Melon.php index fdbfdec24..02e02cc31 100644 --- a/src/pocketmine/block/Melon.php +++ b/src/pocketmine/block/Melon.php @@ -30,19 +30,19 @@ class Melon extends Transparent{ protected $id = self::MELON_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Melon Block"; } - public function getHardness(){ + public function getHardness() : float{ return 1; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } diff --git a/src/pocketmine/block/MelonStem.php b/src/pocketmine/block/MelonStem.php index f8d53f028..4829e71d5 100644 --- a/src/pocketmine/block/MelonStem.php +++ b/src/pocketmine/block/MelonStem.php @@ -33,15 +33,15 @@ class MelonStem extends Crops{ protected $id = self::MELON_STEM; - public function getName(){ + public function getName() : string{ return "Melon Stem"; } - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){ $this->getLevel()->useBreakOn($this); diff --git a/src/pocketmine/block/MonsterSpawner.php b/src/pocketmine/block/MonsterSpawner.php index e06e19f4b..e22fec7a6 100644 --- a/src/pocketmine/block/MonsterSpawner.php +++ b/src/pocketmine/block/MonsterSpawner.php @@ -30,19 +30,19 @@ class MonsterSpawner extends Solid{ protected $id = self::MONSTER_SPAWNER; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Monster Spawner"; } diff --git a/src/pocketmine/block/MossyCobblestone.php b/src/pocketmine/block/MossyCobblestone.php index 3eec11664..569a4b6fb 100644 --- a/src/pocketmine/block/MossyCobblestone.php +++ b/src/pocketmine/block/MossyCobblestone.php @@ -30,19 +30,19 @@ class MossyCobblestone extends Solid{ protected $id = self::MOSSY_COBBLESTONE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Moss Stone"; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/Mycelium.php b/src/pocketmine/block/Mycelium.php index 4e6b4ba10..539eae09a 100644 --- a/src/pocketmine/block/Mycelium.php +++ b/src/pocketmine/block/Mycelium.php @@ -34,19 +34,19 @@ class Mycelium extends Solid{ protected $id = self::MYCELIUM; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Mycelium"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } - public function getHardness(){ + public function getHardness() : float{ return 0.6; } @@ -56,7 +56,7 @@ class Mycelium extends Solid{ ]; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_RANDOM){ //TODO: light levels $x = mt_rand($this->x - 1, $this->x + 1); diff --git a/src/pocketmine/block/NetherBrick.php b/src/pocketmine/block/NetherBrick.php index 17d35c5f4..9d15cd7c4 100644 --- a/src/pocketmine/block/NetherBrick.php +++ b/src/pocketmine/block/NetherBrick.php @@ -30,19 +30,19 @@ class NetherBrick extends Solid{ protected $id = self::NETHER_BRICK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Nether Bricks"; } - public function getHardness(){ + public function getHardness() : float{ return 2; } diff --git a/src/pocketmine/block/NetherBrickFence.php b/src/pocketmine/block/NetherBrickFence.php index 8b58a3de6..ddcb1b21f 100644 --- a/src/pocketmine/block/NetherBrickFence.php +++ b/src/pocketmine/block/NetherBrickFence.php @@ -29,19 +29,19 @@ class NetherBrickFence extends Transparent{ protected $id = self::NETHER_BRICK_FENCE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Nether Brick Fence"; } diff --git a/src/pocketmine/block/NetherBrickStairs.php b/src/pocketmine/block/NetherBrickStairs.php index 6c5600299..a912d95a5 100644 --- a/src/pocketmine/block/NetherBrickStairs.php +++ b/src/pocketmine/block/NetherBrickStairs.php @@ -29,19 +29,19 @@ class NetherBrickStairs extends Stair{ protected $id = self::NETHER_BRICK_STAIRS; - public function getName(){ + public function getName() : string{ return "Nether Brick Stairs"; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } diff --git a/src/pocketmine/block/NetherReactor.php b/src/pocketmine/block/NetherReactor.php index 1303a856d..6ca1fb6ea 100644 --- a/src/pocketmine/block/NetherReactor.php +++ b/src/pocketmine/block/NetherReactor.php @@ -29,11 +29,11 @@ use pocketmine\item\Tool; class NetherReactor extends Solid{ protected $id = Block::NETHER_REACTOR; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ static $prefixes = [ "", "Active ", @@ -42,11 +42,11 @@ class NetherReactor extends Solid{ return ($prefixes[$this->meta] ?? "") . "Nether Reactor Core"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 3; } diff --git a/src/pocketmine/block/NetherWartPlant.php b/src/pocketmine/block/NetherWartPlant.php index 16e4e187b..a5f0e601f 100644 --- a/src/pocketmine/block/NetherWartPlant.php +++ b/src/pocketmine/block/NetherWartPlant.php @@ -33,11 +33,11 @@ use pocketmine\Player; class NetherWartPlant extends Flowable{ protected $id = Block::NETHER_WART_PLANT; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === Block::SOUL_SAND){ $this->getLevel()->setBlock($block, $this, false, true); @@ -48,7 +48,7 @@ class NetherWartPlant extends Flowable{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ switch($type){ case Level::BLOCK_UPDATE_RANDOM: if($this->meta < 3 and mt_rand(0, 10) === 0){ //Still growing diff --git a/src/pocketmine/block/Netherrack.php b/src/pocketmine/block/Netherrack.php index 905addf5c..2303d7726 100644 --- a/src/pocketmine/block/Netherrack.php +++ b/src/pocketmine/block/Netherrack.php @@ -30,19 +30,19 @@ class Netherrack extends Solid{ protected $id = self::NETHERRACK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Netherrack"; } - public function getHardness(){ + public function getHardness() : float{ return 0.4; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/NoteBlock.php b/src/pocketmine/block/NoteBlock.php index 177f9c712..5b40fa42b 100644 --- a/src/pocketmine/block/NoteBlock.php +++ b/src/pocketmine/block/NoteBlock.php @@ -27,11 +27,11 @@ class NoteBlock extends Solid{ protected $id = self::NOTE_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Note Block"; } diff --git a/src/pocketmine/block/Obsidian.php b/src/pocketmine/block/Obsidian.php index 439325892..3284b4420 100644 --- a/src/pocketmine/block/Obsidian.php +++ b/src/pocketmine/block/Obsidian.php @@ -30,19 +30,19 @@ class Obsidian extends Solid{ protected $id = self::OBSIDIAN; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Obsidian"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 35; } diff --git a/src/pocketmine/block/PackedIce.php b/src/pocketmine/block/PackedIce.php index fe36a1644..b1a77bc57 100644 --- a/src/pocketmine/block/PackedIce.php +++ b/src/pocketmine/block/PackedIce.php @@ -29,19 +29,19 @@ class PackedIce extends Solid{ protected $id = self::PACKED_ICE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Packed Ice"; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/Planks.php b/src/pocketmine/block/Planks.php index d54627c35..5ae7a9dbf 100644 --- a/src/pocketmine/block/Planks.php +++ b/src/pocketmine/block/Planks.php @@ -35,19 +35,19 @@ class Planks extends Solid{ protected $id = self::WOODEN_PLANKS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } - public function getName(){ + public function getName() : string{ static $names = [ self::OAK => "Oak Wood Planks", self::SPRUCE => "Spruce Wood Planks", diff --git a/src/pocketmine/block/Podzol.php b/src/pocketmine/block/Podzol.php index 0219614ee..77b937203 100644 --- a/src/pocketmine/block/Podzol.php +++ b/src/pocketmine/block/Podzol.php @@ -29,19 +29,19 @@ class Podzol extends Solid{ protected $id = self::PODZOL; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } - public function getName(){ + public function getName() : string{ return "Podzol"; } - public function getHardness(){ + public function getHardness() : float{ return 2.5; } } \ No newline at end of file diff --git a/src/pocketmine/block/Potato.php b/src/pocketmine/block/Potato.php index cf1cbfa2f..99a98c12d 100644 --- a/src/pocketmine/block/Potato.php +++ b/src/pocketmine/block/Potato.php @@ -29,11 +29,11 @@ class Potato extends Crops{ protected $id = self::POTATO_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Potato Block"; } diff --git a/src/pocketmine/block/PoweredRail.php b/src/pocketmine/block/PoweredRail.php index c1eca33a6..fe559a80a 100644 --- a/src/pocketmine/block/PoweredRail.php +++ b/src/pocketmine/block/PoweredRail.php @@ -26,7 +26,7 @@ namespace pocketmine\block; class PoweredRail extends Rail{ protected $id = self::POWERED_RAIL; - public function getName(){ + public function getName() : string{ return "Powered Rail"; } } diff --git a/src/pocketmine/block/Prismarine.php b/src/pocketmine/block/Prismarine.php index 340fa41f2..c78e2e7eb 100644 --- a/src/pocketmine/block/Prismarine.php +++ b/src/pocketmine/block/Prismarine.php @@ -34,15 +34,15 @@ class Prismarine extends Solid{ protected $id = self::PRISMARINE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 1.5; } - public function getName(){ + public function getName() : string{ static $names = [ self::NORMAL => "Prismarine", self::DARK => "Dark Prismarine", @@ -51,7 +51,7 @@ class Prismarine extends Solid{ return $names[$this->meta & 0x03] ?? "Unknown"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/Pumpkin.php b/src/pocketmine/block/Pumpkin.php index 235754483..882089ae7 100644 --- a/src/pocketmine/block/Pumpkin.php +++ b/src/pocketmine/block/Pumpkin.php @@ -31,23 +31,23 @@ class Pumpkin extends Solid{ protected $id = self::PUMPKIN; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 1; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } - public function getName(){ + public function getName() : string{ return "Pumpkin"; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($player instanceof Player){ $this->meta = ((int) $player->getDirection() + 1) % 4; } diff --git a/src/pocketmine/block/PumpkinStem.php b/src/pocketmine/block/PumpkinStem.php index 8d5207b20..8735dfeb0 100644 --- a/src/pocketmine/block/PumpkinStem.php +++ b/src/pocketmine/block/PumpkinStem.php @@ -33,15 +33,15 @@ class PumpkinStem extends Crops{ protected $id = self::PUMPKIN_STEM; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Pumpkin Stem"; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){ $this->getLevel()->useBreakOn($this); diff --git a/src/pocketmine/block/Quartz.php b/src/pocketmine/block/Quartz.php index a6d8c7233..f98c70fb8 100644 --- a/src/pocketmine/block/Quartz.php +++ b/src/pocketmine/block/Quartz.php @@ -35,15 +35,15 @@ class Quartz extends Solid{ protected $id = self::QUARTZ_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.8; } - public function getName(){ + public function getName() : string{ static $names = [ self::QUARTZ_NORMAL => "Quartz Block", self::QUARTZ_CHISELED => "Chiseled Quartz Block", @@ -53,7 +53,7 @@ class Quartz extends Solid{ return $names[$this->meta & 0x03]; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/QuartzStairs.php b/src/pocketmine/block/QuartzStairs.php index f8f6d62b2..b5905f647 100644 --- a/src/pocketmine/block/QuartzStairs.php +++ b/src/pocketmine/block/QuartzStairs.php @@ -29,19 +29,19 @@ class QuartzStairs extends Stair{ protected $id = self::QUARTZ_STAIRS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.8; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Quartz Stairs"; } diff --git a/src/pocketmine/block/Rail.php b/src/pocketmine/block/Rail.php index dd20823a0..041be4a59 100644 --- a/src/pocketmine/block/Rail.php +++ b/src/pocketmine/block/Rail.php @@ -43,19 +43,19 @@ class Rail extends Flowable{ protected $id = self::RAIL; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Rail"; } - public function getHardness(){ + public function getHardness() : float{ return 0.7; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if(!$block->getSide(Vector3::SIDE_DOWN)->isTransparent()){ return $this->getLevel()->setBlock($block, $this, true, true); } @@ -63,7 +63,7 @@ class Rail extends Flowable{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){ $this->getLevel()->useBreakOn($this); diff --git a/src/pocketmine/block/RedMushroom.php b/src/pocketmine/block/RedMushroom.php index 79b1a0e62..7b49bb5a7 100644 --- a/src/pocketmine/block/RedMushroom.php +++ b/src/pocketmine/block/RedMushroom.php @@ -32,16 +32,16 @@ class RedMushroom extends Flowable{ protected $id = self::RED_MUSHROOM; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Red Mushroom"; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){ $this->getLevel()->useBreakOn($this); @@ -53,7 +53,7 @@ class RedMushroom extends Flowable{ return false; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->isTransparent() === false){ $this->getLevel()->setBlock($block, $this, true, true); diff --git a/src/pocketmine/block/Redstone.php b/src/pocketmine/block/Redstone.php index 97ff3fc96..edc6bae76 100644 --- a/src/pocketmine/block/Redstone.php +++ b/src/pocketmine/block/Redstone.php @@ -30,19 +30,19 @@ class Redstone extends Solid{ protected $id = self::REDSTONE_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Redstone Block"; } diff --git a/src/pocketmine/block/RedstoneLamp.php b/src/pocketmine/block/RedstoneLamp.php index 954181bea..a90e944f9 100644 --- a/src/pocketmine/block/RedstoneLamp.php +++ b/src/pocketmine/block/RedstoneLamp.php @@ -27,15 +27,15 @@ class RedstoneLamp extends Solid{ protected $id = self::REDSTONE_LAMP; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Redstone Lamp"; } - public function getHardness(){ + public function getHardness() : float{ return 0.3; } } diff --git a/src/pocketmine/block/RedstoneOre.php b/src/pocketmine/block/RedstoneOre.php index 5a978bf65..326418da5 100644 --- a/src/pocketmine/block/RedstoneOre.php +++ b/src/pocketmine/block/RedstoneOre.php @@ -32,23 +32,23 @@ class RedstoneOre extends Solid{ protected $id = self::REDSTONE_ORE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Redstone Ore"; } - public function getHardness(){ + public function getHardness() : float{ return 3; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ return $this->getLevel()->setBlock($this, $this, true, false); } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL or $type === Level::BLOCK_UPDATE_TOUCH){ $this->getLevel()->setBlock($this, Block::get(Block::GLOWING_REDSTONE_ORE, $this->meta)); @@ -58,7 +58,7 @@ class RedstoneOre extends Solid{ return false; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/RedstoneTorch.php b/src/pocketmine/block/RedstoneTorch.php index a401e896e..4d0770d1d 100644 --- a/src/pocketmine/block/RedstoneTorch.php +++ b/src/pocketmine/block/RedstoneTorch.php @@ -27,11 +27,11 @@ class RedstoneTorch extends Torch{ protected $id = self::LIT_REDSTONE_TORCH; - public function getName(){ + public function getName() : string{ return "Redstone Torch"; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 7; } } diff --git a/src/pocketmine/block/RedstoneTorchUnlit.php b/src/pocketmine/block/RedstoneTorchUnlit.php index 254187f30..f074d0f66 100644 --- a/src/pocketmine/block/RedstoneTorchUnlit.php +++ b/src/pocketmine/block/RedstoneTorchUnlit.php @@ -27,11 +27,11 @@ class RedstoneTorchUnlit extends Torch{ protected $id = self::UNLIT_REDSTONE_TORCH; - public function getName(){ + public function getName() : string{ return "Unlit Redstone Torch"; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 0; } } diff --git a/src/pocketmine/block/Sand.php b/src/pocketmine/block/Sand.php index f594d8276..196b303ae 100644 --- a/src/pocketmine/block/Sand.php +++ b/src/pocketmine/block/Sand.php @@ -29,19 +29,19 @@ class Sand extends Fallable{ protected $id = self::SAND; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } - public function getName(){ + public function getName() : string{ if($this->meta === 0x01){ return "Red Sand"; } diff --git a/src/pocketmine/block/Sandstone.php b/src/pocketmine/block/Sandstone.php index 92c8a7231..88e5dc1e0 100644 --- a/src/pocketmine/block/Sandstone.php +++ b/src/pocketmine/block/Sandstone.php @@ -34,15 +34,15 @@ class Sandstone extends Solid{ protected $id = self::SANDSTONE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.8; } - public function getName(){ + public function getName() : string{ static $names = [ self::NORMAL => "Sandstone", self::CHISELED => "Chiseled Sandstone", @@ -51,7 +51,7 @@ class Sandstone extends Solid{ return $names[$this->meta & 0x03] ?? "Unknown"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/SandstoneStairs.php b/src/pocketmine/block/SandstoneStairs.php index b22daf1d6..8204253f0 100644 --- a/src/pocketmine/block/SandstoneStairs.php +++ b/src/pocketmine/block/SandstoneStairs.php @@ -29,19 +29,19 @@ class SandstoneStairs extends Stair{ protected $id = self::SANDSTONE_STAIRS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.8; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return "Sandstone Stairs"; } diff --git a/src/pocketmine/block/Sapling.php b/src/pocketmine/block/Sapling.php index 7c89d4995..36b72bcc6 100644 --- a/src/pocketmine/block/Sapling.php +++ b/src/pocketmine/block/Sapling.php @@ -40,11 +40,11 @@ class Sapling extends Flowable{ protected $id = self::SAPLING; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ static $names = [ 0 => "Oak Sapling", 1 => "Spruce Sapling", @@ -57,7 +57,7 @@ class Sapling extends Flowable{ } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === self::GRASS or $down->getId() === self::DIRT or $down->getId() === self::FARMLAND){ $this->getLevel()->setBlock($block, $this, true, true); @@ -68,7 +68,7 @@ class Sapling extends Flowable{ return false; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal //TODO: change log type Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x07); @@ -82,7 +82,7 @@ class Sapling extends Flowable{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){ $this->getLevel()->useBreakOn($this); diff --git a/src/pocketmine/block/SeaLantern.php b/src/pocketmine/block/SeaLantern.php index 4d3ac8c08..b571cb6e7 100644 --- a/src/pocketmine/block/SeaLantern.php +++ b/src/pocketmine/block/SeaLantern.php @@ -29,19 +29,19 @@ class SeaLantern extends Transparent{ protected $id = self::SEA_LANTERN; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Sea Lantern"; } - public function getHardness(){ + public function getHardness() : float{ return 0.3; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 15; } diff --git a/src/pocketmine/block/SignPost.php b/src/pocketmine/block/SignPost.php index b93c2598f..e6ea4579f 100644 --- a/src/pocketmine/block/SignPost.php +++ b/src/pocketmine/block/SignPost.php @@ -37,19 +37,19 @@ class SignPost extends Transparent{ protected $id = self::SIGN_POST; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 1; } - public function isSolid(){ + public function isSolid() : bool{ return false; } - public function getName(){ + public function getName() : string{ return "Sign Post"; } @@ -58,7 +58,7 @@ class SignPost extends Transparent{ } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($face !== 0){ $nbt = new CompoundTag("", [ new StringTag("id", Tile::SIGN), @@ -97,7 +97,7 @@ class SignPost extends Transparent{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ $this->getLevel()->useBreakOn($this); @@ -115,7 +115,7 @@ class SignPost extends Transparent{ ]; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } } \ No newline at end of file diff --git a/src/pocketmine/block/Skull.php b/src/pocketmine/block/Skull.php index 847875604..e40254c61 100644 --- a/src/pocketmine/block/Skull.php +++ b/src/pocketmine/block/Skull.php @@ -38,15 +38,15 @@ class Skull extends Flowable{ protected $id = self::SKULL_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 1; } - public function getName(){ + public function getName() : string{ return "Mob Head Block"; } @@ -62,7 +62,7 @@ class Skull extends Flowable{ ); } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($face !== 0){ $this->meta = $face; if($face === 1){ diff --git a/src/pocketmine/block/Snow.php b/src/pocketmine/block/Snow.php index a7499e82a..d9c0ceabf 100644 --- a/src/pocketmine/block/Snow.php +++ b/src/pocketmine/block/Snow.php @@ -29,19 +29,19 @@ class Snow extends Solid{ protected $id = self::SNOW_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.2; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } - public function getName(){ + public function getName() : string{ return "Snow Block"; } diff --git a/src/pocketmine/block/SnowLayer.php b/src/pocketmine/block/SnowLayer.php index 88702dcd5..b3f46f375 100644 --- a/src/pocketmine/block/SnowLayer.php +++ b/src/pocketmine/block/SnowLayer.php @@ -33,28 +33,28 @@ class SnowLayer extends Flowable{ protected $id = self::SNOW_LAYER; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Snow Layer"; } - public function canBeReplaced(){ + public function canBeReplaced() : bool{ return true; } - public function getHardness(){ + public function getHardness() : float{ return 0.1; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($block->getSide(Vector3::SIDE_DOWN)->isSolid()){ //TODO: fix placement $this->getLevel()->setBlock($block, $this, true); @@ -65,7 +65,7 @@ class SnowLayer extends Flowable{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if(!$this->getSide(Vector3::SIDE_DOWN)->isSolid()){ $this->getLevel()->setBlock($this, Block::get(Block::AIR), false, false); diff --git a/src/pocketmine/block/Solid.php b/src/pocketmine/block/Solid.php index 720b734be..9625104ca 100644 --- a/src/pocketmine/block/Solid.php +++ b/src/pocketmine/block/Solid.php @@ -25,7 +25,7 @@ namespace pocketmine\block; abstract class Solid extends Block{ - public function isSolid(){ + public function isSolid() : bool{ return true; } } \ No newline at end of file diff --git a/src/pocketmine/block/SoulSand.php b/src/pocketmine/block/SoulSand.php index af761a275..fa586dd01 100644 --- a/src/pocketmine/block/SoulSand.php +++ b/src/pocketmine/block/SoulSand.php @@ -30,19 +30,19 @@ class SoulSand extends Solid{ protected $id = self::SOUL_SAND; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Soul Sand"; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHOVEL; } diff --git a/src/pocketmine/block/Sponge.php b/src/pocketmine/block/Sponge.php index c819437cb..6a12cddc9 100644 --- a/src/pocketmine/block/Sponge.php +++ b/src/pocketmine/block/Sponge.php @@ -28,15 +28,15 @@ class Sponge extends Solid{ protected $id = self::SPONGE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.6; } - public function getName(){ + public function getName() : string{ return "Sponge"; } diff --git a/src/pocketmine/block/StainedClay.php b/src/pocketmine/block/StainedClay.php index f4fe4ca63..c44e1ccc2 100644 --- a/src/pocketmine/block/StainedClay.php +++ b/src/pocketmine/block/StainedClay.php @@ -30,19 +30,19 @@ class StainedClay extends Solid{ protected $id = self::STAINED_CLAY; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 1.25; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Stained Clay"; } diff --git a/src/pocketmine/block/Stair.php b/src/pocketmine/block/Stair.php index 85489f214..3e30107a4 100644 --- a/src/pocketmine/block/Stair.php +++ b/src/pocketmine/block/Stair.php @@ -129,7 +129,7 @@ abstract class Stair extends Transparent{ } } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $faces = [ 0 => 0, 1 => 2, diff --git a/src/pocketmine/block/StillLava.php b/src/pocketmine/block/StillLava.php index 84f21c4a5..16166e14c 100644 --- a/src/pocketmine/block/StillLava.php +++ b/src/pocketmine/block/StillLava.php @@ -27,7 +27,7 @@ class StillLava extends Lava{ protected $id = self::STILL_LAVA; - public function getName(){ + public function getName() : string{ return "Still Lava"; } diff --git a/src/pocketmine/block/StillWater.php b/src/pocketmine/block/StillWater.php index 7d7824f62..7e352c4bd 100644 --- a/src/pocketmine/block/StillWater.php +++ b/src/pocketmine/block/StillWater.php @@ -27,7 +27,7 @@ class StillWater extends Water{ protected $id = self::STILL_WATER; - public function getName(){ + public function getName() : string{ return "Still Water"; } } \ No newline at end of file diff --git a/src/pocketmine/block/Stone.php b/src/pocketmine/block/Stone.php index ced1540f6..6139a3421 100644 --- a/src/pocketmine/block/Stone.php +++ b/src/pocketmine/block/Stone.php @@ -37,19 +37,19 @@ class Stone extends Solid{ protected $id = self::STONE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 1.5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ static $names = [ self::NORMAL => "Stone", self::GRANITE => "Granite", diff --git a/src/pocketmine/block/StoneBrickStairs.php b/src/pocketmine/block/StoneBrickStairs.php index 495e4f67c..cb7397065 100644 --- a/src/pocketmine/block/StoneBrickStairs.php +++ b/src/pocketmine/block/StoneBrickStairs.php @@ -29,19 +29,19 @@ class StoneBrickStairs extends Stair{ protected $id = self::STONE_BRICK_STAIRS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getHardness(){ + public function getHardness() : float{ return 1.5; } - public function getName(){ + public function getName() : string{ return "Stone Brick Stairs"; } diff --git a/src/pocketmine/block/StoneBricks.php b/src/pocketmine/block/StoneBricks.php index f03b40fe6..094b7dfd7 100644 --- a/src/pocketmine/block/StoneBricks.php +++ b/src/pocketmine/block/StoneBricks.php @@ -34,19 +34,19 @@ class StoneBricks extends Solid{ protected $id = self::STONE_BRICKS; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 1.5; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } - public function getName(){ + public function getName() : string{ static $names = [ self::NORMAL => "Stone Bricks", self::MOSSY => "Mossy Stone Bricks", diff --git a/src/pocketmine/block/StoneButton.php b/src/pocketmine/block/StoneButton.php index a6365f0db..616d416bd 100644 --- a/src/pocketmine/block/StoneButton.php +++ b/src/pocketmine/block/StoneButton.php @@ -27,15 +27,15 @@ class StoneButton extends Flowable{ protected $id = self::STONE_BUTTON; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Stone Button"; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } } diff --git a/src/pocketmine/block/StonePressurePlate.php b/src/pocketmine/block/StonePressurePlate.php index bd014ebec..b6f1e672b 100644 --- a/src/pocketmine/block/StonePressurePlate.php +++ b/src/pocketmine/block/StonePressurePlate.php @@ -27,19 +27,19 @@ class StonePressurePlate extends Transparent{ protected $id = self::STONE_PRESSURE_PLATE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Stone Pressure Plate"; } - public function isSolid(){ + public function isSolid() : bool{ return false; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } } diff --git a/src/pocketmine/block/StoneSlab.php b/src/pocketmine/block/StoneSlab.php index cab8656c9..80717b2c5 100644 --- a/src/pocketmine/block/StoneSlab.php +++ b/src/pocketmine/block/StoneSlab.php @@ -40,11 +40,11 @@ class StoneSlab extends WoodenSlab{ protected $doubleId = self::DOUBLE_STONE_SLAB; - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getName(){ + public function getName() : string{ static $names = [ self::STONE => "Stone", self::SANDSTONE => "Sandstone", @@ -58,7 +58,7 @@ class StoneSlab extends WoodenSlab{ return (($this->meta & 0x08) > 0 ? "Upper " : "") . $names[$this->meta & 0x07] . " Slab"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/Stonecutter.php b/src/pocketmine/block/Stonecutter.php index ecccb2312..21c108d13 100644 --- a/src/pocketmine/block/Stonecutter.php +++ b/src/pocketmine/block/Stonecutter.php @@ -31,15 +31,15 @@ class Stonecutter extends Solid{ protected $id = self::STONECUTTER; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Stonecutter"; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_PICKAXE; } diff --git a/src/pocketmine/block/Sugarcane.php b/src/pocketmine/block/Sugarcane.php index 2680b4efe..0d6ba05b8 100644 --- a/src/pocketmine/block/Sugarcane.php +++ b/src/pocketmine/block/Sugarcane.php @@ -34,11 +34,11 @@ class Sugarcane extends Flowable{ protected $id = self::SUGARCANE_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Sugarcane"; } @@ -49,7 +49,7 @@ class Sugarcane extends Flowable{ ]; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal if($this->getSide(Vector3::SIDE_DOWN)->getId() !== self::SUGARCANE_BLOCK){ for($y = 1; $y < 3; ++$y){ @@ -75,7 +75,7 @@ class Sugarcane extends Flowable{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->isTransparent() === true and $down->getId() !== self::SUGARCANE_BLOCK){ @@ -107,7 +107,7 @@ class Sugarcane extends Flowable{ return false; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === self::SUGARCANE_BLOCK){ $this->getLevel()->setBlock($block, new Sugarcane(), true); diff --git a/src/pocketmine/block/TNT.php b/src/pocketmine/block/TNT.php index 2d964505d..ac7b849b2 100644 --- a/src/pocketmine/block/TNT.php +++ b/src/pocketmine/block/TNT.php @@ -37,19 +37,19 @@ class TNT extends Solid{ protected $id = self::TNT; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "TNT"; } - public function getHardness(){ + public function getHardness() : float{ return 0; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ if($item->getId() === Item::FLINT_STEEL){ $item->useOn($this); $this->ignite(); diff --git a/src/pocketmine/block/TallGrass.php b/src/pocketmine/block/TallGrass.php index 2ba679456..aeac09f0d 100644 --- a/src/pocketmine/block/TallGrass.php +++ b/src/pocketmine/block/TallGrass.php @@ -32,15 +32,15 @@ class TallGrass extends Flowable{ protected $id = self::TALL_GRASS; - public function __construct($meta = 1){ + public function __construct(int $meta = 1){ $this->meta = $meta; } - public function canBeReplaced(){ + public function canBeReplaced() : bool{ return true; } - public function getName(){ + public function getName() : string{ static $names = [ 0 => "Dead Shrub", 1 => "Tall Grass", @@ -49,7 +49,7 @@ class TallGrass extends Flowable{ return $names[$this->meta & 0x03] ?? "Unknown"; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $down = $this->getSide(Vector3::SIDE_DOWN); if($down->getId() === self::GRASS){ $this->getLevel()->setBlock($block, $this, true); @@ -61,7 +61,7 @@ class TallGrass extends Flowable{ } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){ //Replace with common break method $this->getLevel()->setBlock($this, new Air(), true, true); diff --git a/src/pocketmine/block/Thin.php b/src/pocketmine/block/Thin.php index ef121b847..c28d0b78f 100644 --- a/src/pocketmine/block/Thin.php +++ b/src/pocketmine/block/Thin.php @@ -28,7 +28,7 @@ use pocketmine\math\Vector3; abstract class Thin extends Transparent{ - public function isSolid(){ + public function isSolid() : bool{ return false; } diff --git a/src/pocketmine/block/Torch.php b/src/pocketmine/block/Torch.php index 5f15588f5..10edd3d84 100644 --- a/src/pocketmine/block/Torch.php +++ b/src/pocketmine/block/Torch.php @@ -32,20 +32,20 @@ class Torch extends Flowable{ protected $id = self::TORCH; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getLightLevel(){ + public function getLightLevel() : int{ return 14; } - public function getName(){ + public function getName() : string{ return "Torch"; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ $below = $this->getSide(Vector3::SIDE_DOWN); $side = $this->getDamage(); @@ -68,7 +68,7 @@ class Torch extends Flowable{ return false; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $below = $this->getSide(Vector3::SIDE_DOWN); if($target->isTransparent() === false and $face !== 0){ diff --git a/src/pocketmine/block/Transparent.php b/src/pocketmine/block/Transparent.php index 00cf6d554..3e99d4e68 100644 --- a/src/pocketmine/block/Transparent.php +++ b/src/pocketmine/block/Transparent.php @@ -26,7 +26,7 @@ namespace pocketmine\block; abstract class Transparent extends Block{ - public function isTransparent(){ + public function isTransparent() : bool{ return true; } diff --git a/src/pocketmine/block/Trapdoor.php b/src/pocketmine/block/Trapdoor.php index b65b87260..608a886fa 100644 --- a/src/pocketmine/block/Trapdoor.php +++ b/src/pocketmine/block/Trapdoor.php @@ -40,15 +40,15 @@ class Trapdoor extends Transparent{ protected $id = self::TRAPDOOR; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Wooden Trapdoor"; } - public function getHardness(){ + public function getHardness() : float{ return 3; } @@ -123,7 +123,7 @@ class Trapdoor extends Transparent{ return $bb; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $directions = [ 0 => 1, 1 => 3, @@ -146,14 +146,14 @@ class Trapdoor extends Transparent{ ]; } - public function onActivate(Item $item, Player $player = null){ + public function onActivate(Item $item, Player $player = null) : bool{ $this->meta ^= self::MASK_OPENED; $this->getLevel()->setBlock($this, $this, true); $this->level->addSound(new DoorSound($this)); return true; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } diff --git a/src/pocketmine/block/TrappedChest.php b/src/pocketmine/block/TrappedChest.php index 98473ddd7..a559c6942 100644 --- a/src/pocketmine/block/TrappedChest.php +++ b/src/pocketmine/block/TrappedChest.php @@ -29,7 +29,7 @@ class TrappedChest extends Chest{ protected $id = self::TRAPPED_CHEST; - public function getName(){ + public function getName() : string{ return "Trapped Chest"; } } diff --git a/src/pocketmine/block/Tripwire.php b/src/pocketmine/block/Tripwire.php index 6d21c9dcc..1b0416bd6 100644 --- a/src/pocketmine/block/Tripwire.php +++ b/src/pocketmine/block/Tripwire.php @@ -27,11 +27,11 @@ class Tripwire extends Flowable{ protected $id = self::TRIPWIRE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Tripwire"; } } diff --git a/src/pocketmine/block/TripwireHook.php b/src/pocketmine/block/TripwireHook.php index fdeec43ed..9a0017ae0 100644 --- a/src/pocketmine/block/TripwireHook.php +++ b/src/pocketmine/block/TripwireHook.php @@ -27,11 +27,11 @@ class TripwireHook extends Flowable{ protected $id = self::TRIPWIRE_HOOK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Tripwire Hook"; } } diff --git a/src/pocketmine/block/UnknownBlock.php b/src/pocketmine/block/UnknownBlock.php index 16088afdd..1c1f2af03 100644 --- a/src/pocketmine/block/UnknownBlock.php +++ b/src/pocketmine/block/UnknownBlock.php @@ -27,7 +27,7 @@ use pocketmine\item\Item; class UnknownBlock extends Transparent{ - public function getHardness(){ + public function getHardness() : float{ return 0; } diff --git a/src/pocketmine/block/Vine.php b/src/pocketmine/block/Vine.php index be0dbdb52..82fc25b79 100644 --- a/src/pocketmine/block/Vine.php +++ b/src/pocketmine/block/Vine.php @@ -39,27 +39,27 @@ class Vine extends Transparent{ protected $id = self::VINE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function isSolid(){ + public function isSolid() : bool{ return false; } - public function getName(){ + public function getName() : string{ return "Vines"; } - public function getHardness(){ + public function getHardness() : float{ return 0.2; } - public function canPassThrough(){ + public function canPassThrough() : bool{ return true; } - public function hasEntityCollision(){ + public function hasEntityCollision() : bool{ return true; } @@ -132,7 +132,7 @@ class Vine extends Transparent{ } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ //TODO: multiple sides if($target->isSolid()){ $faces = [ @@ -152,7 +152,7 @@ class Vine extends Transparent{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ $sides = [ 1 => 3, @@ -184,7 +184,7 @@ class Vine extends Transparent{ } } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } } \ No newline at end of file diff --git a/src/pocketmine/block/WallSign.php b/src/pocketmine/block/WallSign.php index 0d105f58a..50863d824 100644 --- a/src/pocketmine/block/WallSign.php +++ b/src/pocketmine/block/WallSign.php @@ -29,11 +29,11 @@ class WallSign extends SignPost{ protected $id = self::WALL_SIGN; - public function getName(){ + public function getName() : string{ return "Wall Sign"; } - public function onUpdate($type){ + public function onUpdate(int $type){ $faces = [ 2 => 3, 3 => 2, diff --git a/src/pocketmine/block/Water.php b/src/pocketmine/block/Water.php index e12cb62f1..7027b4d85 100644 --- a/src/pocketmine/block/Water.php +++ b/src/pocketmine/block/Water.php @@ -31,11 +31,11 @@ class Water extends Liquid{ protected $id = self::FLOWING_WATER; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Water"; } @@ -52,7 +52,7 @@ class Water extends Liquid{ $entity->resetFallDistance(); } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $ret = $this->getLevel()->setBlock($this, $this, true, false); $this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate()); diff --git a/src/pocketmine/block/WaterLily.php b/src/pocketmine/block/WaterLily.php index 869c8121f..8d7144152 100644 --- a/src/pocketmine/block/WaterLily.php +++ b/src/pocketmine/block/WaterLily.php @@ -33,15 +33,15 @@ class WaterLily extends Flowable{ protected $id = self::WATER_LILY; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Lily Pad"; } - public function getHardness(){ + public function getHardness() : float{ return 0.6; } @@ -57,7 +57,7 @@ class WaterLily extends Flowable{ } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ if($target instanceof Water){ $up = $target->getSide(Vector3::SIDE_UP); if($up->getId() === Block::AIR){ @@ -69,7 +69,7 @@ class WaterLily extends Flowable{ return false; } - public function onUpdate($type){ + public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if(!($this->getSide(Vector3::SIDE_DOWN) instanceof Water)){ $this->getLevel()->useBreakOn($this); diff --git a/src/pocketmine/block/WeightedPressurePlateHeavy.php b/src/pocketmine/block/WeightedPressurePlateHeavy.php index 9b341ca3f..bcfe010d4 100644 --- a/src/pocketmine/block/WeightedPressurePlateHeavy.php +++ b/src/pocketmine/block/WeightedPressurePlateHeavy.php @@ -27,7 +27,7 @@ class WeightedPressurePlateHeavy extends WeightedPressurePlateLight{ protected $id = self::HEAVY_WEIGHTED_PRESSURE_PLATE; - public function getName(){ + public function getName() : string{ return "Weighted Pressure Plate Heavy"; } } diff --git a/src/pocketmine/block/WeightedPressurePlateLight.php b/src/pocketmine/block/WeightedPressurePlateLight.php index 4e7dcbbac..ac4e793ad 100644 --- a/src/pocketmine/block/WeightedPressurePlateLight.php +++ b/src/pocketmine/block/WeightedPressurePlateLight.php @@ -27,19 +27,19 @@ class WeightedPressurePlateLight extends Transparent{ protected $id = self::LIGHT_WEIGHTED_PRESSURE_PLATE; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Weighted Pressure Plate Light"; } - public function isSolid(){ + public function isSolid() : bool{ return false; } - public function getHardness(){ + public function getHardness() : float{ return 0.5; } } diff --git a/src/pocketmine/block/Wheat.php b/src/pocketmine/block/Wheat.php index 28a64bdda..5d69a5049 100644 --- a/src/pocketmine/block/Wheat.php +++ b/src/pocketmine/block/Wheat.php @@ -29,11 +29,11 @@ class Wheat extends Crops{ protected $id = self::WHEAT_BLOCK; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getName(){ + public function getName() : string{ return "Wheat Block"; } diff --git a/src/pocketmine/block/Wood.php b/src/pocketmine/block/Wood.php index 46c8dac06..7bd249a7f 100644 --- a/src/pocketmine/block/Wood.php +++ b/src/pocketmine/block/Wood.php @@ -35,15 +35,15 @@ class Wood extends Solid{ protected $id = self::WOOD; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getName(){ + public function getName() : string{ static $names = [ self::OAK => "Oak Wood", self::SPRUCE => "Spruce Wood", @@ -53,7 +53,7 @@ class Wood extends Solid{ return $names[$this->meta & 0x03]; } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $faces = [ 0 => 0, 1 => 0, @@ -75,7 +75,7 @@ class Wood extends Solid{ ]; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } diff --git a/src/pocketmine/block/Wood2.php b/src/pocketmine/block/Wood2.php index 7094787d2..2db985f0c 100644 --- a/src/pocketmine/block/Wood2.php +++ b/src/pocketmine/block/Wood2.php @@ -31,7 +31,7 @@ class Wood2 extends Wood{ protected $id = self::WOOD2; - public function getName(){ + public function getName() : string{ static $names = [ 0 => "Acacia Wood", 1 => "Dark Oak Wood" diff --git a/src/pocketmine/block/WoodenButton.php b/src/pocketmine/block/WoodenButton.php index 63a60d7d0..91a531c1c 100644 --- a/src/pocketmine/block/WoodenButton.php +++ b/src/pocketmine/block/WoodenButton.php @@ -27,7 +27,7 @@ class WoodenButton extends StoneButton{ protected $id = self::WOODEN_BUTTON; - public function getName(){ + public function getName() : string{ return "Wooden Button"; } } diff --git a/src/pocketmine/block/WoodenDoor.php b/src/pocketmine/block/WoodenDoor.php index 502e0fa7c..70618183b 100644 --- a/src/pocketmine/block/WoodenDoor.php +++ b/src/pocketmine/block/WoodenDoor.php @@ -28,11 +28,11 @@ use pocketmine\item\Tool; class WoodenDoor extends Door{ - public function getHardness(){ + public function getHardness() : float{ return 3; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } diff --git a/src/pocketmine/block/WoodenPressurePlate.php b/src/pocketmine/block/WoodenPressurePlate.php index d42605df3..0994b52ea 100644 --- a/src/pocketmine/block/WoodenPressurePlate.php +++ b/src/pocketmine/block/WoodenPressurePlate.php @@ -27,7 +27,7 @@ class WoodenPressurePlate extends StonePressurePlate{ protected $id = self::WOODEN_PRESSURE_PLATE; - public function getName(){ + public function getName() : string{ return "Wooden Pressure Plate"; } diff --git a/src/pocketmine/block/WoodenSlab.php b/src/pocketmine/block/WoodenSlab.php index 067655c8e..a4ade5ea7 100644 --- a/src/pocketmine/block/WoodenSlab.php +++ b/src/pocketmine/block/WoodenSlab.php @@ -34,15 +34,15 @@ class WoodenSlab extends Transparent{ protected $doubleId = self::DOUBLE_WOODEN_SLAB; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getName(){ + public function getName() : string{ static $names = [ 0 => "Oak", 1 => "Spruce", @@ -77,7 +77,7 @@ class WoodenSlab extends Transparent{ } } - public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ + public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{ $this->meta &= 0x07; if($face === 0){ if($target->getId() === $this->id and ($target->getDamage() & 0x08) === 0x08 and ($target->getDamage() & 0x07) === ($this->meta)){ @@ -125,7 +125,7 @@ class WoodenSlab extends Transparent{ return true; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } diff --git a/src/pocketmine/block/WoodenStairs.php b/src/pocketmine/block/WoodenStairs.php index 1b8034aec..ae91ae9e5 100644 --- a/src/pocketmine/block/WoodenStairs.php +++ b/src/pocketmine/block/WoodenStairs.php @@ -28,15 +28,15 @@ use pocketmine\item\Tool; class WoodenStairs extends Stair{ - public function getHardness(){ + public function getHardness() : float{ return 2; } - public function getResistance(){ + public function getResistance() : float{ return 15; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_AXE; } diff --git a/src/pocketmine/block/Wool.php b/src/pocketmine/block/Wool.php index a34ba8622..4a41732c7 100644 --- a/src/pocketmine/block/Wool.php +++ b/src/pocketmine/block/Wool.php @@ -30,19 +30,19 @@ class Wool extends Solid{ protected $id = self::WOOL; - public function __construct($meta = 0){ + public function __construct(int $meta = 0){ $this->meta = $meta; } - public function getHardness(){ + public function getHardness() : float{ return 0.8; } - public function getToolType(){ + public function getToolType() : int{ return Tool::TYPE_SHEARS; } - public function getName(){ + public function getName() : string{ return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Wool"; }