Colored Item Descriptions

Started by Mindthemoods on

Topic category: Help with modding (Java Edition)

Last seen on 18:36, 16. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Colored Item Descriptions

Just something that might be useful, seeing as it took me way to long to figure this out: You can use formatting codes, (colors, bolding, italics, etc.), on modded items with a pretty easy tweak to the base code, as follows:

  • Write something in the 'item description' section of the item, (or just copy and paste the following override section into the code), and you should find a section that looks like this when you open up the locked code:
    @Override

public void appendHoverText(ItemStack itemstack, Level world, List<Component> list, TooltipFlag flag) {
super.appendHoverText(itemstack, world, list, flag);
list.add(Component.literal("Your description goes here"));
}
  • You can add different codes to the description to change its appearance. In the following, I'm using the color code for light blue to change the color of my item's description:
    @Override

public void appendHoverText(ItemStack itemstack, Level world, List<Component> list, TooltipFlag flag) {
super.appendHoverText(itemstack, world, list, flag);
list.add(Component.literal(("\u00A79") + "Your description goes here"));
}
  •