Allow for sword repairability
@@ -2,6 +2,7 @@ package mekanism.tools.item;
import java.util.List;
+import mekanism.api.util.StackUtils;
import mekanism.common.Mekanism;
import mekanism.common.util.LangUtils;
import net.minecraft.entity.player.EntityPlayer;
@@ -10,9 +11,12 @@ import net.minecraft.item.ItemSword;
public class ItemMekanismSword extends ItemSword
{
+ private ToolMaterial toolMaterial;
+
public ItemMekanismSword(ToolMaterial enumtoolmaterial)
{
super(enumtoolmaterial);
+ toolMaterial = enumtoolmaterial;
setCreativeTab(Mekanism.tabMekanism);
}
@@ -21,4 +25,10 @@ public class ItemMekanismSword extends ItemSword
{
list.add(LangUtils.localize("tooltip.hp") + ": " + (itemstack.getMaxDamage() - itemstack.getItemDamage()));
}
+
+ @Override
+ public boolean getIsRepairable(ItemStack stack1, ItemStack stack2)
+ {
+ return StackUtils.equalsWildcard(ItemMekanismTool.getRepairStack(toolMaterial), stack2) ? true : super.getIsRepairable(stack1, stack2);
+ }
}
