Started by
Siwek44
on
Topic category: Help with Minecraft modding (Java Edition)
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
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
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!
Thanks a lot!