MoriTanosuke / nadiamiona

Minecraft mod
0 stars 0 forks source link

Excavator is not repairable #31

Closed MoriTanosuke closed 6 years ago

MoriTanosuke commented 6 years ago

The excavator with a couple enchantments costs up to 60+ levels to repair in an anvil. I don't understand the repair costs yet, but I suspect it got something to do with the ToolMaterial (Diamond) and the max damage (2x diamond).

MoriTanosuke commented 6 years ago

Solution would be to introduce a custom material and override the repair item. Forge already prepared for this in net.minecraft.item.Item.ToolMaterial#setRepairItem.

To create a new material:

public static ToolMaterial TUTORIAL = EnumHelper.addToolMaterial("TUTORIAL", harvestLevel, durability, miningSpeed, damageVsEntities, enchantability);

Taken from https://bedrockminer.jimdo.com/modding-tutorials/basic-modding-1-8/custom-tools-swords/

MoriTanosuke commented 6 years ago

A new ToolMaterial is not the final solution. The experience costs are still calculated in ContainerRepair and is stored in net.minecraft.inventory.ContainerRepair#maximumCost.

I'm not sure if it's possible to register a listener in the ContainerRepair to modify the values before minecraft applies them... 😕

MoriTanosuke commented 6 years ago

One workaround while playing is using the Mending enchantment. Other than that the Excavator was meant to be really expensive. If this is not for you, maybe add the mod OreExcavation.