Simplified Integration
The Integration API is the fastest way to inject your mod's data into the Item Glow HUD without writing custom rendering logic.
The Provider Pattern
I designed the Integration API to be "Fire and Forget." You implement a provider, return your data as simple records, and I handle the layout, animations, and aesthetic styling. Lines provided through this API are automatically rendered as "Pills" (rounded badges) to ensure they match the Item Glow design system.
public interface ItemGlowProvider {
// Returns a list of lines to be appended to the HUD
List<TooltipLine> getLines(ItemStack stack);
}
Data Record: TooltipLine
| Field | Type | Description |
|---|---|---|
text |
Text |
The stylized text to display. |
color |
int |
24-bit RGB color. Alpha is handled by the mod. |
priority |
int |
Higher values appear further up in the HUD. |
Implementation Walkthrough
Let's say you have a "Mana" mod and want to show an item's mana cost on the HUD.
public class ManaIntegration implements ItemGlowApi.ItemGlowProvider {
@Override
public List<ItemGlowApi.TooltipLine> getLines(ItemStack stack) {
List<ItemGlowApi.TooltipLine> lines = new ArrayList<>();
if (stack.contains(ManaMod.COST_COMPONENT)) {
int cost = stack.get(ManaMod.COST_COMPONENT);
lines.add(new ItemGlowApi.TooltipLine(
Text.literal("Cost: " + cost + " Mana"),
0x55AAFF,
150
));
}
return lines;
}
}
Registration
Add your provider to the global registry in your client initializer:
ItemGlowApi.PROVIDERS.add(new ManaIntegration());
The Scraper Technique
If you need to extract data from a mod that doesn't have an API, you can "scrape" its vanilla tooltips. This is the ultimate fallback for universal compatibility.
public class Scraper implements ItemGlowApi.ItemGlowProvider {
@Override
public List<ItemGlowApi.TooltipLine> getLines(ItemStack stack) {
// Force tooltip generation
var tooltip = stack.getTooltip(..., TooltipType.BASIC);
// Look for specific keywords
return tooltip.stream()
.filter(t -> t.getString().contains("Weight:"))
.map(t -> new ItemGlowApi.TooltipLine(t, 0xAAAAAA, 50))
.toList();
}
}