EventsLib

EventsLib

An events library adding in missing event listeners

by
32.8K Downloads
neoforgelibrary
Rent Server with this Mod

About this Mod

This library is intended to be used along side some of my mods that require more specific events for effects.  This mod adds in no items or changes the game in any way.  It has no beneficial use for players unless there is another mod that requires it and utilizes the additional events.

It adds in an event called MobEffectTickEvent which provides the modder with an interface to get the percentage left of the duration of the effect, as well as the effect instance and entity should you need any of those.

// Example for MobEffectTickEvent
    @SubscribeEvent
    public static void onMobEffectTick(MobEffectTickEvent event) {
        float percentageLeft = event.getPercentageLeft();
        String entityName = event.getEntity().getName().getString();
        String effectName = event.getEffectInstance().getEffect().value().toString();
        
        System.out.println("Entity: " + entityName
                + " is affected by: " + effectName
                + " with " + percentageLeft + "% duration remaining.");
        
        if (percentageLeft == 50.0f) {
            System.out.println("Effect on " + entityName + " is at 50% duration for effect: " + effectName);
        }
        if (percentageLeft == 20.0f) {
            System.out.println("Effect on " + entityName + " is at 20% duration for effect: " + effectName);
        }
    }

It also adds in a method that is run once when the effect wears off.  In my Fargo's Talismans mod, I use this to remove the attributes that are added to the player by the pedestal, rather than by running a PlayerTick method.

    // Example for onEffectRemoved (In a MobEffectEndEffect extended class)
    @Override
    public void onEffectRemoved(LivingEntity entity, int amplifier) {
        super.onEffectRemoved(entity, amplifier);
        if (entity instanceof Player) {
            System.out.println("Effect has worn off.");
        }
    }

Available Versions

EventsLib 1.0.56release
MC 1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5neoforge
May 21, 2025

How to Install EventsLib on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set neoforge Loader

In the panel under "Egg", select the neoforge loader and matching Minecraft version (1.21.5).

3

Install Mod

Open the mod browser in the dashboard and search for "EventsLib". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

neoforge

Minecraft Versions

1.21.5, 1.21.4, 1.21.3 (+3 more)

Server-side

Required

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

EventsLib server crashes on startup – what to do?

Most common cause: wrong neoforge version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.5). You can switch loaders with one click in the panel.

Is EventsLib compatible with neoforge?

EventsLib officially supports neoforge for Minecraft 1.21.5, 1.21.4, 1.21.3. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with EventsLib – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if EventsLib consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install EventsLib with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
LicenseRef-All-Rights-Reserved
Server-side
Required

Supported Versions

1.21.51.21.41.21.31.21.21.21.11.21