From 41c6cb6f97fbf330e8e6e5d3b8ce85e1efbd22c0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 18 Aug 2017 19:49:28 +0100 Subject: [PATCH] Added Block->getVariantBitmask(0 to cut down on getDrops() boilerplate, fixed several blocks incorrectly retaining meta when broken --- src/pocketmine/block/ActivatorRail.php | 2 ++ src/pocketmine/block/Block.php | 18 ++++++++++++++++-- src/pocketmine/block/BrewingStand.php | 6 ++++++ src/pocketmine/block/BurningFurnace.php | 8 +++++--- src/pocketmine/block/Cactus.php | 6 ++---- src/pocketmine/block/Chest.php | 6 ++---- src/pocketmine/block/CocoaBlock.php | 2 ++ src/pocketmine/block/DaylightSensor.php | 2 ++ src/pocketmine/block/DetectorRail.php | 2 ++ src/pocketmine/block/Door.php | 4 ++++ src/pocketmine/block/DoublePlant.php | 8 +++++--- src/pocketmine/block/EnchantingTable.php | 4 +--- src/pocketmine/block/EndRod.php | 7 ++----- src/pocketmine/block/FenceGate.php | 6 ++---- src/pocketmine/block/GlazedTerracotta.php | 8 +++++--- src/pocketmine/block/Gravel.php | 4 +--- src/pocketmine/block/HayBale.php | 7 ++----- src/pocketmine/block/IronBars.php | 8 +++++--- src/pocketmine/block/ItemFrame.php | 7 ++----- src/pocketmine/block/Ladder.php | 6 ++---- src/pocketmine/block/Prismarine.php | 8 +++++--- src/pocketmine/block/Pumpkin.php | 3 +++ src/pocketmine/block/Quartz.php | 8 +++++--- src/pocketmine/block/Rail.php | 4 ++++ src/pocketmine/block/Sandstone.php | 8 +++++--- src/pocketmine/block/SignPost.php | 4 ++++ src/pocketmine/block/Stair.php | 8 +++++--- src/pocketmine/block/StoneBricks.php | 4 +--- src/pocketmine/block/StoneButton.php | 4 ++++ src/pocketmine/block/StonePressurePlate.php | 4 ++++ src/pocketmine/block/Sugarcane.php | 4 ++++ src/pocketmine/block/Torch.php | 6 ++---- src/pocketmine/block/Trapdoor.php | 6 ++---- src/pocketmine/block/TripwireHook.php | 6 ++++++ src/pocketmine/block/Vine.php | 8 +++++--- src/pocketmine/block/WaterLily.php | 6 ++---- .../block/WeightedPressurePlateLight.php | 4 ++++ src/pocketmine/block/Wood.php | 6 ++---- src/pocketmine/block/WoodenDoor.php | 6 ------ src/pocketmine/block/WoodenSlab.php | 6 ++---- src/pocketmine/block/WoodenStairs.php | 7 ++++++- 41 files changed, 145 insertions(+), 96 deletions(-) diff --git a/src/pocketmine/block/ActivatorRail.php b/src/pocketmine/block/ActivatorRail.php index 56e8a9979..ec7bf85d4 100644 --- a/src/pocketmine/block/ActivatorRail.php +++ b/src/pocketmine/block/ActivatorRail.php @@ -30,4 +30,6 @@ class ActivatorRail extends Rail{ public function getName() : string{ return "Activator Rail"; } + + //TODO } diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index a55700b54..32cb9d902 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -398,8 +398,9 @@ class Block extends Position implements BlockIds, Metadatable{ return $block; } - + /** @var int */ protected $id; + /** @var int */ protected $meta = 0; /** @var string */ protected $fallbackName; @@ -460,6 +461,19 @@ class Block extends Position implements BlockIds, Metadatable{ $this->meta = $meta & 0x0f; } + /** + * Bitmask to use to remove superfluous information from block meta when getting its item form or name. + * This defaults to -1 (don't remove any data). Used to remove rotation data and bitflags from block drops. + * + * If your block should not have any meta value when it's dropped as an item, override this to return 0 in + * descendent classes. + * + * @return int + */ + public function getVariantBitmask() : int{ + return -1; + } + /** * Places the Block, using block space and block target, and side. Returns if the block has been placed. * @@ -658,7 +672,7 @@ class Block extends Position implements BlockIds, Metadatable{ */ public function getDrops(Item $item) : array{ return [ - Item::get($this->getItemId(), $this->getDamage(), 1), + Item::get($this->getItemId(), $this->getDamage() & $this->getVariantBitmask(), 1), ]; } diff --git a/src/pocketmine/block/BrewingStand.php b/src/pocketmine/block/BrewingStand.php index 329f71d61..b0bc1f6a9 100644 --- a/src/pocketmine/block/BrewingStand.php +++ b/src/pocketmine/block/BrewingStand.php @@ -44,4 +44,10 @@ class BrewingStand extends Transparent{ public function getToolType() : int{ return Tool::TYPE_PICKAXE; } + + public function getVariantBitmask() : int{ + return 0; + } + + //TODO } \ No newline at end of file diff --git a/src/pocketmine/block/BurningFurnace.php b/src/pocketmine/block/BurningFurnace.php index c4ac26b73..0afd9924a 100644 --- a/src/pocketmine/block/BurningFurnace.php +++ b/src/pocketmine/block/BurningFurnace.php @@ -118,11 +118,13 @@ class BurningFurnace extends Solid{ return true; } + public function getVariantBitmask() : int{ + return 0; + } + public function getDrops(Item $item) : array{ if($item->isPickaxe() >= Tool::TIER_WOODEN){ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + return parent::getDrops($item); } return []; diff --git a/src/pocketmine/block/Cactus.php b/src/pocketmine/block/Cactus.php index a04f37665..26a9eb35c 100644 --- a/src/pocketmine/block/Cactus.php +++ b/src/pocketmine/block/Cactus.php @@ -125,9 +125,7 @@ class Cactus extends Transparent{ return false; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + public function getVariantBitmask() : int{ + return 0; } } \ No newline at end of file diff --git a/src/pocketmine/block/Chest.php b/src/pocketmine/block/Chest.php index cf92156fe..8aa0bc328 100644 --- a/src/pocketmine/block/Chest.php +++ b/src/pocketmine/block/Chest.php @@ -169,10 +169,8 @@ class Chest extends Transparent{ return true; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + public function getVariantBitmask() : int{ + return 0; } public function getFuelTime() : int{ diff --git a/src/pocketmine/block/CocoaBlock.php b/src/pocketmine/block/CocoaBlock.php index 74c349dd9..44804c0dc 100644 --- a/src/pocketmine/block/CocoaBlock.php +++ b/src/pocketmine/block/CocoaBlock.php @@ -34,4 +34,6 @@ class CocoaBlock extends Solid{ public function getName() : string{ return "Cocoa Block"; } + + //TODO } diff --git a/src/pocketmine/block/DaylightSensor.php b/src/pocketmine/block/DaylightSensor.php index 14c41b187..f3fa72b53 100644 --- a/src/pocketmine/block/DaylightSensor.php +++ b/src/pocketmine/block/DaylightSensor.php @@ -42,4 +42,6 @@ class DaylightSensor extends Transparent{ public function getFuelTime() : int{ return 300; } + + //TODO } diff --git a/src/pocketmine/block/DetectorRail.php b/src/pocketmine/block/DetectorRail.php index d221b7c94..367ed14c0 100644 --- a/src/pocketmine/block/DetectorRail.php +++ b/src/pocketmine/block/DetectorRail.php @@ -30,4 +30,6 @@ class DetectorRail extends Rail{ public function getName() : string{ return "Detector Rail"; } + + //TODO } diff --git a/src/pocketmine/block/Door.php b/src/pocketmine/block/Door.php index fc02d773e..e9cb2f661 100644 --- a/src/pocketmine/block/Door.php +++ b/src/pocketmine/block/Door.php @@ -282,4 +282,8 @@ abstract class Door extends Transparent{ return true; } + + public function getVariantBitmask() : int{ + return 0; + } } \ No newline at end of file diff --git a/src/pocketmine/block/DoublePlant.php b/src/pocketmine/block/DoublePlant.php index b66833781..730ede9cb 100644 --- a/src/pocketmine/block/DoublePlant.php +++ b/src/pocketmine/block/DoublePlant.php @@ -104,6 +104,10 @@ class DoublePlant extends Flowable{ return false; } + public function getVariantBitmask() : int{ + return 0x07; + } + public function getDrops(Item $item) : array{ if(!$item->isShears() and ($this->meta === 2 or $this->meta === 3)){ //grass or fern if(mt_rand(0, 24) === 0){ @@ -115,8 +119,6 @@ class DoublePlant extends Flowable{ return []; } - return [ - Item::get($this->getItemId(), $this->getDamage() & 0x07, 1) - ]; + return parent::getDrops($item); } } \ No newline at end of file diff --git a/src/pocketmine/block/EnchantingTable.php b/src/pocketmine/block/EnchantingTable.php index 9cd1af2f1..5566ca113 100644 --- a/src/pocketmine/block/EnchantingTable.php +++ b/src/pocketmine/block/EnchantingTable.php @@ -92,9 +92,7 @@ class EnchantingTable extends Transparent{ public function getDrops(Item $item) : array{ if($item->isPickaxe() >= Tool::TIER_WOODEN){ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + return parent::getDrops($item); } return []; diff --git a/src/pocketmine/block/EndRod.php b/src/pocketmine/block/EndRod.php index 664469211..1653b4d4b 100644 --- a/src/pocketmine/block/EndRod.php +++ b/src/pocketmine/block/EndRod.php @@ -97,10 +97,7 @@ class EndRod extends Flowable{ return null; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getId(), 0, 1) - ]; + public function getVariantBitmask() : int{ + return 0; } - } \ No newline at end of file diff --git a/src/pocketmine/block/FenceGate.php b/src/pocketmine/block/FenceGate.php index e417da24a..1c1d23e9a 100644 --- a/src/pocketmine/block/FenceGate.php +++ b/src/pocketmine/block/FenceGate.php @@ -75,10 +75,8 @@ class FenceGate extends Transparent{ return true; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + public function getVariantBitmask() : int{ + return 0; } public function onActivate(Item $item, Player $player = null) : bool{ diff --git a/src/pocketmine/block/GlazedTerracotta.php b/src/pocketmine/block/GlazedTerracotta.php index d707c38e3..4d6638865 100644 --- a/src/pocketmine/block/GlazedTerracotta.php +++ b/src/pocketmine/block/GlazedTerracotta.php @@ -52,11 +52,13 @@ class GlazedTerracotta extends Solid{ return $this->getLevel()->setBlock($block, $this, true, true); } + public function getVariantBitmask() : int{ + return 0; + } + public function getDrops(Item $item) : array{ if($item->isPickaxe() >= Tool::TIER_WOODEN){ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + return parent::getDrops($item); } return []; diff --git a/src/pocketmine/block/Gravel.php b/src/pocketmine/block/Gravel.php index 7fc70070c..1355298b3 100644 --- a/src/pocketmine/block/Gravel.php +++ b/src/pocketmine/block/Gravel.php @@ -53,9 +53,7 @@ class Gravel extends Fallable{ ]; } - return [ - Item::get(Item::GRAVEL, 0, 1) - ]; + return parent::getDrops($item); } } \ No newline at end of file diff --git a/src/pocketmine/block/HayBale.php b/src/pocketmine/block/HayBale.php index fca892481..7acf1afd9 100644 --- a/src/pocketmine/block/HayBale.php +++ b/src/pocketmine/block/HayBale.php @@ -58,10 +58,7 @@ class HayBale extends Solid{ return true; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + public function getVariantBitmask() : int{ + return 0x03; } - } \ No newline at end of file diff --git a/src/pocketmine/block/IronBars.php b/src/pocketmine/block/IronBars.php index 2c8d1bbf0..748d58f09 100644 --- a/src/pocketmine/block/IronBars.php +++ b/src/pocketmine/block/IronBars.php @@ -46,11 +46,13 @@ class IronBars extends Thin{ return Tool::TYPE_PICKAXE; } + public function getVariantBitmask() : int{ + return 0; + } + public function getDrops(Item $item) : array{ if($item->isPickaxe() >= Tool::TIER_WOODEN){ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + return parent::getDrops($item); } return []; diff --git a/src/pocketmine/block/ItemFrame.php b/src/pocketmine/block/ItemFrame.php index f57390616..95a65855f 100644 --- a/src/pocketmine/block/ItemFrame.php +++ b/src/pocketmine/block/ItemFrame.php @@ -139,10 +139,7 @@ class ItemFrame extends Flowable{ } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + public function getVariantBitmask() : int{ + return 0; } - } \ No newline at end of file diff --git a/src/pocketmine/block/Ladder.php b/src/pocketmine/block/Ladder.php index b73293fd6..471ca6fb9 100644 --- a/src/pocketmine/block/Ladder.php +++ b/src/pocketmine/block/Ladder.php @@ -149,9 +149,7 @@ class Ladder extends Transparent{ return Tool::TYPE_AXE; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + public function getVariantBitmask() : int{ + return 0; } } \ No newline at end of file diff --git a/src/pocketmine/block/Prismarine.php b/src/pocketmine/block/Prismarine.php index 1443aa244..d7b7f7aec 100644 --- a/src/pocketmine/block/Prismarine.php +++ b/src/pocketmine/block/Prismarine.php @@ -55,11 +55,13 @@ class Prismarine extends Solid{ return Tool::TYPE_PICKAXE; } + public function getVariantBitmask() : int{ + return 0x03; + } + public function getDrops(Item $item) : array{ if($item->isPickaxe() >= Tool::TIER_WOODEN){ - return [ - Item::get($this->getItemId(), $this->getDamage() & 0x03, 1) - ]; + return parent::getDrops($item); } return []; diff --git a/src/pocketmine/block/Pumpkin.php b/src/pocketmine/block/Pumpkin.php index 882089ae7..b2501c312 100644 --- a/src/pocketmine/block/Pumpkin.php +++ b/src/pocketmine/block/Pumpkin.php @@ -56,4 +56,7 @@ class Pumpkin extends Solid{ return true; } + public function getVariantBitmask() : int{ + return 0; + } } \ No newline at end of file diff --git a/src/pocketmine/block/Quartz.php b/src/pocketmine/block/Quartz.php index 4fa8115f3..5bd4a8733 100644 --- a/src/pocketmine/block/Quartz.php +++ b/src/pocketmine/block/Quartz.php @@ -57,11 +57,13 @@ class Quartz extends Solid{ return Tool::TYPE_PICKAXE; } + public function getVariantBitmask() : int{ + return 0x03; + } + public function getDrops(Item $item) : array{ if($item->isPickaxe() >= Tool::TIER_WOODEN){ - return [ - Item::get($this->getItemId(), $this->getDamage() & 0x03, 1) - ]; + return parent::getDrops($item); } return []; diff --git a/src/pocketmine/block/Rail.php b/src/pocketmine/block/Rail.php index 041be4a59..7cbf77326 100644 --- a/src/pocketmine/block/Rail.php +++ b/src/pocketmine/block/Rail.php @@ -75,4 +75,8 @@ class Rail extends Flowable{ return false; } + + public function getVariantBitmask() : int{ + return 0; + } } diff --git a/src/pocketmine/block/Sandstone.php b/src/pocketmine/block/Sandstone.php index a9def36c6..a178e8a3d 100644 --- a/src/pocketmine/block/Sandstone.php +++ b/src/pocketmine/block/Sandstone.php @@ -55,11 +55,13 @@ class Sandstone extends Solid{ return Tool::TYPE_PICKAXE; } + public function getVariantBitmask() : int{ + return 0x03; + } + public function getDrops(Item $item) : array{ if($item->isPickaxe() >= Tool::TIER_WOODEN){ - return [ - Item::get($this->getItemId(), $this->getDamage() & 0x03, 1) - ]; + return parent::getDrops($item); } return []; diff --git a/src/pocketmine/block/SignPost.php b/src/pocketmine/block/SignPost.php index 13f66f661..9784d8ebf 100644 --- a/src/pocketmine/block/SignPost.php +++ b/src/pocketmine/block/SignPost.php @@ -114,4 +114,8 @@ class SignPost extends Transparent{ public function getToolType() : int{ return Tool::TYPE_AXE; } + + public function getVariantBitmask() : int{ + return 0; + } } \ No newline at end of file diff --git a/src/pocketmine/block/Stair.php b/src/pocketmine/block/Stair.php index 1e65c356b..e7991909c 100644 --- a/src/pocketmine/block/Stair.php +++ b/src/pocketmine/block/Stair.php @@ -145,11 +145,13 @@ abstract class Stair extends Transparent{ return true; } + public function getVariantBitmask() : int{ + return 0; + } + public function getDrops(Item $item) : array{ if($item->isPickaxe() >= Tool::TIER_WOODEN){ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + return parent::getDrops($item); } return []; diff --git a/src/pocketmine/block/StoneBricks.php b/src/pocketmine/block/StoneBricks.php index de33f72d8..0645c517b 100644 --- a/src/pocketmine/block/StoneBricks.php +++ b/src/pocketmine/block/StoneBricks.php @@ -58,9 +58,7 @@ class StoneBricks extends Solid{ public function getDrops(Item $item) : array{ if($item->isPickaxe() >= Tool::TIER_WOODEN){ - return [ - Item::get($this->getItemId(), $this->getDamage() & 0x03, 1) - ]; + return parent::getDrops($item); } return []; diff --git a/src/pocketmine/block/StoneButton.php b/src/pocketmine/block/StoneButton.php index 616d416bd..6f1c51a80 100644 --- a/src/pocketmine/block/StoneButton.php +++ b/src/pocketmine/block/StoneButton.php @@ -38,4 +38,8 @@ class StoneButton extends Flowable{ public function getHardness() : float{ return 0.5; } + + public function getVariantBitmask() : int{ + return 0; + } } diff --git a/src/pocketmine/block/StonePressurePlate.php b/src/pocketmine/block/StonePressurePlate.php index b6f1e672b..cafa7303d 100644 --- a/src/pocketmine/block/StonePressurePlate.php +++ b/src/pocketmine/block/StonePressurePlate.php @@ -42,4 +42,8 @@ class StonePressurePlate extends Transparent{ public function getHardness() : float{ return 0.5; } + + public function getVariantBitmask() : int{ + return 0; + } } diff --git a/src/pocketmine/block/Sugarcane.php b/src/pocketmine/block/Sugarcane.php index d05429113..b77274295 100644 --- a/src/pocketmine/block/Sugarcane.php +++ b/src/pocketmine/block/Sugarcane.php @@ -122,4 +122,8 @@ class Sugarcane extends Flowable{ return false; } + + public function getVariantBitmask() : int{ + return 0; + } } \ No newline at end of file diff --git a/src/pocketmine/block/Torch.php b/src/pocketmine/block/Torch.php index 52fb3aafe..33b47d082 100644 --- a/src/pocketmine/block/Torch.php +++ b/src/pocketmine/block/Torch.php @@ -93,9 +93,7 @@ class Torch extends Flowable{ return false; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + public function getVariantBitmask() : int{ + return 0; } } \ No newline at end of file diff --git a/src/pocketmine/block/Trapdoor.php b/src/pocketmine/block/Trapdoor.php index 5b5f20abd..613193ffa 100644 --- a/src/pocketmine/block/Trapdoor.php +++ b/src/pocketmine/block/Trapdoor.php @@ -140,10 +140,8 @@ class Trapdoor extends Transparent{ return true; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + public function getVariantBitmask() : int{ + return 0; } public function onActivate(Item $item, Player $player = null) : bool{ diff --git a/src/pocketmine/block/TripwireHook.php b/src/pocketmine/block/TripwireHook.php index 9a0017ae0..8bf328573 100644 --- a/src/pocketmine/block/TripwireHook.php +++ b/src/pocketmine/block/TripwireHook.php @@ -34,4 +34,10 @@ class TripwireHook extends Flowable{ public function getName() : string{ return "Tripwire Hook"; } + + public function getVariantBitmask() : int{ + return 0; + } + + //TODO } diff --git a/src/pocketmine/block/Vine.php b/src/pocketmine/block/Vine.php index 18ae763b6..893bf8073 100644 --- a/src/pocketmine/block/Vine.php +++ b/src/pocketmine/block/Vine.php @@ -174,11 +174,13 @@ class Vine extends Transparent{ return false; } + public function getVariantBitmask() : int{ + return 0; + } + public function getDrops(Item $item) : array{ if($item->isShears()){ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + return parent::getDrops($item); } return []; diff --git a/src/pocketmine/block/WaterLily.php b/src/pocketmine/block/WaterLily.php index cd47daf79..05cfa1b2b 100644 --- a/src/pocketmine/block/WaterLily.php +++ b/src/pocketmine/block/WaterLily.php @@ -80,9 +80,7 @@ class WaterLily extends Flowable{ return false; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), 0, 1) - ]; + public function getVariantBitmask() : int{ + return 0; } } \ No newline at end of file diff --git a/src/pocketmine/block/WeightedPressurePlateLight.php b/src/pocketmine/block/WeightedPressurePlateLight.php index ac4e793ad..cb43fcc9c 100644 --- a/src/pocketmine/block/WeightedPressurePlateLight.php +++ b/src/pocketmine/block/WeightedPressurePlateLight.php @@ -42,4 +42,8 @@ class WeightedPressurePlateLight extends Transparent{ public function getHardness() : float{ return 0.5; } + + public function getVariantBitmask() : int{ + return 0; + } } diff --git a/src/pocketmine/block/Wood.php b/src/pocketmine/block/Wood.php index c2d6eb7f4..2aa208bc9 100644 --- a/src/pocketmine/block/Wood.php +++ b/src/pocketmine/block/Wood.php @@ -69,10 +69,8 @@ class Wood extends Solid{ return true; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), $this->getDamage() & 0x03, 1) - ]; + public function getVariantBitmask() : int{ + return 0x03; } public function getToolType() : int{ diff --git a/src/pocketmine/block/WoodenDoor.php b/src/pocketmine/block/WoodenDoor.php index 8d946d458..d49f4f74c 100644 --- a/src/pocketmine/block/WoodenDoor.php +++ b/src/pocketmine/block/WoodenDoor.php @@ -35,10 +35,4 @@ class WoodenDoor extends Door{ public function getToolType() : int{ return Tool::TYPE_AXE; } - - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), 0, 1) - ]; - } } \ No newline at end of file diff --git a/src/pocketmine/block/WoodenSlab.php b/src/pocketmine/block/WoodenSlab.php index 7fe17c536..862cdd60f 100644 --- a/src/pocketmine/block/WoodenSlab.php +++ b/src/pocketmine/block/WoodenSlab.php @@ -129,10 +129,8 @@ class WoodenSlab extends Transparent{ return Tool::TYPE_AXE; } - public function getDrops(Item $item) : array{ - return [ - Item::get($this->getItemId(), $this->getDamage() & 0x07, 1) - ]; + public function getVariantBitmask() : int{ + return 0x07; } public function getFuelTime() : int{ diff --git a/src/pocketmine/block/WoodenStairs.php b/src/pocketmine/block/WoodenStairs.php index 7fdd138ef..2d2c216c2 100644 --- a/src/pocketmine/block/WoodenStairs.php +++ b/src/pocketmine/block/WoodenStairs.php @@ -40,9 +40,14 @@ class WoodenStairs extends Stair{ return Tool::TYPE_AXE; } + public function getVariantBitmask() : int{ + return 0; + } + public function getDrops(Item $item) : array{ + //TODO: Hierarchy problem (base class is for stone stairs) return [ - Item::get($this->getItemId(), 0, 1) + Item::get($this->getItemId(), $this->getDamage() & $this->getVariantBitmask(), 1) ]; } } \ No newline at end of file