mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 05:55:33 +00:00
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:
parent
d93ded9047
commit
8aff793a4f
@ -173,7 +173,10 @@ class Leaves extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item) : array{
|
||||
if(!$this->isCompatibleWithTool($item)){
|
||||
if($item->getBlockToolType() & BlockToolType::TYPE_SHEARS){
|
||||
return $this->getDropsForCompatibleTool($item);
|
||||
}
|
||||
|
||||
$drops = [];
|
||||
if(mt_rand(1, 20) === 1){ //Saplings
|
||||
$drops[] = $this->getSaplingItem();
|
||||
@ -185,9 +188,6 @@ class Leaves extends Transparent{
|
||||
return $drops;
|
||||
}
|
||||
|
||||
return parent::getDrops($item);
|
||||
}
|
||||
|
||||
public function getSaplingItem() : Item{
|
||||
return ItemFactory::get(Item::SAPLING, $this->getVariant());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user