Colored tool labels

Started by Siwek44 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Colored tool labels

When creating an item, we can choose rarity (Common: White, Uncommon: Yellow, Rare: Aqua, Epic: Light Purple)
I would like to set this color for a sword (tool doesnt have a rarity tab like items). Is it possible by changing the code? Thanks in advance for your help

Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
use this symobl --> § and…
Sat, 11/26/2022 - 01:35

use this symobl --> § and numbers after it for coloring text, for example "§1Sword". the symbol will not show in-game. §r to get rid of color

Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can do this plain and…
Sat, 11/26/2022 - 20:15

You can do this plain and simple by changing the code.

Open your tool's code file and look for a line similar to this one (I've highlighted the important bit to look for in bold):

}, 3, -2f, new Item.Properties().tab(GerbilstuffModTabs.TAB_TAB_ITEMS).fireResistant());

Simply add ".rarity(Rarity.COMMON)" (or Rarity.UNCOMMON, Rarity.RARE, or Rarity.EPIC, depending on which rarity you want) near the end like so:

}, 3, -2f, new Item.Properties().tab(GerbilstuffModTabs.TAB_TAB_ITEMS).fireResistant().rarity(Rarity.COMMON));

Lastly add this line at the very top of your code file.

import net.minecraft.world.item.Rarity;

Hope this works for you!

 

 

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks a lot!
Wed, 12/07/2022 - 21:08

Thanks a lot!