So I'm learning to mod, and I've made a couple new materials, Silver and Electrum. Everything works but repair; i.e the pickaxes function as a normal pickaxe except they can't be repaired at an anvil. I want to make them repairable as well as enchantable and I want to do this so that I only need to make one pickaxe class. I need to keep each tool an extension of the vanilla tool class so it can be enchanted. The only way I can get the tools repairable with these requirements is by changing this:
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{
return this.toolMaterial.getToolCraftingMaterial() == par2ItemStack.itemID ? true : super.getIsRepairable(par1ItemStack, par2ItemStack);
}
To this:
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{
return SunMod.silverIngot.itemID == par2ItemStack.itemID ? true : super.getIsRepairable(par1ItemStack, par2ItemStack);
}
But of course when I make an Electrum tool, this makes it repairable only by silver ingots, which is obviously not correct. If that's the only way to do it that means I have to make a new class for every tool from every material, which I'd like to avoid. Another way is editing the base classes, but I'd really like to avoid that if possible.
Can anyone help?
Here's my pickaxe class:
And my main mod class:
Thanks!