├── .gitattributes ├── doc ├── rain-fog.jpg ├── settings1.png ├── settings2.png ├── settings3.png ├── comparision.jpg └── icon-small-upres.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── common ├── src │ └── main │ │ ├── resources │ │ ├── assets │ │ │ └── simplefog │ │ │ │ ├── icon.png │ │ │ │ └── lang │ │ │ │ └── en_us.json │ │ └── simplefog.mixins.json │ │ └── java │ │ └── de │ │ └── draradech │ │ └── simplefog │ │ ├── SimpleFogMain.java │ │ ├── mixin │ │ ├── FogRendererMixin.java │ │ ├── WaterFogEnvironmentMixin.java │ │ └── AtmosphericFogEnvironmentMixin.java │ │ └── SimpleFogConfig.java └── build.gradle ├── .gitignore ├── fabric ├── src │ └── main │ │ ├── java │ │ └── de │ │ │ └── draradech │ │ │ └── simplefog │ │ │ ├── SimpleFogFabric.java │ │ │ └── SimpleFogMenuIntegration.java │ │ └── resources │ │ └── fabric.mod.json └── build.gradle ├── neoforge ├── src │ └── main │ │ ├── java │ │ └── de │ │ │ └── draradech │ │ │ └── simplefog │ │ │ └── SimpleFogNeoforge.java │ │ └── resources │ │ └── META-INF │ │ └── neoforge.mods.toml └── build.gradle ├── README.md ├── gradle.properties ├── settings.gradle ├── LICENSE ├── gradlew.bat └── gradlew /.gitattributes: -------------------------------------------------------------------------------- 1 | /gradlew text eol=lf 2 | *.bat text eol=crlf 3 | -------------------------------------------------------------------------------- /doc/rain-fog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Draradech/SimpleFogControl/HEAD/doc/rain-fog.jpg -------------------------------------------------------------------------------- /doc/settings1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Draradech/SimpleFogControl/HEAD/doc/settings1.png -------------------------------------------------------------------------------- /doc/settings2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Draradech/SimpleFogControl/HEAD/doc/settings2.png -------------------------------------------------------------------------------- /doc/settings3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Draradech/SimpleFogControl/HEAD/doc/settings3.png -------------------------------------------------------------------------------- /doc/comparision.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Draradech/SimpleFogControl/HEAD/doc/comparision.jpg -------------------------------------------------------------------------------- /doc/icon-small-upres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Draradech/SimpleFogControl/HEAD/doc/icon-small-upres.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Draradech/SimpleFogControl/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /common/src/main/resources/assets/simplefog/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Draradech/SimpleFogControl/HEAD/common/src/main/resources/assets/simplefog/icon.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | *.hprof 3 | *.iml 4 | *.ipr 5 | *.iws 6 | *.jfr 7 | *.launch 8 | .classpath 9 | .gradle 10 | .idea 11 | .metadata 12 | .project 13 | .settings 14 | .vscode 15 | bin 16 | build 17 | classes 18 | eclipse 19 | hs_err_*.log 20 | out 21 | replay_*.log 22 | repo 23 | run 24 | run-data 25 | runs 26 | -------------------------------------------------------------------------------- /fabric/src/main/java/de/draradech/simplefog/SimpleFogFabric.java: -------------------------------------------------------------------------------- 1 | package de.draradech.simplefog; 2 | 3 | import net.fabricmc.api.ModInitializer; 4 | 5 | public class SimpleFogFabric implements ModInitializer { 6 | 7 | @Override 8 | public void onInitialize() { 9 | SimpleFogMain.init(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /common/src/main/resources/simplefog.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "de.draradech.simplefog.mixin", 5 | "compatibilityLevel": "JAVA_21", 6 | "mixins": [ 7 | ], 8 | "client": [ 9 | "FogRendererMixin", 10 | "AtmosphericFogEnvironmentMixin", 11 | "WaterFogEnvironmentMixin" 12 | ], 13 | "injectors": { 14 | "defaultRequire": 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/src/main/java/de/draradech/simplefog/SimpleFogMain.java: -------------------------------------------------------------------------------- 1 | package de.draradech.simplefog; 2 | 3 | import me.shedaniel.autoconfig.AutoConfig; 4 | import me.shedaniel.autoconfig.serializer.GsonConfigSerializer; 5 | 6 | public class SimpleFogMain { 7 | public static SimpleFogConfig config; 8 | 9 | public static void init() { 10 | AutoConfig.register(SimpleFogConfig.class, GsonConfigSerializer::new); 11 | config = AutoConfig.getConfigHolder(SimpleFogConfig.class).getConfig(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /fabric/src/main/java/de/draradech/simplefog/SimpleFogMenuIntegration.java: -------------------------------------------------------------------------------- 1 | package de.draradech.simplefog; 2 | 3 | import com.terraformersmc.modmenu.api.ConfigScreenFactory; 4 | import com.terraformersmc.modmenu.api.ModMenuApi; 5 | 6 | import me.shedaniel.autoconfig.AutoConfigClient; 7 | 8 | public class SimpleFogMenuIntegration implements ModMenuApi { 9 | @Override 10 | public ConfigScreenFactory getModConfigScreenFactory() { 11 | return parent -> AutoConfigClient.getConfigScreen(SimpleFogConfig.class, parent).get(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /neoforge/src/main/java/de/draradech/simplefog/SimpleFogNeoforge.java: -------------------------------------------------------------------------------- 1 | package de.draradech.simplefog; 2 | 3 | import me.shedaniel.autoconfig.AutoConfigClient; 4 | import net.neoforged.fml.ModLoadingContext; 5 | import net.neoforged.fml.common.Mod; 6 | import net.neoforged.neoforge.client.gui.IConfigScreenFactory; 7 | 8 | @Mod(SimpleFogNeoforge.MODID) 9 | public class SimpleFogNeoforge { 10 | public static final String MODID = "simplefog"; 11 | 12 | public static SimpleFogConfig config; 13 | 14 | public SimpleFogNeoforge() 15 | { 16 | SimpleFogMain.init(); 17 | ModLoadingContext.get().registerExtensionPoint(IConfigScreenFactory.class, () -> (container, parent) -> { 18 | return AutoConfigClient.getConfigScreen(SimpleFogConfig.class, parent).get(); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Simple Fog Control 2 | 3 | Allows simple control over water, nether and terrain fog. 4 | 5 | For fabric the settings screen is available through the "Mod Menu" mod. 6 | 7 | [![Comparision](https://raw.githubusercontent.com/Draradech/SimpleFogControl/master/doc/comparision.jpg)](https://raw.githubusercontent.com/Draradech/SimpleFogControl/master/doc/comparision.jpg) 8 | 9 | [![Rain Fog](https://raw.githubusercontent.com/Draradech/SimpleFogControl/master/doc/rain-fog.jpg)](https://raw.githubusercontent.com/Draradech/SimpleFogControl/master/doc/rain-fog.jpg) 10 | 11 | ![Settings 1](https://raw.githubusercontent.com/Draradech/SimpleFogControl/master/doc/settings1.png) 12 | 13 | ![Settings 2](https://raw.githubusercontent.com/Draradech/SimpleFogControl/master/doc/settings2.png) 14 | 15 | ![Settings 3](https://raw.githubusercontent.com/Draradech/SimpleFogControl/master/doc/settings3.png) 16 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project 2 | version = 2.0.12 3 | group = de.draradech.simplefog 4 | java_version = 21 5 | 6 | # Common 7 | mod_author = Draradech 8 | mod_name = Simple Fog Control 9 | mod_id = simplefog 10 | 11 | # Minecraft 12 | minecraft_version = 1.21.11 13 | 14 | # NeoForm https://projects.neoforged.net/neoforged/neoform 15 | neo_form_version = 1.21.11-20251209.172050 16 | 17 | # Parchment https://parchmentmc.org/docs/getting-started 18 | parchment_minecraft = 1.21.10 19 | parchment_version = 2025.10.12 20 | 21 | # Fabric https://fabricmc.net/develop/ 22 | fabric_version = 0.139.5+1.21.11 23 | fabric_loader_version = 0.18.2 24 | 25 | # NeoForge https://projects.neoforged.net/neoforged/neoforge 26 | neoforge_version = 21.11.6-beta 27 | 28 | # Dependencies 29 | clothconfig_version = 21.11.151 30 | modmenu_version = 17.0.0-alpha.1 31 | 32 | # Gradle 33 | org.gradle.jvmargs = -Xmx4G 34 | org.gradle.daemon = false 35 | -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/neoforge.mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[1,)" 3 | license = "MIT" 4 | issueTrackerURL="https://github.com/Draradech/SimpleFogControl/issues" 5 | 6 | [[mods]] 7 | modId = "${mod_id}" 8 | version = "${version}" 9 | displayName = "Simple Fog Control" 10 | displayURL="https://github.com/Draradech/SimpleFogControl" 11 | logoFile="assets/${mod_id}/icon.png" 12 | credits="orangishcat (RainFog)" 13 | authors = "Draradech" 14 | description = "Allows simple control over water, nether and terrain fog." 15 | 16 | [[mixins]] 17 | config = "${mod_id}.mixins.json" 18 | 19 | [[dependencies.${mod_id}]] 20 | modId = "minecraft" 21 | type="required" 22 | versionRange = "[${minecraft_version},)" 23 | ordering = "NONE" 24 | side = "CLIENT" 25 | 26 | [[dependencies.${mod_id}]] 27 | modId = "cloth_config" 28 | type="required" 29 | versionRange = "[1,)" 30 | ordering = "NONE" 31 | side = "CLIENT" 32 | -------------------------------------------------------------------------------- /fabric/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${mod_id}", 4 | "version": "${version}", 5 | "name": "Simple Fog Control", 6 | "description": "Allows simple control over water, nether and terrain fog.", 7 | "authors": [ 8 | "Draradech" 9 | ], 10 | "contributors": [ 11 | "orangishcat (RainFog)" 12 | ], 13 | "contact": { 14 | "homepage": "https://github.com/Draradech/SimpleFogControl", 15 | "issues": "https://github.com/Draradech/SimpleFogControl/issues" 16 | }, 17 | "license": "MIT", 18 | "icon": "assets/${mod_id}/icon.png", 19 | "environment": "client", 20 | "entrypoints": { 21 | "main": [ 22 | "de.draradech.simplefog.SimpleFogFabric" 23 | ], 24 | "modmenu": [ 25 | "de.draradech.simplefog.SimpleFogMenuIntegration" 26 | ] 27 | }, 28 | "mixins": [ 29 | "${mod_id}.mixins.json" 30 | ], 31 | "depends": { 32 | "minecraft": ">=${minecraft_version}", 33 | "cloth-config": "*" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | mavenCentral() 5 | exclusiveContent { 6 | forRepository { 7 | maven { 8 | name = 'Fabric' 9 | url = uri('https://maven.fabricmc.net') 10 | } 11 | } 12 | filter { 13 | includeGroupAndSubgroups('net.fabricmc') 14 | includeGroup('fabric-loom') 15 | } 16 | } 17 | exclusiveContent { 18 | forRepository { 19 | maven { 20 | name = 'Forge' 21 | url = uri('https://maven.minecraftforge.net') 22 | } 23 | } 24 | filter { 25 | includeGroupAndSubgroups('net.minecraftforge') 26 | } 27 | } 28 | } 29 | } 30 | 31 | plugins { 32 | id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' 33 | } 34 | 35 | rootProject.name = 'SimpleFogControl' 36 | include('common') 37 | include('fabric') 38 | include('neoforge') 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Manuel Kasten 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /neoforge/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'multiloader-loader' 3 | id 'net.neoforged.moddev' 4 | } 5 | 6 | dependencies { 7 | api "me.shedaniel.cloth:cloth-config-neoforge:${clothconfig_version}" 8 | } 9 | 10 | neoForge { 11 | version = neoforge_version 12 | // Automatically enable neoforge AccessTransformers if the file exists 13 | def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg') 14 | if (at.exists()) { 15 | accessTransformers.from(at.absolutePath) 16 | } 17 | parchment { 18 | minecraftVersion = parchment_minecraft 19 | mappingsVersion = parchment_version 20 | } 21 | runs { 22 | configureEach { 23 | systemProperty('neoforge.enabledGameTestNamespaces', mod_id) 24 | ideName = "NeoForge ${it.name.capitalize()} (${project.path})" // Unify the run config names with fabric 25 | } 26 | client { 27 | client() 28 | } 29 | server { 30 | server() 31 | } 32 | } 33 | mods { 34 | "${mod_id}" { 35 | sourceSet sourceSets.main 36 | } 37 | } 38 | } 39 | 40 | sourceSets.main.resources { srcDir 'src/generated/resources' } -------------------------------------------------------------------------------- /common/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'multiloader-common' 3 | id 'net.neoforged.moddev' 4 | } 5 | 6 | neoForge { 7 | neoFormVersion = neo_form_version 8 | // Automatically enable AccessTransformers if the file exists 9 | def at = file('src/main/resources/META-INF/accesstransformer.cfg') 10 | if (at.exists()) { 11 | accessTransformers.from(at.absolutePath) 12 | } 13 | parchment { 14 | minecraftVersion = parchment_minecraft 15 | mappingsVersion = parchment_version 16 | } 17 | } 18 | 19 | dependencies { 20 | compileOnly group: 'org.ow2.asm', name: 'asm', version: '9.8' 21 | compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5' 22 | compileOnly group: 'io.github.llamalad7', name: 'mixinextras-common', version: '0.3.5' 23 | annotationProcessor group: 'io.github.llamalad7', name: 'mixinextras-common', version: '0.3.5' 24 | api "me.shedaniel.cloth:cloth-config-neoforge:${clothconfig_version}" 25 | } 26 | 27 | configurations { 28 | commonJava { 29 | canBeResolved = false 30 | canBeConsumed = true 31 | } 32 | commonResources { 33 | canBeResolved = false 34 | canBeConsumed = true 35 | } 36 | } 37 | 38 | artifacts { 39 | commonJava sourceSets.main.java.sourceDirectories.singleFile 40 | commonResources sourceSets.main.resources.sourceDirectories.singleFile 41 | } 42 | 43 | -------------------------------------------------------------------------------- /fabric/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'multiloader-loader' 3 | id 'fabric-loom' 4 | } 5 | 6 | dependencies { 7 | minecraft "com.mojang:minecraft:${minecraft_version}" 8 | mappings loom.layered { 9 | officialMojangMappings() 10 | parchment("org.parchmentmc.data:parchment-${parchment_minecraft}:${parchment_version}@zip") 11 | } 12 | modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" 13 | modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" 14 | modImplementation "com.terraformersmc:modmenu:${modmenu_version}" 15 | modApi("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") { 16 | exclude(group: "net.fabricmc.fabric-api") 17 | } 18 | } 19 | 20 | loom { 21 | def aw = project(':common').file("src/main/resources/${mod_id}.accesswidener") 22 | if (aw.exists()) { 23 | accessWidenerPath.set(aw) 24 | } 25 | mixin { 26 | defaultRefmapName.set("${mod_id}.refmap.json") 27 | } 28 | runs { 29 | client { 30 | client() 31 | setConfigName('Fabric Client') 32 | ideConfigGenerated(true) 33 | runDir('runs/client') 34 | } 35 | server { 36 | server() 37 | setConfigName('Fabric Server') 38 | ideConfigGenerated(true) 39 | runDir('runs/server') 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /common/src/main/java/de/draradech/simplefog/mixin/FogRendererMixin.java: -------------------------------------------------------------------------------- 1 | package de.draradech.simplefog.mixin; 2 | 3 | import de.draradech.simplefog.SimpleFogMain; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.renderer.fog.FogData; 6 | import net.minecraft.client.renderer.fog.FogRenderer; 7 | import net.minecraft.world.level.Level; 8 | import org.objectweb.asm.Opcodes; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Redirect; 12 | 13 | @Mixin(FogRenderer.class) 14 | public class FogRendererMixin { 15 | private boolean active() 16 | { 17 | if (!SimpleFogMain.config.overworldToggle && Minecraft.getInstance().player.level().dimension() == Level.OVERWORLD) return false; 18 | if (!SimpleFogMain.config.netherToggle && Minecraft.getInstance().player.level().dimension() == Level.NETHER) return false; 19 | if (!SimpleFogMain.config.endToggle && Minecraft.getInstance().player.level().dimension() == Level.END) return false; 20 | return true; 21 | } 22 | 23 | @Redirect(method = "setupFog", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/fog/FogData;renderDistanceStart:F", opcode = Opcodes.PUTFIELD)) 24 | private void modifyRenderDistanceStart(FogData data, float renderDistanceStart) { 25 | if (active()) data.renderDistanceStart = 1e5f; 26 | else data.renderDistanceStart = renderDistanceStart; 27 | } 28 | 29 | @Redirect(method = "setupFog", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/fog/FogData;renderDistanceEnd:F", opcode = Opcodes.PUTFIELD)) 30 | private void modifyRenderDistanceEnd(FogData data, float renderDistanceEnd) { 31 | if (active()) data.renderDistanceEnd = 1e5f; 32 | else data.renderDistanceEnd = renderDistanceEnd; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/src/main/java/de/draradech/simplefog/SimpleFogConfig.java: -------------------------------------------------------------------------------- 1 | package de.draradech.simplefog; 2 | 3 | import me.shedaniel.autoconfig.ConfigData; 4 | import me.shedaniel.autoconfig.annotation.Config; 5 | import me.shedaniel.autoconfig.annotation.ConfigEntry; 6 | 7 | @Config(name = "simplefog") 8 | public class SimpleFogConfig implements ConfigData { 9 | public static class RainConfig 10 | { 11 | public boolean rainToggle = true; 12 | public float rainStart = 0.0f; 13 | public float rainStartIndoor = 25.0f; 14 | public float rainEnd = 110.0f; 15 | public float rainFogApplySpeed = 1.0f; 16 | } 17 | 18 | @ConfigEntry.Category(value = "overworld") 19 | public boolean overworldToggle = true; 20 | @ConfigEntry.Category(value = "overworld") 21 | public float overworldStart = 70.0f; 22 | @ConfigEntry.Category(value = "overworld") 23 | public float overworldEnd = 130.0f; 24 | @ConfigEntry.Category(value = "overworld") 25 | @ConfigEntry.Gui.CollapsibleObject 26 | public RainConfig rainConfig = new RainConfig(); 27 | 28 | @ConfigEntry.Category(value = "nether") 29 | public boolean netherToggle = true; 30 | @ConfigEntry.Category(value = "nether") 31 | public float netherStart = 5.0f; 32 | @ConfigEntry.Category(value = "nether") 33 | public float netherEnd = 80.0f; 34 | 35 | @ConfigEntry.Category(value = "end") 36 | public boolean endToggle = true; 37 | @ConfigEntry.Category(value = "end") 38 | public float endStart = 70.0f; 39 | @ConfigEntry.Category(value = "end") 40 | public float endEnd = 130.0f; 41 | 42 | @ConfigEntry.Category(value = "water") 43 | public boolean waterToggle = true; 44 | @ConfigEntry.Category(value = "water") 45 | public float waterStart = -20.0f; 46 | @ConfigEntry.Category(value = "water") 47 | public float waterEnd = 90.0f; 48 | @ConfigEntry.Category(value = "water") 49 | public float waterEndSwamp = 60.0f; 50 | } 51 | -------------------------------------------------------------------------------- /common/src/main/resources/assets/simplefog/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "text.autoconfig.simplefog.title": "Simple Fog Control", 3 | "text.autoconfig.simplefog.category.overworld": "Overworld Fog", 4 | "text.autoconfig.simplefog.option.overworldToggle": "Enable overworld fog modification", 5 | "text.autoconfig.simplefog.option.overworldStart": "Fog begin (% of view distance)", 6 | "text.autoconfig.simplefog.option.overworldEnd": "Fog end (% of view distance)", 7 | "text.autoconfig.simplefog.option.rainConfig": "Rain fog", 8 | "text.autoconfig.simplefog.option.rainConfig.rainToggle": "Enable rain fog modification", 9 | "text.autoconfig.simplefog.option.rainConfig.rainStart": "Fog begin (% of view distance)", 10 | "text.autoconfig.simplefog.option.rainConfig.rainStartIndoor": "Fog begin indoor (% of view distance)", 11 | "text.autoconfig.simplefog.option.rainConfig.rainEnd": "Fog end (% of view distance)", 12 | "text.autoconfig.simplefog.option.rainConfig.rainFogApplySpeed": "Fog apply speed (% per tick)", 13 | "text.autoconfig.simplefog.category.water": "Water Fog", 14 | "text.autoconfig.simplefog.option.waterToggle": "Enable water fog modification", 15 | "text.autoconfig.simplefog.option.waterStart": "Fog begin (% of view distance)", 16 | "text.autoconfig.simplefog.option.waterEnd": "Fog end (% of view distance)", 17 | "text.autoconfig.simplefog.option.waterEndSwamp": "Fog end in swamp (% of view distance)", 18 | "text.autoconfig.simplefog.category.nether": "Nether Fog", 19 | "text.autoconfig.simplefog.option.netherToggle": "Enable nether fog modification", 20 | "text.autoconfig.simplefog.option.netherStart": "Fog begin (% of view distance)", 21 | "text.autoconfig.simplefog.option.netherEnd": "Fog end (% of view distance)", 22 | "text.autoconfig.simplefog.category.end": "End Fog", 23 | "text.autoconfig.simplefog.option.endToggle": "Enable end fog modification", 24 | "text.autoconfig.simplefog.option.endStart": "Fog begin (% of view distance)", 25 | "text.autoconfig.simplefog.option.endEnd": "Fog end (% of view distance)" 26 | } -------------------------------------------------------------------------------- /common/src/main/java/de/draradech/simplefog/mixin/WaterFogEnvironmentMixin.java: -------------------------------------------------------------------------------- 1 | package de.draradech.simplefog.mixin; 2 | 3 | import de.draradech.simplefog.SimpleFogMain; 4 | import net.minecraft.client.Camera; 5 | import net.minecraft.client.DeltaTracker; 6 | import net.minecraft.client.multiplayer.ClientLevel; 7 | import net.minecraft.client.player.LocalPlayer; 8 | import net.minecraft.client.renderer.fog.FogData; 9 | import net.minecraft.client.renderer.fog.environment.WaterFogEnvironment; 10 | import net.minecraft.tags.BiomeTags; 11 | import net.minecraft.world.attribute.EnvironmentAttributes; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | import org.spongepowered.asm.mixin.injection.Inject; 15 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 16 | 17 | @Mixin(WaterFogEnvironment.class) 18 | public class WaterFogEnvironmentMixin { 19 | @Inject(at = @At("TAIL"), method = "setupFog(Lnet/minecraft/client/renderer/fog/FogData;Lnet/minecraft/client/Camera;Lnet/minecraft/client/multiplayer/ClientLevel;FLnet/minecraft/client/DeltaTracker;)V") 20 | public void tailSetupFog(FogData fogData, Camera camera, ClientLevel clientLevel, float viewDistance, DeltaTracker deltaTracker, CallbackInfo ci) 21 | { 22 | if (!SimpleFogMain.config.waterToggle) return; 23 | fogData.environmentalStart = viewDistance * SimpleFogMain.config.waterStart * 0.01f; 24 | fogData.environmentalEnd = viewDistance * SimpleFogMain.config.waterEnd * 0.01f; 25 | if (camera.entity() instanceof LocalPlayer localPlayer) { 26 | if (camera.attributeProbe().getValue(EnvironmentAttributes.WATER_FOG_END_DISTANCE, 0.0f) < 90.0f) 27 | { 28 | fogData.environmentalEnd = viewDistance * SimpleFogMain.config.waterEndSwamp * 0.01f; 29 | } 30 | fogData.environmentalEnd *= Math.max(0.25F, localPlayer.getWaterVision()); 31 | } 32 | fogData.skyEnd = fogData.environmentalEnd; 33 | fogData.cloudEnd = fogData.environmentalEnd; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /common/src/main/java/de/draradech/simplefog/mixin/AtmosphericFogEnvironmentMixin.java: -------------------------------------------------------------------------------- 1 | package de.draradech.simplefog.mixin; 2 | 3 | import de.draradech.simplefog.SimpleFogConfig; 4 | import de.draradech.simplefog.SimpleFogMain; 5 | import net.minecraft.client.Camera; 6 | import net.minecraft.client.DeltaTracker; 7 | import net.minecraft.client.Minecraft; 8 | import net.minecraft.client.multiplayer.ClientLevel; 9 | import net.minecraft.client.renderer.fog.FogData; 10 | import net.minecraft.client.renderer.fog.environment.AtmosphericFogEnvironment; 11 | import net.minecraft.core.BlockPos; 12 | import net.minecraft.world.entity.Entity; 13 | import net.minecraft.world.level.Level; 14 | import net.minecraft.world.level.levelgen.Heightmap; 15 | import org.spongepowered.asm.mixin.Mixin; 16 | import org.spongepowered.asm.mixin.injection.At; 17 | import org.spongepowered.asm.mixin.injection.Inject; 18 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 19 | 20 | @Mixin(AtmosphericFogEnvironment.class) 21 | public class AtmosphericFogEnvironmentMixin { 22 | private static float currentFogStartPercent = Float.NaN; 23 | private static float currentFogEndPercent = Float.NaN; 24 | private static float approach(float current, float target, float step) { 25 | if (Float.isNaN(current)) return target; 26 | return current < target ? Math.min(target, current + step) : Math.max(target, current - step); 27 | } 28 | 29 | @Inject(at = @At("TAIL"), method = "setupFog(Lnet/minecraft/client/renderer/fog/FogData;Lnet/minecraft/client/Camera;Lnet/minecraft/client/multiplayer/ClientLevel;FLnet/minecraft/client/DeltaTracker;)V") 30 | public void tailSetupFog(FogData fogData, Camera camera, ClientLevel clientLevel, float viewDistance, DeltaTracker deltaTracker, CallbackInfo ci) 31 | { 32 | if (SimpleFogMain.config.overworldToggle && clientLevel.dimension() == Level.OVERWORLD) 33 | { 34 | float targetFogStartPercent = SimpleFogMain.config.overworldStart; 35 | float targetFogEndPercent = SimpleFogMain.config.overworldEnd; 36 | SimpleFogConfig.RainConfig rainConf = SimpleFogMain.config.rainConfig; 37 | if (!rainConf.rainToggle) return; 38 | 39 | if (clientLevel.isRaining()) { 40 | BlockPos blockPos = camera.blockPosition(); 41 | boolean skylight = blockPos.getY() >= clientLevel.getHeight(Heightmap.Types.WORLD_SURFACE, blockPos.getX(), blockPos.getZ()); 42 | targetFogStartPercent = skylight ? rainConf.rainStart : rainConf.rainStartIndoor; 43 | targetFogEndPercent = rainConf.rainEnd; 44 | } 45 | 46 | if (currentFogStartPercent != targetFogStartPercent || currentFogEndPercent != targetFogEndPercent) { 47 | float applySpeed = rainConf.rainFogApplySpeed * deltaTracker.getRealtimeDeltaTicks(); 48 | currentFogStartPercent = approach(currentFogStartPercent, targetFogStartPercent, applySpeed); 49 | currentFogEndPercent = approach(currentFogEndPercent, targetFogEndPercent, applySpeed); 50 | } 51 | 52 | fogData.environmentalStart = viewDistance * currentFogStartPercent * 0.01f; 53 | fogData.environmentalEnd = viewDistance * currentFogEndPercent * 0.01f; 54 | fogData.skyEnd = Math.min(fogData.environmentalEnd, viewDistance); 55 | float cloudEndClear = Minecraft.getInstance().options.cloudRange().get() * 16.0f; 56 | fogData.cloudEnd = rainConf.rainEnd + (cloudEndClear - rainConf.rainEnd) * ((fogData.environmentalEnd - rainConf.rainEnd) / Math.max(viewDistance * SimpleFogMain.config.overworldEnd * 0.015f - rainConf.rainEnd, 1.0f)); 57 | } 58 | else if (SimpleFogMain.config.netherToggle && clientLevel.dimension() == Level.NETHER) 59 | { 60 | fogData.environmentalStart = viewDistance * SimpleFogMain.config.netherStart * 0.01f; 61 | fogData.environmentalEnd = viewDistance * SimpleFogMain.config.netherEnd * 0.01f; 62 | fogData.cloudEnd = fogData.environmentalEnd; 63 | fogData.skyEnd = fogData.environmentalEnd; 64 | } 65 | else if (SimpleFogMain.config.endToggle && clientLevel.dimension() == Level.END) 66 | { 67 | fogData.environmentalStart = viewDistance * SimpleFogMain.config.endStart * 0.01f; 68 | fogData.environmentalEnd = viewDistance * SimpleFogMain.config.endEnd * 0.01f; 69 | fogData.cloudEnd = fogData.environmentalEnd; 70 | fogData.skyEnd = fogData.environmentalEnd; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | if ! command -v java >/dev/null 2>&1 137 | then 138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 139 | 140 | Please set the JAVA_HOME variable in your environment to match the 141 | location of your Java installation." 142 | fi 143 | fi 144 | 145 | # Increase the maximum file descriptors if we can. 146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 147 | case $MAX_FD in #( 148 | max*) 149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 150 | # shellcheck disable=SC2039,SC3045 151 | MAX_FD=$( ulimit -H -n ) || 152 | warn "Could not query maximum file descriptor limit" 153 | esac 154 | case $MAX_FD in #( 155 | '' | soft) :;; #( 156 | *) 157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 158 | # shellcheck disable=SC2039,SC3045 159 | ulimit -n "$MAX_FD" || 160 | warn "Could not set maximum file descriptor limit to $MAX_FD" 161 | esac 162 | fi 163 | 164 | # Collect all arguments for the java command, stacking in reverse order: 165 | # * args from the command line 166 | # * the main class name 167 | # * -classpath 168 | # * -D...appname settings 169 | # * --module-path (only if needed) 170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 171 | 172 | # For Cygwin or MSYS, switch paths to Windows format before running java 173 | if "$cygwin" || "$msys" ; then 174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 176 | 177 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 178 | 179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 180 | for arg do 181 | if 182 | case $arg in #( 183 | -*) false ;; # don't mess with options #( 184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 185 | [ -e "$t" ] ;; #( 186 | *) false ;; 187 | esac 188 | then 189 | arg=$( cygpath --path --ignore --mixed "$arg" ) 190 | fi 191 | # Roll the args list around exactly as many times as the number of 192 | # args, so each arg winds up back in the position where it started, but 193 | # possibly modified. 194 | # 195 | # NB: a `for` loop captures its iteration list before it begins, so 196 | # changing the positional parameters here affects neither the number of 197 | # iterations, nor the values presented in `arg`. 198 | shift # remove old arg 199 | set -- "$@" "$arg" # push replacement arg 200 | done 201 | fi 202 | 203 | 204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 206 | 207 | # Collect all arguments for the java command: 208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 209 | # and any embedded shellness will be escaped. 210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 211 | # treated as '${Hostname}' itself on the command line. 212 | 213 | set -- \ 214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 215 | -classpath "$CLASSPATH" \ 216 | org.gradle.wrapper.GradleWrapperMain \ 217 | "$@" 218 | 219 | # Stop when "xargs" is not available. 220 | if ! command -v xargs >/dev/null 2>&1 221 | then 222 | die "xargs is not available" 223 | fi 224 | 225 | # Use "xargs" to parse quoted args. 226 | # 227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 228 | # 229 | # In Bash we could simply go: 230 | # 231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 232 | # set -- "${ARGS[@]}" "$@" 233 | # 234 | # but POSIX shell has neither arrays nor command substitution, so instead we 235 | # post-process each arg (as a line of input to sed) to backslash-escape any 236 | # character that might be a shell metacharacter, then use eval to reverse 237 | # that process (while maintaining the separation between arguments), and wrap 238 | # the whole thing up as a single "set" statement. 239 | # 240 | # This will of course break if any of these variables contains a newline or 241 | # an unmatched quote. 242 | # 243 | 244 | eval "set -- $( 245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 246 | xargs -n1 | 247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 248 | tr '\n' ' ' 249 | )" '"$@"' 250 | 251 | exec "$JAVACMD" "$@" 252 | --------------------------------------------------------------------------------