mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Changed Block->getDrops() to return Item[]
This commit is contained in:
@ -164,16 +164,19 @@ class Leaves extends Transparent{
|
||||
return $this->getLevel()->setBlock($this, $this, true);
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
public function getDrops(Item $item) : array{
|
||||
$drops = [];
|
||||
|
||||
$variantMeta = $this->getDamage() & 0x03;
|
||||
|
||||
if($item->isShears()){
|
||||
$drops[] = [$this->id, $this->meta & 0x03, 1];
|
||||
$drops[] = Item::get($this->getItemId(), $variantMeta, 1);
|
||||
}else{
|
||||
if(mt_rand(1, 20) === 1){ //Saplings
|
||||
$drops[] = [Item::SAPLING, $this->meta & 0x03, 1];
|
||||
$drops[] = Item::get(Item::SAPLING, $variantMeta, 1);
|
||||
}
|
||||
if(($this->meta & 0x03) === self::OAK and mt_rand(1, 200) === 1){ //Apples
|
||||
$drops[] = [Item::APPLE, 0, 1];
|
||||
if($variantMeta === self::OAK and mt_rand(1, 200) === 1){ //Apples
|
||||
$drops[] = Item::get(Item::APPLE, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user