Skip to content

Commit

Permalink
🐛 fix(enchant-rune): closes #527
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Jun 11, 2022
1 parent 242b786 commit 02f3761
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,15 @@ private void addRandomEnchantment(@Nonnull Player p, @Nonnull Item rune) {
l.getWorld().playSound(l, Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1F, 1F);

item.remove();
rune.remove();

// When multiple runes have been merged, reduce one rune.
if (rune.getItemStack().getAmount() > 1) {
ItemStack runeCopy = rune.getItemStack();
runeCopy.setAmount(runeCopy.getAmount() - 1);
rune.setItemStack(runeCopy);
} else {
rune.remove();
}

if (enchantment.canEnchantItem(itemStack)) {
itemStack.addEnchantment(enchantment, level);
Expand Down

0 comments on commit 02f3761

Please sign in to comment.