Cleaned up non-trivial getDrops() stuff

This commit is contained in:
Dylan K. Taylor
2017-12-13 14:47:50 +00:00
parent 90eed14cd6
commit 717b36a983
5 changed files with 48 additions and 28 deletions

View File

@ -173,19 +173,19 @@ class Leaves extends Transparent{
}
public function getDrops(Item $item) : array{
if($item->isShears()){
return parent::getDrops($item);
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, 0, 1);
}
return $drops;
}
$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, 0, 1);
}
return $drops;
return parent::getDrops($item);
}
public function getSaplingItem() : Item{