CustomAmbience module

CustomAmbience: Minecraft 26.3 cheat module, full source for every implementation (1 client: LiquidBounce (Kotlin)).

1 implementationRENDER

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

LiquidBounce (Kotlin)RENDERsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/customambience/ModuleCustomAmbience.ktKotlin · 192 lines · 7.0 KB

Allows you to override the world ambience.

SettingsGradientLayersDisableWorldFogColorBackgroundColorEnvironmentalRenderDistanceSkyEndCloudEndBlockLightTintSkyLightColorAmbientColorNightVisionColor
ModuleCustomAmbience.ktKotlin · Minecraft 26.2 · 192 lines · 7.0 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
3
 *
4
 * Copyright (c) 2015 - 2026 CCBlueX
5
 *
6
 * LiquidBounce is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * LiquidBounce is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
18
 */
19
package net.ccbluex.liquidbounce.features.module.modules.render.customambience
20
21
import com.mojang.blaze3d.textures.GpuTexture
22
import net.ccbluex.liquidbounce.config.types.group.Mode
23
import net.ccbluex.liquidbounce.config.types.group.ModeValueGroup
24
import net.ccbluex.liquidbounce.config.types.group.ToggleableValueGroup
25
import net.ccbluex.liquidbounce.config.types.list.Tagged
26
import net.ccbluex.liquidbounce.features.module.ClientModule
27
import net.ccbluex.liquidbounce.features.module.ModuleCategories
28
import net.ccbluex.liquidbounce.features.module.modules.render.customambience.worldeffects.WorldParticles
29
import net.ccbluex.liquidbounce.render.engine.type.Color4b
30
import net.ccbluex.liquidbounce.utils.render.clearColor
31
import net.minecraft.client.renderer.fog.FogData
32
import net.minecraft.client.renderer.state.LightmapRenderState
33
import org.joml.Vector4fc
34
35
/**
36
 * CustomAmbience module
37
 *
38
 * Override the ambience of the game
39
 */
40
object ModuleCustomAmbience : ClientModule("CustomAmbience", ModuleCategories.RENDER, aliases = listOf("FogChanger")) {
41
42
    val weather = enumChoice("Weather", WeatherType.SNOWY)
43
    private val time = enumChoice("Time", TimeType.NIGHT)
44
45
    object Precipitation : ToggleableValueGroup(this, "ModifyPrecipitation", true) {
46
        val gradient by float("Gradient", 0.7f, 0.1f..1f)
47
//        val layers by int("Layers", 3, 1..14)
48
    }
49
50
    /**
51
     * @see FogData
52
     */
53
    object FogValueGroup : ToggleableValueGroup(this, "Fog", true) {
54
55
        val disableWorldFog by boolean("DisableWorldFog", false)
56
57
        object FogColorOverride : ToggleableValueGroup(this, "FogColorOverride", false) {
58
            val color by color("Color", Color4b(47, 128, 255, 201))
59
        }
60
61
        private val backgroundColor by color("BackgroundColor", Color4b(47, 128, 255, 201))
62
63
        private val environmental by floatRange("Environmental", 0f..1024f, -16f..2048f)
64
        private val renderDistance by floatRange("RenderDistance", 230f..256f, 0f..1024f)
65
        private val skyEnd by float("SkyEnd", 256f, 0f..1024f)
66
        private val cloudEnd by float("CloudEnd", 20480f, 0f..4096f)
67
68
        /**
69
         * @see net.ccbluex.liquidbounce.injection.mixins.minecraft.render.fog.MixinFogRenderer
70
         */
71
        fun modifyFogData(fogData: FogData) {
72
            if (!this.running) {
73
                return
74
            }
75
76
            fogData.environmentalStart = this.environmental.start
77
            fogData.environmentalEnd = this.environmental.endInclusive
78
            fogData.renderDistanceStart = this.renderDistance.start
79
            fogData.renderDistanceEnd = this.renderDistance.endInclusive
80
            fogData.skyEnd = this.skyEnd
81
            fogData.cloudEnd = this.cloudEnd
82
        }
83
84
        fun modifyClearColor(original: Vector4fc): Vector4fc {
85
            if (!this.running || backgroundColor.a == 0) {
86
                return original
87
            }
88
89
            return backgroundColor.toVector4f()
90
        }
91
    }
92
93
    /**
94
     * @see net.ccbluex.liquidbounce.injection.mixins.minecraft.render.MixinLightmap
95
     */
96
    object CustomLightmap : ToggleableValueGroup(this, "CustomLightmap", false) {
97
        val mode = choices("Mode", 0) {
98
            arrayOf(EditorMode.SingleColor, EditorMode.Custom)
99
        }
100
101
        sealed class EditorMode(name: String) : Mode(name) {
102
            final override val parent: ModeValueGroup<*>
103
                get() = mode
104
105
            abstract fun edit(texture: GpuTexture, lightmapRenderState: LightmapRenderState): Boolean
106
107
            object SingleColor : EditorMode("SingleColor") {
108
                private val color by color("Color", Color4b.BLUE)
109
110
                override fun edit(texture: GpuTexture, lightmapRenderState: LightmapRenderState): Boolean {
111
                    texture.clearColor(color)
112
                    return true
113
                }
114
            }
115
116
            object Custom : EditorMode("Custom") {
117
                private val blockLightTint by color("BlockLightTint", Color4b.WHITE.alpha(0))
118
                private val skyLightColor by color("SkyLightColor", Color4b.BLUE.alpha(0))
119
                private val ambientColor by color("AmbientColor", Color4b.BLUE.alpha(0))
120
                private val nightVisionColor by color("NightVisionColor", Color4b.WHITE.alpha(0))
121
122
                override fun edit(texture: GpuTexture, lightmapRenderState: LightmapRenderState): Boolean {
123
                    if (!blockLightTint.isTransparent) {
124
                        lightmapRenderState.blockLightTint = blockLightTint.toRgbVector3f()
125
                    }
126
                    if (!skyLightColor.isTransparent) {
127
                        lightmapRenderState.skyLightColor = skyLightColor.toRgbVector3f()
128
                    }
129
                    if (!ambientColor.isTransparent) {
130
                        lightmapRenderState.ambientColor = ambientColor.toRgbVector3f()
131
                    }
132
                    if (!nightVisionColor.isTransparent) {
133
                        lightmapRenderState.nightVisionColor = nightVisionColor.toRgbVector3f()
134
                    }
135
136
                    return false
137
                }
138
            }
139
140
        }
141
    }
142
143
    object SkyColor : ToggleableValueGroup(this, "SkyColor", false) {
144
        val color by color("Color", Color4b.BLUE)
145
    }
146
147
    init {
148
        tree(Precipitation)
149
        tree(FogValueGroup)
150
        tree(CustomLightmap)
151
        tree(SkyColor)
152
        tree(WorldParticles)
153
    }
154
155
    @JvmStatic
156
    fun getWorldClockTime(original: Long): Long {
157
        return if (running) {
158
            when (time.get()) {
159
                TimeType.NO_CHANGE -> original
160
                TimeType.DAWN -> 23041L
161
                TimeType.DAY -> 1000L
162
                TimeType.NOON -> 6000L
163
                TimeType.DUSK -> 12610L
164
                TimeType.NIGHT -> 13000L
165
                TimeType.MID_NIGHT -> 18000L
166
            }
167
        } else {
168
            original
169
        }
170
    }
171
172
    @Suppress("unused")
173
    enum class WeatherType(override val tag: String) : Tagged {
174
        NO_CHANGE("NoChange"),
175
        SUNNY("Sunny"),
176
        RAINY("Rainy"),
177
        SNOWY("Snowy"),
178
        THUNDER("Thunder")
179
    }
180
181
    enum class TimeType(override val tag: String) : Tagged {
182
        NO_CHANGE("NoChange"),
183
        DAWN("Dawn"),
184
        DAY("Day"),
185
        NOON("Noon"),
186
        DUSK("Dusk"),
187
        NIGHT("Night"),
188
        MID_NIGHT("MidNight")
189
    }
190
191
}
192