/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.jspecify.annotations.Nullable */ package net.minecraft.client.renderer.fog.environment; import net.minecraft.client.Camera; import net.minecraft.client.DeltaTracker; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.fog.FogData; import net.minecraft.client.renderer.fog.environment.FogEnvironment; import net.minecraft.world.attribute.EnvironmentAttributes; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.material.FogType; import org.jspecify.annotations.Nullable; public class WaterFogEnvironment extends FogEnvironment { @Override public void setupFog(FogData fog, Camera camera, ClientLevel level, float renderDistance, DeltaTracker deltaTracker) { float partialTicks = deltaTracker.getGameTimeDeltaPartialTick(false); fog.environmentalStart = camera.attributeProbe().getValue(EnvironmentAttributes.WATER_FOG_START_DISTANCE, partialTicks).floatValue(); fog.environmentalEnd = camera.attributeProbe().getValue(EnvironmentAttributes.WATER_FOG_END_DISTANCE, partialTicks).floatValue(); Entity entity = camera.entity(); if (entity instanceof LocalPlayer) { LocalPlayer player = (LocalPlayer)entity; fog.environmentalEnd *= Math.max(0.25f, player.getWaterVision()); } fog.skyEnd = fog.environmentalEnd; fog.cloudEnd = fog.environmentalEnd; } @Override public boolean isApplicable(@Nullable FogType fogType, Entity entity) { return fogType == FogType.WATER; } @Override public int getBaseColor(ClientLevel level, Camera camera, int renderDistance, float partialTicks) { return camera.attributeProbe().getValue(EnvironmentAttributes.WATER_FOG_COLOR, partialTicks); } }