Repository navigation
Rarity
satisfy edited this page Oct 7, 2026
·
1 revision
A rarity that isn't tied to the vanilla Rarity enum. It can be one solid color, a gradient over the item name, or a gradient that slowly scrolls. Foundation recolors the name in the tooltip, the held-item name above the hotbar, and adds a label line under the name.
FoundationRarities.register(MY_SWORD.get(), FoundationRarity.LEGENDARY);Register on the client or common side, it is just a lookup. Items without a rarity are untouched, so this works next to vanilla rarities.
| Rarity | Look | Colors |
|---|---|---|
COMMON |
solid | #AAAAAA |
UNCOMMON |
solid | #78C878 |
RARE |
solid | #6EA8D8 |
EPIC |
solid | #A77BCB |
MYTHIC |
gradient |
#FFD166 → #E58B3A
|
LEGENDARY |
gradient |
#DFAE45 → #FFF0A6 → #FFF8DC → #FFF0A6 → #DFAE45
|
CELESTIAL |
gradient |
#72C9E8 → #FFFFFF → #B99AFF
|
DIVINE |
gradient |
#FFF8E1 → #FFD166 → #E9A4C6 → #FFF8E1
|
ETERNAL |
animated |
#FFB3B3 → #FFE29A → #B8F2C8 → #A9D8FF → #D6B3FF, one loop takes 8 seconds |
public static final FoundationRarity SUNSET = FoundationRarity.gradient("mymod:sunset", 0xFF8A5C, 0xFFD166);
public static final FoundationRarity AURORA = FoundationRarity.animated("mymod:aurora", 0x72C9E8, 0xB8F2C8, 0xD6B3FF);
public static final FoundationRarity MOSS = FoundationRarity.solid("mymod:moss", 0x78C878);-
solid(id, color)– one color. -
gradient(id, colors...)– colors are spread evenly over the name, first to last. -
animated(id, colors...)– colors loop around the name and scroll over time, the last color blends back into the first.
Colors are 0xRRGGBB.
The tooltip gets a second line with the rarity name, colored like the item name. The key comes from the id:
| Id | Lang key |
|---|---|
"legendary" (no namespace, Foundation) |
rarity.foundation.legendary |
"mymod:sunset" |
rarity.mymod.sunset |
Foundation ships the texts for its nine rarities in English and German. For your own rarities add the key to your lang file:
"rarity.mymod.sunset": "Sunset"- The name is recolored letter by letter, bold/italic/etc. of the original name are kept.
- Animation is time based, so it keeps moving while a tooltip is open and needs nothing from you.
- The hotbar name uses a mixin (
GuiMixin) onGui#renderSelectedItemName. If another mod replaces that call, only the hotbar name falls back to the vanilla color, tooltips still work.