禁用浸没雾

基本信息

属性 值
所属配置类 MiscConfig
字段 public static boolean disableSubmersionFog
类型 boolean
默认值 false(@Config.DefaultBoolean(false))
服务端同步 ✅ @Config.Sync
配置分类 category = "misc"
配置注释 Disable fog when camera is submerged in water or lava

门控的行为

实现点是 MixinEntityRenderer(早期阶段 Mixin):

@Redirect(
    method = "setupFog",
    at = @At(value = "INVOKE",
             target = "Lnet/minecraft/client/renderer/ActiveRenderInfo;"
                      + "getBlockAtEntityViewpoint(Lnet/minecraft/world/World;"
                      + "Lnet/minecraft/entity/EntityLivingBase;F)Lnet/minecraft/block/Block;"))
private Block freecam$disableSubmersionFog(World world, EntityLivingBase entity, float partialTicks) {
    Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(world, entity, partialTicks);
    if (FreecamController.instance().isActive() && MiscConfig.disableSubmersionFog
        && (block.getMaterial() == Material.water || block.getMaterial() == Material.lava)) {
        return Blocks.air;
    }
    return block;
}
环节 值
注入器 @Redirect,替换 setupFog 中对 ActiveRenderInfo.getBlockAtEntityViewpoint 的调用
改判方式 不改 EntityRenderer.setupFog 自身逻辑,而是把"视点所在的方块"换成 Blocks.air
触发材质 仅 Material.water 与 Material.lava
门控 isActive() && MiscConfig.disableSubmersionFog

作用原理

setupFog 需要先知道"渲染视点正处在什么方块里"来判断是否施加浸没(submersion)着色—— 水下的蓝绿色滤镜、岩浆下的橙红色滤镜与浓雾。把这一步查到的方块替换成空气, setupFog 就找不到浸没介质,滤镜自然消失。

由于判定依据是 getBlockAtEntityViewpoint(world, entity, partialTicks) 的返回值, 而自由相机激活时 renderViewEntity 已是 脱离实体, 所以滤镜是否消失取决于相机泡没在什么里,与玩家是否泡在水里无关。

只处理水和岩浆:其它浸没类介质(不含 Material.water / Material.lava 的自定义液体, 例如部分 mod 的油/血/冷却液)不受本选项影响——它做的是 Material 相等判断,不是"非空气即浸没"。

与 全亮度 的差异

两项都作用在 EntityRenderer 上但改的是不同环节:

选项 目标方法 改什么
全亮度 updateLightmap 把 gammaSetting 的读值换成 100.0F
disableSubmersionFog setupFog 把视点方块换成 Blocks.air

两者可以同时开启,互不冲突。

其它配置项

MiscConfig 共 5 项:

字段 类型 默认值 服务端同步
fullBright boolean false ✅
disableSubmersionFog boolean false ✅
overlayVisibility OverlayVisibility HIDE ✅
initialPerspective Perspective INSIDE ❌
showHand boolean false ❌

相关条目