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:
@ -35,19 +35,22 @@ class Leaves2 extends Leaves{
|
||||
self::ACACIA => "Acacia Leaves",
|
||||
self::DARK_OAK => "Dark Oak Leaves",
|
||||
];
|
||||
return $names[$this->meta & 0x01];
|
||||
return $names[$this->meta & 0x03] ?? "Unknown";
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
$drops = [];
|
||||
public function getDrops(Item $item) : array{
|
||||
$variantMeta = $this->getDamage() & 0x03;
|
||||
|
||||
if($item->isShears()){
|
||||
$drops[] = [$this->id, $this->meta & 0x01, 1];
|
||||
}else{
|
||||
if(mt_rand(1, 20) === 1){ //Saplings
|
||||
$drops[] = [Item::SAPLING, ($this->meta & 0x01) + 4, 1];
|
||||
}
|
||||
return [
|
||||
Item::get($this->getItemId(), $variantMeta, 1)
|
||||
];
|
||||
}elseif(mt_rand(1, 20) === 1){ //Saplings
|
||||
return [
|
||||
Item::get(Item::SAPLING, $variantMeta + 4, 1)
|
||||
];
|
||||
}
|
||||
|
||||
return $drops;
|
||||
return [];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user