EffectLib: Create Custom Mob Effects with Ease
EffectLib is a powerful library for mod developers, making it easy to create and customize mob effects. Using the MobEffectsUtil API, you can implement custom effects, define unique behaviors, and smoothly integrate them into your modifications.
Main Features
- Easy Initialization: Start working with the library through one simple method.
- Flexible Effect Creation: Develop custom effects with different categories and colors.
- Customizable Actions: Adding onStart, onTick, and onEnd functions using lambda expressions to implement any logic.
- Tick Delay Control: Adjust the frequency of onTick actions through customizable intervals.
- Easy Registration: Simple procedure for including your effects in the mod structure.
Getting Started
Library Initialization
Start with EffectLib by specifying your mod's unique ID:
MobEffectsUtil.initialize("your_mod_id");
Effect Definition
Create a new effect by setting its name, category, and color:
ModMobEffectData data = new ModMobEffectData("my_effect", MobEffectCategory.NEUTRAL, 0);
Behavior Configuration
Add desired behavior for different stages of the effect:
data.addOnStart((entity, amplifier) -> {
// Code executed when the effect starts
});
data.addOnTick((entity, amplifier) -> {
// Code executed every tick
});
data.addOnEnd((entity, amplifier) -> {
// Code executed when the effect ends
});
data.setTickDelay(20); // Setting delay between ticks
Creation and Registration
Complete effect development and register it in the system:
MobEffectsUtil.createEffect(data);
MobEffectsUtil.register(IEventBus bus);
Conclusion
EffectLib provides mod developers with a simple yet effective toolkit for creating unique mob effects. The intuitive API and minimal setup complexity allow for quick implementation of creative gameplay elements.