WolfyScript / CustomCrafting-Wiki

Wiki and JavaDocs for CustomCrafting
https://www.spigotmc.org/resources/55883/
9 stars 3 forks source link

Custom item's localized name not working #17

Open Sylfare opened 3 years ago

Sylfare commented 3 years ago

Describe the bug You can't set a localized name to a custom item: the name doesn't change.

To Reproduce Steps to reproduce the behavior:

  1. Get any item (e. g. a diamond)
  2. Execute /cc, then go to the Item Creator
  3. Put the item in the item slot
  4. Click on "Localized Name", then "Set Localized Name:"
  5. Type any localization key in chat, like minecraft.item.cookie.

Expected behavior The edited object should have the localized name.

Screenshots Setting the localized name setting the localized name

The name is not correct the name is not correct

The saved item in the inventory the saved object

Server (please complete the following information):

Additional context The generated item has this display tag: display: {LocName: '{"extra":[{"clickEvent":"action":"open_url","value":"http://item.minecraft.cookie"},"text":"item.minecraft.cookie"}],"text":""}'}. However, the LocName tag seems to be deprecated. The translate tag should used instead. You can give yourself an item with the correct name with this command: /give @s diamond{display:{Name:'{"translate":"item.minecraft.cookie"}'}} 1

a localized diamond

WolfyScript commented 3 years ago

ok, I am just using the Spigot API to set the localized name... Looks like Spigot still sets the deprecated value to the item. I will have a look at how I can fix that.

WolfyScript commented 3 years ago

I think I found a solution... but it requires Paper. Well, I got it working a bit in Spigot. Only issue is that spigot converts the tag '{"translate":"item.minecraft.cookie"}' to the actual text it outputs... I'll see what I can do.