Can't have a Tool Material with the same name
KAMKEEL opened this issue ยท 3 comments
Just ran my client in Singleplayer with EXACT same configs and EXACT mods.
Only difference was lwjgl3ify
and Java 17
My PluginMod registered Tool Materials like this:
public static Item.ToolMaterial glass = EnumHelper.addToolMaterial("GLASS", EnumToolMaterials.GLASS.getHarvestLevel(), EnumToolMaterials.GLASS.getMaxUses(), EnumToolMaterials.GLASS.getEfficiencyOnProperMaterial(), EnumToolMaterials.GLASS.getDamageVsEntity(), EnumToolMaterials.GLASS.getEnchantability());
public static Item.ToolMaterial custom_glass = EnumHelper.addToolMaterial("GLASS", EnumToolMaterials.GLASS.getHarvestLevel(), EnumToolMaterials.UNIQUEMATERIAL.getMaxUses(), EnumToolMaterials.GLASS.getEfficiencyOnProperMaterial(), 7, 0);
Which worked correctly without lwjgl3ify
, the durability of my Glass Tool with ToolMaterial glass
had 20K Durability and my Glass Weapon with ToolMaterial custom_glass
had 32K durability.
However, in Java 17 with lwjgl3ify
, because both ToolMaterials
were named "GLASS"
all the glass items had 20K durability instead of having their specific 20K or 32K durability. I was easily able to resolve this by changing the
EnumHelper.addToolMaterial("GLASS"
to EnumHelper.addToolMaterial("UNIQUE_GLASS"
, but I'm not sure if this bug will show up in many other mods that do this type of naming, or if names end up overlapping at all.
You can replicate it yourself:
- Plugin Mod V 5.1 Before Change
- Plugin Mod V 5.2 After Change
Commit that resolved in my mod commit
The item named Blue Longsword
should have 32000
durability and in version 5.1
with lwjgl3ify
will have 1200
the same durability as BLUE_STEEL
material.
Also, can confirm it does effect mods interacting if they have the same name.
"Onyx" in one mod with 550 durability and stats -- If registered first, will overwrite
"Onyx" in another mod that is supposed to have 1200 durability.