Skip to content

Material.getMaxDurability() is always 0 #85

@attrib

Description

@attrib

I got a Bug Report from a User which is using my Plugin - attrib/RepairRecipe#29
I tried to investigate it further and discovered that on a Material of a custom item added by Metallurgy the getMaxDurability is always 0. So somewhere on the Item creation there is going something wrong.

I looked through the code of Metallurgy, but I'm not sure where the Problem is.
In metallurgy/core/metalsets/OreInfo.java:

    toolDura = config.get(name + ".Tool Info", "Durability", toolDura).getInt();

The config file is there and there is a value in the config.

Otherwise I think the problem is here:

    EnumToolMaterial toolEnum = EnumHelper.addToolMaterial(name, pickLvl, 
toolDura, toolSpeed, toolDamage, toolEnchant);

As this comes from Forge there is a possibility the durability is not set in the Enum correctley. Minecraft is calling a method on this enum to retriev the max durabillity.

If you want to reproduce it just the Material of a Item and call getMaxDurability. Best to test is hooking into the CraftItem Event (at least in Bukkit, I have no clue about Forge...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions