From b76b9d53fedd694874444a9dbe2b319311d75b3a Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 27 Sep 2017 10:49:39 +0100 Subject: [PATCH] Fixed drops for DeadBush --- src/pocketmine/block/DeadBush.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/block/DeadBush.php b/src/pocketmine/block/DeadBush.php index 380ed8b65..5267df76e 100644 --- a/src/pocketmine/block/DeadBush.php +++ b/src/pocketmine/block/DeadBush.php @@ -23,6 +23,9 @@ declare(strict_types=1); namespace pocketmine\block; +use pocketmine\item\Item; +use pocketmine\item\ItemFactory; +use pocketmine\item\Tool; use pocketmine\level\Level; use pocketmine\math\Vector3; @@ -38,7 +41,6 @@ class DeadBush extends Flowable{ return "Dead Bush"; } - public function onUpdate(int $type){ if($type === Level::BLOCK_UPDATE_NORMAL){ if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){ @@ -51,4 +53,17 @@ class DeadBush extends Flowable{ return false; } + public function getToolType() : int{ + return Tool::TYPE_SHEARS; + } + + public function getDrops(Item $item) : array{ + if($item->isShears()){ + return parent::getDrops($item); + } + + return [ + ItemFactory::get(Item::STICK, 0, mt_rand(0, 2)) + ]; + } } \ No newline at end of file