From 107192c75310b4f6918ad3a26cc81cc704825e8d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 18 Sep 2018 12:31:53 +0100 Subject: [PATCH] Bed: fixed block-pick giving wrong colour items --- src/pocketmine/block/Bed.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/pocketmine/block/Bed.php b/src/pocketmine/block/Bed.php index 8a3131616..626d7a63a 100644 --- a/src/pocketmine/block/Bed.php +++ b/src/pocketmine/block/Bed.php @@ -192,21 +192,25 @@ class Bed extends Transparent{ public function getDropsForCompatibleTool(Item $item) : array{ if($this->isHeadPart()){ - $tile = $this->getLevel()->getTile($this); - if($tile instanceof TileBed){ - return [ - ItemFactory::get($this->getItemId(), $tile->getColor()) - ]; - }else{ - return [ - ItemFactory::get($this->getItemId(), 14) //Red - ]; - } + return [$this->getItem()]; } return []; } + public function getPickedItem() : Item{ + return $this->getItem(); + } + + private function getItem() : Item{ + $tile = $this->getLevel()->getTile($this); + if($tile instanceof TileBed){ + return ItemFactory::get($this->getItemId(), $tile->getColor()); + } + + return ItemFactory::get($this->getItemId(), 14); //Red + } + public function isAffectedBySilkTouch() : bool{ return false; }