46 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.client.renderer.fog.environment;
 | |
| 
 | |
| import net.fabricmc.api.EnvType;
 | |
| import net.fabricmc.api.Environment;
 | |
| import net.minecraft.client.Camera;
 | |
| import net.minecraft.client.DeltaTracker;
 | |
| import net.minecraft.client.multiplayer.ClientLevel;
 | |
| import net.minecraft.client.renderer.fog.FogData;
 | |
| import net.minecraft.core.BlockPos;
 | |
| import net.minecraft.world.effect.MobEffects;
 | |
| import net.minecraft.world.entity.Entity;
 | |
| import net.minecraft.world.entity.LivingEntity;
 | |
| import net.minecraft.world.level.material.FogType;
 | |
| import org.jetbrains.annotations.Nullable;
 | |
| 
 | |
| @Environment(EnvType.CLIENT)
 | |
| public class LavaFogEnvironment extends FogEnvironment {
 | |
| 	private static final int COLOR = -6743808;
 | |
| 
 | |
| 	@Override
 | |
| 	public int getBaseColor(ClientLevel level, Camera camera, int renderDistance, float partialTick) {
 | |
| 		return -6743808;
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public void setupFog(FogData fogData, Entity entity, BlockPos pos, ClientLevel level, float renderDistance, DeltaTracker deltaTracker) {
 | |
| 		if (entity.isSpectator()) {
 | |
| 			fogData.environmentalStart = -8.0F;
 | |
| 			fogData.environmentalEnd = renderDistance * 0.5F;
 | |
| 		} else if (entity instanceof LivingEntity livingEntity && livingEntity.hasEffect(MobEffects.FIRE_RESISTANCE)) {
 | |
| 			fogData.environmentalStart = 0.0F;
 | |
| 			fogData.environmentalEnd = 5.0F;
 | |
| 		} else {
 | |
| 			fogData.environmentalStart = 0.25F;
 | |
| 			fogData.environmentalEnd = 1.0F;
 | |
| 		}
 | |
| 
 | |
| 		fogData.skyEnd = fogData.environmentalEnd;
 | |
| 		fogData.cloudEnd = fogData.environmentalEnd;
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public boolean isApplicable(@Nullable FogType fogType, Entity entity) {
 | |
| 		return fogType == FogType.LAVA;
 | |
| 	}
 | |
| }
 |