Darkhax-Minecraft / Enchantment-Descriptions

Displays descriptions about an enchantment on the tooltip.
99 stars 50 forks source link

[BUG] desc doesn't show with custom Fullname #244

Open FOOLSIX opened 1 month ago

FOOLSIX commented 1 month ago

Minecraft Version

1.19.2

Mod Version

13.0.20

Mod Loader

Forge

What environment are you running the mod in?

Client

Issue Description

I'm a new modder and making my enchantment mod. For some reason, I override Enchantment#getFullname and modify the displayed name, and then found that the desc of these enchantments is not displayed. All other enchantments whose names have not been changed are ok. My Code info (My JEI plugin reads and shows desc correctly, but this mod does not)

Darkhax commented 1 month ago

Hello, this mod relies on the enchantment name to locate where the description should be inserted. In your case the curse prefix breaks this logic so it can't find where to insert the description. It's not an ideal approach but it's from before mixins were widely used. You can see the code here. This will be improved in 1.21 but I am not sure about 1.19.2.

FOOLSIX commented 1 month ago

Thank you for your prompt reply. I understand now, my prefix has become the contents of this line's Component, and the description ID has been placed in the siblings. Is it possible for this to be improved in versions 1.19.2 and 1.20.1? Or it would be better if I changed the prefix to a suffix?

Darkhax commented 1 month ago

I just released a new update for 1.20.1. If this fix works I can backport it to 1.19.2 as well.

FOOLSIX commented 1 month ago

It seems that the build was not successful, 1.20.1 update was not released.But the code looks fine

Darkhax commented 1 month ago

Thanks, looks like some bad code snuck into that commit. It's fixed and available now as 17.1.18.

FOOLSIX commented 1 month ago

I tested it. It looks like it's working well. Thank you for your support. <3

desc