Search in sources :

Example 1 with ItemRedstone

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

the class BlockOreRedstone method getDrops.

@Override
public Item[] getDrops(Item item) {
    if (item.isPickaxe() && item.getTier() >= ItemTool.TIER_IRON) {
        int count = new Random().nextInt(2) + 4;
        Enchantment fortune = item.getEnchantment(Enchantment.ID_FORTUNE_DIGGING);
        if (fortune != null && fortune.getLevel() >= 1) {
            count += new Random().nextInt(fortune.getLevel() + 1);
        }
        return new Item[] { new ItemRedstone(0, count) };
    } else {
        return new Item[0];
    }
}
Also used : Item(cn.nukkit.item.Item) NukkitRandom(cn.nukkit.math.NukkitRandom) Random(java.util.Random) Enchantment(cn.nukkit.item.enchantment.Enchantment) ItemRedstone(cn.nukkit.item.ItemRedstone)

Aggregations

Item (cn.nukkit.item.Item)1 ItemRedstone (cn.nukkit.item.ItemRedstone)1 Enchantment (cn.nukkit.item.enchantment.Enchantment)1 NukkitRandom (cn.nukkit.math.NukkitRandom)1 Random (java.util.Random)1