Skip to content

Creating an effect

Olafcio1 edited this page Aug 20, 2026 · 2 revisions

This guide assumes you've already created and setup an Avoid project.
This guide uses meta-programming. Another way may either not be implemented or you may need to figure it out on your own.

NOTE: The effect API is heavy beta. It is not recommended to use yet.


§ Making an effect with the Avoid Framework


  1. Create a java class;
    You can pick any location within your project source code directory.

  2. Paste the following code:

    package com.example.avoidtmpl;
    
    import pl.olafcio.avoid.mods.annotation_processor.AutoEffect;
    import pl.olafcio.avoid.mods.annotation_processor.AutoID;
    import pl.olafcio.avoid.net.effect.Effect;
    import pl.olafcio.avoid.net.effect.properties.*;
    import pl.olafcio.avoid.net.effect.values.Category;
    
    @AutoEffect
    @AutoID
    
    @_category(Category.NEUTRAL)
    @_color(0xaa10ff)
    
    public class SoftnessEffect extends Effect {
       @Override
       public boolean tryApply(
               World world,
               Entity entity,
               @Range(from = 1, to = 256) int amplifier
       ) {
          // apply your effect here
          return true;
       }
    }

    Of course you need to replace the class name and package.

  3. Customize it as you wish;
    All effect properties (currently only the category and color) are done with these little underscore (_)-prefixed annotations.
    These properties themselves are quite simple, imo.

  4. Implement the effect;
    Add an implementation for the tryApply method to actually apply the effect for the player.


Avoid Framework


    🏚️ 1. Home
    📽️ 2. Creating your mod
    🌄 3. Adding assets to your mod
    🧊 4. Creating a block
    💧 5. Creating a fluid
    ✏️ 6. Creating an item
    🎯 7. Creating an entity selector
    🤖 8. Creating a command
    ⌨️ 9. Creating a keybind
    🐺 10. Creating an entity
    🌫️ 11. Creating a fog
    🔩 12. Creating an item component
    🔮 13. Creating an effect

Clone this wiki locally