From b85d2a77b4c8cca556c038a7496f1f265946faf0 Mon Sep 17 00:00:00 2001 From: bconlon Date: Fri, 19 Jun 2020 01:53:12 -0700 Subject: [PATCH] Fixed various bugs with enchanting. NBT is now kept when repairing, unstackable items will no longer stack from enchanting, and outputs will no longer increase in stack size greater than the amount put in. --- .../legacy/aether/tileentity/TileEntityEnchanter.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/legacy/aether/tileentity/TileEntityEnchanter.java b/src/main/java/com/legacy/aether/tileentity/TileEntityEnchanter.java index ef690d4..e2c78af 100644 --- a/src/main/java/com/legacy/aether/tileentity/TileEntityEnchanter.java +++ b/src/main/java/com/legacy/aether/tileentity/TileEntityEnchanter.java @@ -64,8 +64,13 @@ public class TileEntityEnchanter extends AetherTileEntity { EnchantmentHelper.setEnchantments(EnchantmentHelper.getEnchantments(this.getStackInSlot(0)), result); - if (this.getStackInSlot(2) != null) { - result.stackSize += (this.getStackInSlot(2).stackSize + 1); + if (this.getStackInSlot(0).hasTagCompound()) + { + result.setTagCompound(this.getStackInSlot(0).getTagCompound()); + } + + if (this.getStackInSlot(2) != null && this.getStackInSlot(2).isStackable()) { + result.stackSize += (this.getStackInSlot(2).stackSize); this.setInventorySlotContents(2, result); } else { @@ -105,7 +110,7 @@ public class TileEntityEnchanter extends AetherTileEntity { AetherEnchantment enchantment = AetherAPI.instance().getEnchantment(itemstack); if (enchantment != null) { - if (this.getStackInSlot(2) == null || (enchantment.getOutput().getItem() == this.getStackInSlot(2).getItem() && enchantment.getOutput().getItemDamage() == this.getStackInSlot(2).getItemDamage())) { + if (this.getStackInSlot(2) == null || (enchantment.getOutput().getItem() == this.getStackInSlot(2).getItem() && enchantment.getOutput().getItemDamage() == this.getStackInSlot(2).getItemDamage() && this.getStackInSlot(2).isStackable())) { this.currentEnchantment = enchantment; this.ticksRequired = this.currentEnchantment.getTimeRequired(); this.addEnchantmentWeight(itemstack);