mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Implement fortune enchantment (#5757)
This commit is contained in:
@ -23,9 +23,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\utils\FortuneDropHelper;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\VanillaItems;
|
||||
use function mt_rand;
|
||||
use function min;
|
||||
|
||||
class Glowstone extends Transparent{
|
||||
|
||||
@ -35,7 +36,7 @@ class Glowstone extends Transparent{
|
||||
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
return [
|
||||
VanillaItems::GLOWSTONE_DUST()->setCount(mt_rand(2, 4))
|
||||
VanillaItems::GLOWSTONE_DUST()->setCount(min(4, FortuneDropHelper::discrete($item, 2, 4)))
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user