Fix drops for leaves, close #1821

Seems that leaves are another special case - they technically speaking accept any tool to break, but only drop when shears are used. They don't REQUIRE shears because if they did the break time would be longer for non-shears tools.
This commit is contained in:
Dylan K. Taylor 2017-12-15 10:14:24 +00:00
parent d93ded9047
commit 8aff793a4f

View File

@ -173,19 +173,19 @@ class Leaves extends Transparent{
}
public function getDrops(Item $item) : array{
if(!$this->isCompatibleWithTool($item)){
$drops = [];
if(mt_rand(1, 20) === 1){ //Saplings
$drops[] = $this->getSaplingItem();
}
if($this->canDropApples() and mt_rand(1, 200) === 1){ //Apples
$drops[] = ItemFactory::get(Item::APPLE);
}
return $drops;
if($item->getBlockToolType() & BlockToolType::TYPE_SHEARS){
return $this->getDropsForCompatibleTool($item);
}
return parent::getDrops($item);
$drops = [];
if(mt_rand(1, 20) === 1){ //Saplings
$drops[] = $this->getSaplingItem();
}
if($this->canDropApples() and mt_rand(1, 200) === 1){ //Apples
$drops[] = ItemFactory::get(Item::APPLE);
}
return $drops;
}
public function getSaplingItem() : Item{