How do I change the text color in the game for certain items?

Started by 3D_GOD on

Topic category: Help with modding (Java Edition)

Last seen on 16:02, 19. May 2024
Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I change the text color in the game for certain items?

I want to change the colors of the text in the description of the items to my liking. In the Mcreator program, you can add a description for items. But with this addition, the text is always white. But for my mod, colors in the description of objects are a very important function.  The code below 

A certain section of the code in which something needs to be changed

    
    list.add(Component.text("RANK | G | ").withColor (TextColor.fromRGB(255, 0, 0)));
    list.add(Component.text("Item: Raw Goblin Meat "));
    list.add(Component.text("Class: Food "));
    list.add(Component.text("Description: Raw forest goblin meat extracted from a forest goblin of the first level. A strange smell of meat, moss, grass and something goblins. "));
    list.add(Component.text("Additionally: Meat can be eaten, cooked, used as food for animals or monsters, Sacrificing to someone or something, and many other hidden mechanics in which this item can be used."));
    list.add(Component.text("Stats: "));
    list.add(Component.text("nutritional value +2").withColor (TextColor.fromRGB(0, 255, 0));
    list.add(Component.text("saturation +1.8").withColor (TextColor.fromRGB(0, 255, 0));


}

    }

I tried to change the color in 3 lines. The first one is red, and the other two are green, but a compilation error occurred and the miner did not start : ( Help who is fumbling.