diff --git a/pom.xml b/pom.xml index d3d3350..31d0837 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ cn.wode490390.nukkit vipop jar - 1.0.2-IGN.1 + 1.0.2-IGN.2 Classic Village Populator This is a plugin that implements the old village feature for Nukkit servers http://wode490390.cn/ diff --git a/src/main/java/cn/wode490390/nukkit/vipop/loot/RandomizableContainer.java b/src/main/java/cn/wode490390/nukkit/vipop/loot/RandomizableContainer.java index ac46a7f..c89831a 100644 --- a/src/main/java/cn/wode490390/nukkit/vipop/loot/RandomizableContainer.java +++ b/src/main/java/cn/wode490390/nukkit/vipop/loot/RandomizableContainer.java @@ -36,7 +36,11 @@ public void create(ListTag list, NukkitRandom random) { int index = random.nextBoundedInt(tags.length); Item item = Item.get(entry.getId(), entry.getMeta(), random.nextRange(entry.getMinCount(), entry.getMaxCount())); if (item.getId() == Item.ENCHANT_BOOK) { - item.addEnchantment(Enchantment.getEnchantment(ThreadLocalRandom.current().nextInt(37))); + Enchantment enchantment = Enchantment.getEnchantment(ThreadLocalRandom.current().nextInt(36)); + if (ThreadLocalRandom.current().nextDouble() < 0.3) { + enchantment.setLevel(ThreadLocalRandom.current().nextInt(enchantment.getMaxLevel() + 1)); + } + item.addEnchantment(enchantment); } tags[index] = NBTIO.putItemHelper(item, index); break;