Skip to content

Creating a fog

Olafcio1 edited this page Jul 24, 2026 · 3 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.


§ Making a fog 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.fluid;
    
    import pl.olafcio.avoid.mods.annotation_processor.AutoFog;
    import pl.olafcio.avoid.net.entity.Entity;
    import pl.olafcio.avoid.net.fog.Fog;
    import pl.olafcio.avoid.net.fog.FogState;
    import pl.olafcio.avoid.net.fog.delta.TickTracker;
    import pl.olafcio.avoid.net.id.Identification;
    import pl.olafcio.avoid.net.world.World;
    
    @AutoFog
    public class OilFog extends Fog {
        @Override
        public void createFog(FogState fog, Entity entity, World world, float blockDistance, TickTracker tickTracker) {
            // customize this method to be like you want your fog to be.
            fog.skyEnd=6.0f;
            fog.cloudEnd=6.0f;
            fog.environmentalStart=3.25f;
            fog.environmentalEnd=6.0f;
        }
    
        @Override
        public boolean shouldApply(Identification fogType, Entity entity) {
            return fogType.is("testmod", "oil"); // replace this to contain the appropriate values for your fluid.
                                                 // if you don't want this fog to be a for a fluid, you can also inspect the entity;
                                                 //    or you can check for a non-fluid fogType (e.g. a minecraft one, or a neoforge one from a mod that adds some. although having dependencies that don't use the avoid framework is a mid idea, if you need to do it, do it)
        }
    
        @Override
        public int baseColor(World world, Entity entity, int renderDistance, float deltaTicks) {
            return 0x000000; // replace this with your fog color. the format is HEX (rgb in hexadecimals). you can also use new Color(...).getRGB()
        }
    }

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

  3. Follow the comments;
    Change the behaviour like you want your fog to have.


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

Clone this wiki locally