-
-
Notifications
You must be signed in to change notification settings - Fork 148
Closed
Labels
Description
How do I get the translate key using adventure?
What I want to end up with is block.minecraft.anvil
At present, I can only use this stupid method to get it, and when the item is renamed, the Component of the two seems to be different, which makes me puzzled...
String json = GsonComponentSerializer.gson().serialize(item.displayName());
JSONObject jsonObject = new JSONObject(json);
String key = jsonObject
.getJSONArray("with")
.getJSONObject(0)
.getJSONArray("extra")
.getJSONObject(0)
.getString("translate");Use anvil and rename it to test as an example
before renaming
{"color":"white","hoverEvent":{"action":"show_item","contents":{"id":"minecraft:anvil"}},"translate":"chat.square_brackets","with":[{"extra":[{"translate":"block.minecraft.anvil"}],"text":""}]}
after renaming
{"color":"white","hoverEvent":{"action":"show_item","contents":{"id":"minecraft:anvil","tag":"{display:{Name:\u0027{\"text\":\"test\"}\u0027}}"}},"translate":"chat.square_brackets","with":[{"italic":true,"extra":[{"text":"test"}],"text":""}]}
Reactions are currently unavailable