From b4decddd4b7dbab39a706d22b4e5014f9679aaf3 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 8 Jul 2016 14:29:12 +0200 Subject: [PATCH] TiCon tools lose their broken tag when repairing them in an item repairer Closes #142 --- .../mod/tile/TileEntityItemRepairer.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java index 4b9c8fb5c..496af3794 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java @@ -77,9 +77,10 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I public void updateEntity(){ super.updateEntity(); if(!this.worldObj.isRemote){ - if(this.slots[SLOT_OUTPUT] == null && canBeRepaired(this.slots[SLOT_INPUT])){ - if(this.slots[SLOT_INPUT].getItemDamage() <= 0){ - this.slots[SLOT_OUTPUT] = this.slots[SLOT_INPUT].copy(); + ItemStack input = this.slots[SLOT_INPUT]; + if(this.slots[SLOT_OUTPUT] == null && canBeRepaired(input)){ + if(input.getItemDamage() <= 0){ + this.slots[SLOT_OUTPUT] = input.copy(); this.slots[SLOT_INPUT] = null; this.nextRepairTick = 0; } @@ -89,7 +90,15 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I this.storage.extractEnergy(ENERGY_USE, false); if(this.nextRepairTick >= 2){ this.nextRepairTick = 0; - this.slots[SLOT_INPUT].setItemDamage(this.slots[SLOT_INPUT].getItemDamage()-1); + input.setItemDamage(input.getItemDamage()-1); + + if(input.hasTagCompound()){ + //TiCon un-break tools + if("tconstruct".equalsIgnoreCase(input.getItem().getRegistryName().getResourceDomain())){ + NBTTagCompound stats = input.getTagCompound().getCompoundTag("Stats"); + stats.removeTag("Broken"); + } + } } } }