mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +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,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{
|
||||
|
Loading…
x
Reference in New Issue
Block a user