use of net.glowstone.constants.GlowEnchantment in project Glowstone by GlowstoneMC.
the class EnchantmentManager method getAllPossibleEnchants.
private static List<LeveledEnchant> getAllPossibleEnchants(ItemStack item, int modifier, int cost) {
List<LeveledEnchant> enchantments = new ArrayList<>();
boolean isBook = item.getType() == Material.BOOK;
for (Enchantment enchantment : Enchantment.values()) {
if (isBook || enchantment.canEnchantItem(item)) {
for (int level = enchantment.getStartLevel(); level <= enchantment.getMaxLevel(); level++) {
if (((GlowEnchantment) enchantment).isInRange(level, modifier)) {
enchantments.add(new LeveledEnchant(enchantment, level, cost));
}
}
}
}
return enchantments;
}
Aggregations