Search in sources :

Example 1 with ItemGlowstoneDust

use of cn.nukkit.item.ItemGlowstoneDust in project Nukkit by Nukkit.

the class BlockGlowstone method getDrops.

@Override
public Item[] getDrops(Item item) {
    Random random = new Random();
    int count = 2 + random.nextInt(3);
    Enchantment fortune = item.getEnchantment(Enchantment.ID_FORTUNE_DIGGING);
    if (fortune != null && fortune.getLevel() >= 1) {
        count += random.nextInt(fortune.getLevel() + 1);
    }
    return new Item[] { new ItemGlowstoneDust(0, MathHelper.clamp(count, 1, 4)) };
}
Also used : Item(cn.nukkit.item.Item) Random(java.util.Random) ItemGlowstoneDust(cn.nukkit.item.ItemGlowstoneDust) Enchantment(cn.nukkit.item.enchantment.Enchantment)

Aggregations

Item (cn.nukkit.item.Item)1 ItemGlowstoneDust (cn.nukkit.item.ItemGlowstoneDust)1 Enchantment (cn.nukkit.item.enchantment.Enchantment)1 Random (java.util.Random)1