lwjgl3ify

lwjgl3ify

1.6k Downloads

Can't have a Tool Material with the same name

KAMKEEL opened this issue ยท 3 comments

commented

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:

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.

commented

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.

commented

2024-02-06_14 16 33
2024-02-06_14 16 34

Both Onyx Tools from Different Mods overwriting each other with lwjgl3ify

commented

2024-02-06_14 21 10
2024-02-06_14 21 11

Both Onyx Tools from Different Mods NOT overwriting each other without lwjgl3ify running on Java 8 now.