Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't have a Tool Material with the same name #115

Closed
KAMKEEL opened this issue Feb 6, 2024 · 3 comments
Closed

Can't have a Tool Material with the same name #115

KAMKEEL opened this issue Feb 6, 2024 · 3 comments

Comments

@KAMKEEL
Copy link
Contributor

KAMKEEL commented Feb 6, 2024

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.

@KAMKEEL KAMKEEL changed the title Can't have a Tool Material with the same name | Plugin Mod used an example Can't have a Tool Material with the same name Feb 6, 2024
@KAMKEEL
Copy link
Contributor Author

KAMKEEL commented Feb 6, 2024

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.

@KAMKEEL
Copy link
Contributor Author

KAMKEEL commented Feb 6, 2024

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

Both Onyx Tools from Different Mods overwriting each other with lwjgl3ify

@KAMKEEL
Copy link
Contributor Author

KAMKEEL commented Feb 6, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant