diff --git a/src/pocketmine/block/Bed.php b/src/pocketmine/block/Bed.php index 0e98356f1..658433ab1 100644 --- a/src/pocketmine/block/Bed.php +++ b/src/pocketmine/block/Bed.php @@ -184,17 +184,13 @@ class Bed extends Transparent{ public function getDropsForCompatibleTool(Item $item) : array{ if($this->isHeadPart()){ - return [$this->getItem()]; + return parent::getDropsForCompatibleTool($item); } return []; } - public function getPickedItem() : Item{ - return $this->getItem(); - } - - private function getItem() : Item{ + public function getItem() : Item{ $tile = $this->getLevel()->getTile($this); if($tile instanceof TileBed){ return ItemFactory::get($this->getItemId(), $tile->getColor()); diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 1cfcf5ce1..95973a8c2 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -120,6 +120,10 @@ class Block extends Position implements BlockIds, Metadatable{ return $this->id; } + public function getItem() : Item{ + return ItemFactory::get($this->getItemId(), $this->getVariant()); + } + /** * @internal * @return int @@ -127,7 +131,6 @@ class Block extends Position implements BlockIds, Metadatable{ public function getRuntimeId() : int{ return BlockFactory::toStaticRuntimeId($this->getId(), $this->getDamage()); } - /** * @return int */ @@ -467,9 +470,7 @@ class Block extends Position implements BlockIds, Metadatable{ * @return Item[] */ public function getDropsForCompatibleTool(Item $item) : array{ - return [ - ItemFactory::get($this->getItemId(), $this->getVariant()) - ]; + return [$this->getItem()]; } /** @@ -480,9 +481,7 @@ class Block extends Position implements BlockIds, Metadatable{ * @return Item[] */ public function getSilkTouchDrops(Item $item) : array{ - return [ - ItemFactory::get($this->getItemId(), $this->getVariant()) - ]; + return [$this->getItem()]; } /** @@ -524,7 +523,7 @@ class Block extends Position implements BlockIds, Metadatable{ * @return Item */ public function getPickedItem() : Item{ - return ItemFactory::get($this->getItemId(), $this->getVariant()); + return $this->getItem(); } /** diff --git a/src/pocketmine/block/Skull.php b/src/pocketmine/block/Skull.php index 8eb9677e9..e676b57ab 100644 --- a/src/pocketmine/block/Skull.php +++ b/src/pocketmine/block/Skull.php @@ -83,20 +83,12 @@ class Skull extends Flowable{ return false; } - private function getItem() : Item{ + public function getItem() : Item{ $tile = $this->level->getTile($this); return ItemFactory::get(Item::SKULL, $tile instanceof TileSkull ? $tile->getType() : 0); } - public function getDropsForCompatibleTool(Item $item) : array{ - return [$this->getItem()]; - } - public function isAffectedBySilkTouch() : bool{ return false; } - - public function getPickedItem() : Item{ - return $this->getItem(); - } }