Skip to content

Commit

Permalink
Ench
Browse files Browse the repository at this point in the history
  • Loading branch information
PetteriM1 committed Apr 5, 2023
1 parent 5e7f229 commit f8e6b89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>cn.wode490390.nukkit</groupId>
<artifactId>vipop</artifactId>
<packaging>jar</packaging>
<version>1.0.2-IGN.1</version>
<version>1.0.2-IGN.2</version>
<name>Classic Village Populator</name>
<description>This is a plugin that implements the old village feature for Nukkit servers</description>
<url>http://wode490390.cn/</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ public void create(ListTag<CompoundTag> 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;
Expand Down

0 comments on commit f8e6b89

Please sign in to comment.