Compatibility
Minecraft: Java Edition
Platforms
Supported environments
Links
Tags
Creators
Details
Calyren's Utils
A Utilities/Library Mod that I use in my Mods.
Installation (Fabric & NeoForge)
build.gradle:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
}
dependencies {
implementation "maven.modrinth:t9HzrmQg:<version_id>"
}
Replace <version_id> with an actual Version ID. (Ex. For 1.0-26.2, the Version ID is "2k1jbG7k")
Q: Where do I find the Version ID?
A: Go to the version you want install and then click on "Developer information". You should find the Version ID there.

Attributes (NeoForge)
Calyren's Utils adds 2 new Attributes: Fire Vulnerability and Durability.
- Fire Vulnerability: Increases how much damage an entity takes from fire.
- Durability: Increases an item's durability.
public static final DeferredHolder<Attribute, Attribute> FIRE_VULNERABILITY = ATTRIBUTES.register("fire_vulnerability",
() -> new RangedAttribute("attribute.calyrens_utils.fire_vulnerability", 1.0, -1024.0, 1024.0).setSyncable(true));
public static final DeferredHolder<Attribute, Attribute> DURABILITY = ATTRIBUTES.register("durability",
() -> new RangedAttribute("attribute.calyrens_utils.durability", 0.0, -32767.0, 32767.0).setSyncable(true));
Cosmetic System (NeoForge)
The Cosmetic System lets an item have multiple looks (cosmetics). Players switch between them by holding the item and sneak + right-clicking a Smithing Table.
To add cosmetics to your own item:
- Implement
CosmeticItemand list the item's cosmetics. - Call
appendCosmeticTooltipinappendHoverText, so the selected cosmetic's name shows in the tooltip. - Add one model override per cosmetic to the item's model JSON.
CosmeticItem
CosmeticItem is for free cosmetics, which anyone can change.
public class YourItem extends Item implements CosmeticItem {
// Cosmetic(name, nameColor, model, startColor, endColor)
// - name, nameColor: the name and its color (0xRRGGBB), shown in the tooltip and on the action bar
// - model: the cosmetic's item model
// - startColor, endColor: free for your own use (for example particle gradients),
// the Cosmetic System itself doesn't read them
public static final Cosmetic DEFAULT = new Cosmetic("Default", 0xFFFFFF,
ResourceLocation.fromNamespaceAndPath(YourMod.MOD_ID, "item/skin/your_item/default"),
0xFFFFFF, 0xFFFFFF);
public static final Cosmetic GREEN = new Cosmetic("Green", 0x009728,
ResourceLocation.fromNamespaceAndPath(YourMod.MOD_ID, "item/skin/your_item/green"),
0x009728, 0x009728);
// The first cosmetic in the list is the default one
public static final List<Cosmetic> COSMETICS = List.of(DEFAULT, GREEN);
public YourItem(Properties properties) {
super(properties);
}
@Override
public List<Cosmetic> getCosmetics() {
return COSMETICS;
}
@Override
public void appendHoverText(ItemStack stack, TooltipContext context, List<Component> tooltip, TooltipFlag flag) {
super.appendHoverText(stack, context, tooltip, flag);
appendCosmeticTooltip(stack, tooltip);
}
}
The item's model JSON needs one override per cosmetic, on the calyrens_utils:cosmetic_index predicate. The index is the cosmetic's position in the list, and the first cosmetic (index 0) uses the item's normal model. Point the item's model at the default cosmetic's model with parent, and list the overrides in ascending order:
{
"parent": "yourmod:item/skin/your_item/default",
"overrides": [
{ "predicate": { "calyrens_utils:cosmetic_index": 1 }, "model": "yourmod:item/skin/your_item/green" }
]
}
SupporterCosmeticItem
There's also a SupporterCosmeticItem. It works exactly like CosmeticItem, but only supporters can change the item's cosmetic. It relies on the Supporter System, so you will most likely want CosmeticItem for your own mods.
Supporter System (NeoForge)
The Supporter System is a personal supporter system that I may use in my own mods.
WARNING!!!
This feature is experimental. It may change, break or be removed without notice, and it isn't meant to be used in other mods!!!
Mob Effects (Fabric & NeoForge)
CXD's Utils adds 3 classes related to Mob Effects:
CustomEffectDurationCustomEffectTooltipStatusEffectBackground
CustomEffectDuration
CustomEffectDuration lets you set a custom duration text for Mob Effects.
public class YourMobEffect extends MobEffect implements CustomEffectDuration {
<...>
@Override
public Component getDurationText(MobEffectInstance instance) {
return Component.literal("Hi!!! This is an Example!")
.withStyle(style -> style.withColor(0xFFFFFF));
}
}
Instead of showing how long the effect lasts, it will display:
Hi!!! This is an Example!
CustomEffectTooltip
CustomEffectTooltip lets you add a custom tooltip to Mob Effects.
public class YourMobEffect extends MobEffect implements CustomEffectTooltip {
<...>
@Override
public List<Component> getTooltipLines(MobEffectInstance instance) {
return List.of(
Component.literal("This Text will appear when you hover over the Effect!")
.withStyle(ChatFormatting.WHITE),
Component.literal("It also supports multiple lines!")
.withStyle(ChatFormatting.WHITE)
);
}
}
When hovering over the Mob Effect, the custom tooltip text will appear.
StatusEffectBackground
CustomEffectTooltip lets you add a custom texture to your MobEffect's background.
public class YourMobEffect extends MobEffect implements StatusEffectBackground {
<...>
@Override
public Identifier inventorySprite() {
return Identifier.fromNamespaceAndPath(YourMod.MOD_ID, "container/inventory/
effect_background");
}
@Override
public Identifier ambientInventorySprite() {
return Identifier.fromNamespaceAndPath(YourMod.MOD_ID, "container/inventory/
effect_background_ambient");
}
}
Check https://mcasset.cloud/26.1.2/assets/minecraft/textures/gui/sprites/container/inventory to see how Minecraft does the effect backgrounds. This uses the same logic.


