Skip to content
Calyren's Utils

Quick rating

Community listing page, reviews may not be monitored by the author.

Calyren's Utils

By CalyrenOwner

No reviews yet

A Utilities/Library Mod that I use in my other Mods.

Mod Loaders
Minecraft
26.3 26.2

About

Description

CXD's Utilities

Instalation

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.

Version ID

Mob Effects

CXD's Utils adds 3 classes related to Mob Effects:

  • CustomEffectDuration
  • CustomEffectTooltip
  • StatusEffectBackground

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.