Kaneki Dc

Create a Minecraft 1.21.11 Fabric Mod — Custom Fog

Act as an expert Minecraft Java mod developer specializing in Fabric, Minecraft rendering, and Mixin-based modifications.

Create a complete, working Minecraft Fabric mod for Minecraft Java Edition 1.21.11 that allows players to fully customize the colour and appearance of Minecraft's built-in fog.

1. Core Objective

The mod must modify Minecraft's actual built-in world fog, allowing players to change its colour to any custom colour they want, including red, blue, purple, green, pink, cyan, orange, white, black, and custom RGB/HEX colours.

I have provided a reference screenshot showing red fog. Use that screenshot as the visual target for the red fog appearance.

The result should look like genuine Minecraft fog with a custom colour, blending naturally into the environment and distant terrain.

Important: Do not create a full-screen colour overlay, fake fog particles, a shader-only screen tint, or a separate fog layer. Modify the actual fog colour used by Minecraft's rendering system.

2. Technical Requirements

* Minecraft Java Edition 1.21.11. * Fabric Loader. * Fabric API compatible with Minecraft 1.21.11. * Java version and Gradle configuration compatible with the target Minecraft version. * Use Java for the mod implementation. * Use Fabric Mixins or the appropriate supported rendering APIs to modify the built-in fog. * Verify the actual Minecraft 1.21.11 rendering classes, methods, descriptors, and mappings before implementing Mixins. * Ensure compatibility with the target version instead of copying outdated code from earlier Minecraft releases. * The mod must work in single-player and on multiplayer clients without requiring a server-side installation, wherever technically possible.

3. Fog Customization Features

Provide the following options:

Colour customization

* A full RGB colour picker. * HEX colour input, such as #FF0000. * Individual Red, Green, and Blue sliders. * Preset colours, including red, dark red, blue, purple, green, pink, cyan, orange, white, and black. * A reset-to-default button. * An enable/disable toggle for custom fog.

Fog appearance

* Fog start distance. * Fog end distance. * Fog density or equivalent supported control, if the target rendering implementation allows it. * Separate controls for the fog's colour and distance. * A live preview of the selected colour. * A toggle to use Minecraft's original fog colour.

Fog start and

Kodari AI
KodariOct 24 at 3:37 am 2
CustomFogMod
A Fabric mod for Minecraft 1.21.11 that lets players fully customize the built-in fog color and appearance. Features include an RGB color picker, HEX input, individual RGB sliders, preset colors (red, blue, purple, green, pink, cyan, orange, white, black), reset-to-default and enable/disable toggles. Users can adjust fog start/end distances and density, with live color preview and an option to revert to Minecraft's original fog. The mod modifies the actual rendering fog via Mixins, ensuring natural blending with terrain, and works client-side in single-player and multiplayer without server installation.
  1. Confirm the 1.21.11 fog-rendering hooks and settings-screen APIs.

  2. Build the client-only mod, persistent colour/distance settings, and YACL controls.

  3. Add the mixin/configuration resources so it changes Minecraft’s real fog colour and range.

Created a client-only Fabric 1.21.11 project with Java 21, Yarn mappings, Fabric API, and Loom configuration.

The mixin wraps Minecraft’s verified fog-buffer upload call, changing the actual world fog colour and start/end distances—not a screen overlay. Settings include a colour picker, HEX input, RGB sliders, the requested presets, enable/original-colour toggles, distance controls, and reset. Settings persist locally; no server installation is required.

The default is red fog, fading from 48 to 192 blocks. Open Mods → Custom Fog → Configure to customize it. Fog density is controlled through the start/end range.

Kaneki Dc

Mod is all set just name it Fog By K4neki and the description change from customize minecraft world fog colour and distance to K4neki Fog Mod

Kodari AI
KodariOct 24 at 3:51 am 1

Updated the mod name to Fog By K4neki and its description to K4neki Fog Mod in fabric.mod.json.

Kaneki Dc

Bro Its just colouring the sky I want to colour the fog too make it colour fog

Kodari AI
KodariOct 24 at 4:05 am 2

Updated the mixin to apply your RGB colour directly to Minecraft’s computed fog colour before it reaches the world fog renderer. This should colour terrain fog as well as the sky; your fog distance settings are unchanged.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
settings.gradle
Code
10 581
src/client/java/dev/kodari/customfog/FogConfigScreen.java
package dev.kodari.customfog;

import dev.isxander.yacl3.api.ButtonOption;
import dev.isxander.yacl3.api.ConfigCategory;
import dev.isxander.yacl3.api.Option;
import dev.isxander.yacl3.api.OptionDescription;
import dev.isxander.yacl3.api.OptionGroup;
import dev.isxander.yacl3.api.YetAnotherConfigLib;
import dev.isxander.yacl3.api.controller.ColorControllerBuilder;
import dev.isxander.yacl3.api.controller.EnumControllerBuilder;
import dev.isxander.yacl3.api.controller.IntegerSliderControllerBuilder;
import dev.isxander.yacl3.api.controller.StringControllerBuilder;
import dev.isxander.yacl3.api.controller.TickBoxControllerBuilder;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.Text;

import java.awt.Color;
import java.util.concurrent.atomic.AtomicReference;

public final class FogConfigScreen {
    private FogConfigScreen() {
    }

    public static Screen create(Screen parent) {
        AtomicReference<ColorInput> activeColorInput = new AtomicReference<>(ColorInput.NONE);

        Option<Color> colorOption = Option.<Color>createBuilder()
                .name(Text.literal("Fog colour preview and picker"))
                .description(OptionDescription.of(Text.literal("Choose any RGB colour. The swatch previews the selected colour.")))
                .binding(new Color(255, 0, 0), FogConfig::getColor, value -> {
                    if (activeColorInput.get() == ColorInput.PICKER) {
                        FogConfig.setColor(value);
                    }
                })
                .controller(ColorControllerBuilder::create)
                .build();
        colorOption.addListener((option, value) -> activeColorInput.set(ColorInput.PICKER));

        Option<FogConfig.Preset> presetOption = Option.<FogConfig.Preset>createBuilder()
                .name(Text.literal("Colour preset"))
                .binding(FogConfig.Preset.RED, FogConfig::getPreset, value -> {
                    if (activeColorInput.get() == ColorInput.PRESET) {
                        FogConfig.setPreset(value);
                    }
                })
                .controller(option -> EnumControllerBuilder.create(option).enumClass(FogConfig.Preset.class))
                .build();
        presetOption.addListener((option, value) -> activeColorInput.set(ColorInput.PRESET));

        Option<String> hexOption = Option.<String>createBuilder()
                .name(Text.literal("HEX colour"))
                .description(OptionDescription.of(Text.literal("Enter a colour such as #FF0000.")))
                .binding("#FF0000", FogConfig::getHexColor, value -> {
                    if (activeColorInput.get() == ColorInput.HEX) {
                        FogConfig.setHexColor(value);
                    }
                })
                .controller(StringControllerBuilder::create)
                .build();
        hexOption.addListener((option, value) -> activeColorInput.set(ColorInput.HEX));

        Option<Integer> redOption = channelOption("Red", 255, FogConfig::getRed, FogConfig::setRed, activeColorInput);
        Option<Integer> greenOption = channelOption("Green", 0, FogConfig::getGreen, FogConfig::setGreen, activeColorInput);
        Option<Integer> blueOption = channelOption("Blue", 0, FogConfig::getBlue, FogConfig::setBlue, activeColorInput);

        Option<Boolean> enabledOption = Option.<Boolean>createBuilder()
                .name(Text.literal("Enable custom fog"))
                .description(OptionDescription.of(Text.literal("Apply the custom fog settings in this client.")))
                .binding(true, FogConfig::isEnabled, FogConfig::setEnabled)
                .controller(TickBoxControllerBuilder::create)
                .build();

        Option<Boolean> originalColorOption = Option.<Boolean>createBuilder()
                .name(Text.literal("Use Minecraft's original fog colour"))
                .description(OptionDescription.of(Text.literal("Keep vanilla's dynamic colour while still applying the selected fog distances.")))
                .binding(false, FogConfig::usesOriginalFogColor, FogConfig::setUseOriginalFogColor)
                .controller(TickBoxControllerBuilder::create)
                .build();

        Option<Integer> startOption = distanceOption("Fog start distance (blocks)", 48, 0, FogConfig::getStartDistance, FogConfig::setStartDistance);
        Option<Integer> endOption = distanceOption("Fog end distance (blocks)", 192, 1, FogConfig::getEndDistance, FogConfig::setEndDistance);

        return YetAnotherConfigLib.createBuilder()
                .title(Text.literal("Custom Fog Settings"))
                .save(FogConfig::save)
                .category(ConfigCategory.createBuilder()
                        .name(Text.literal("Fog"))
                        .group(OptionGroup.createBuilder()
                                .name(Text.literal("Colour"))
                                .option(colorOption)
                                .option(presetOption)
                                .option(hexOption)
                                .option(redOption)
                                .option(greenOption)
                                .option(blueOption)
                                .build())
                        .group(OptionGroup.createBuilder()
                                .name(Text.literal("Appearance"))
                                .option(enabledOption)
                                .option(originalColorOption)
                                .option(startOption)
                                .option(endOption)
                                .build())
                        .group(OptionGroup.createBuilder()
                                .name(Text.literal("Actions"))
                                .option(ButtonOption.createBuilder()
                                        .name(Text.literal("Reset to defaults"))
                                        .description(OptionDescription.of(Text.literal("Restores the red fog defaults and closes this screen.")))
                                        .action((screen, buttonOption) -> {
                                            FogConfig.resetDefaults();
                                            FogConfig.save();
                                            screen.close();
                                        })
                                        .build())
                                .build())
                        .build())
                .build()
                .generateScreen(parent);
    }

    private static Option<Integer> channelOption(String name, int defaultValue, java.util.function.Supplier<Integer> getter, java.util.function.Consumer<Integer> setter, AtomicReference<ColorInput> activeColorInput) {
        Option<Integer> option = Option.<Integer>createBuilder()
                .name(Text.literal(name))
                .binding(defaultValue, getter, value -> {
                    if (activeColorInput.get() == ColorInput.RGB) {
                        setter.accept(value);
                    }
                })
                .controller(value -> IntegerSliderControllerBuilder.create(value).range(0, 255).step(1))
                .build();
        option.addListener((ignored, value) -> activeColorInput.set(ColorInput.RGB));
        return option;
    }

    private static Option<Integer> distanceOption(String name, int defaultValue, int minimum, java.util.function.Supplier<Integer> getter, java.util.function.Consumer<Integer> setter) {
        return Option.<Integer>createBuilder()
                .name(Text.literal(name))
                .description(OptionDescription.of(Text.literal("Distances are measured in blocks. Start must be before end.")))
                .binding(defaultValue, getter, setter)
                .controller(value -> IntegerSliderControllerBuilder.create(value).range(minimum, 1024).step(1))
                .build();
    }

    private enum ColorInput {
        NONE,
        PICKER,
        PRESET,
        HEX,
        RGB
    }
}