public static OrderedText getItemInfoFormatted(ItemStack item) {
Text itemName = item.getName().copy();
OrderedText formatted;
Text text1 = Text.Serialization.fromJson("\"" + " - " + (item.getMaxDamage() - item.getDamage()) + "\"", DynamicRegistryManager.EMPTY);
Text text = Text.Serialization.fromJson("\"" + "\u00a77\u00bb " + "\"",DynamicRegistryManager.EMPTY).append(itemName);
if(item.isDamageable()) {
if(item.getDamage() != 0) {
text = Text.Serialization.fromJson("\"" + "\u00a77\u00bb " + "\"",DynamicRegistryManager.EMPTY).append(itemName).append(text1);
}
}
formatted = text.asOrderedText();
return formatted;
}
I had this code on 1.21.4 that would take the json string of Minecraft's Text object and format with colors/styles etc. (Ex the colored text on an item, etc). Whats the new way to do this on 1.21.6?