Closed OnmyojiOmn closed 8 years ago
Sorry about that crash, I'll have a look at what I need to do to get that output stack proper, it's something that happens automatically for an ItemTool I think so I haven't had a look at at and it isn't something I use so I haven't come across this in my own play. As for repairing them, it should work in the anvil with the valid block used to make the tool. Can you post a screenshot of a damaged hammer with it's respective block in the anvil to confirm?
I found the culprit for the crash, and it's poor design on vanilla's part. Not entirely my fault but something I would have checked if I had known it would cause an issue. In CraftingManager this is the block of code that tries to repair two items. I depend on the existence of the nbt tag that goes with the itemstack for determining what type of hammer it is, and they could definitely do this better. isRepairable() is something that returns true by default for any item that is damageable.
if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isRepairable())
{
Item item = itemstack2.getItem();
int j = item.getMaxDamage() - itemstack2.getItemDamage();
int k = item.getMaxDamage() - itemstack3.getItemDamage();
int l = j + k + item.getMaxDamage() * 5 / 100;
int i1 = item.getMaxDamage() - l;
if (i1 < 0)
{
i1 = 0;
}
return new ItemStack(itemstack2.getItem(), 1, i1);
}
Repairing a hammer by crafting two of the same type results in an invalid, grayed-out item. If the item is taken out of the crafting table and placed in the inventory the game crashes. Attempting to load that world will also crash the game.
Also, the description of the mod implies that repairing is done with an ingot/block similarly to TiC tools, but that doesn't seem to work.