Add FogMode to ViewportEvent.RenderFog (#8825)

This commit is contained in:
Jonathan Colmenares authored and GitHub committed 2022-07-09 11:20:40 -04:00
1 parent c102633566
commit b558b132cd
2 files changed
+14 -3

No files matched your search

@@ -439,7 +439,7 @@ public class ForgeHooksClient
if (camera.getPosition().y < (double)((float)camera.getBlockPosition().getY() + state.getHeight(camera.getEntity().level, camera.getBlockPosition())))
IClientFluidTypeExtensions.of(state).modifyFogRender(camera, mode, renderDistance, partialTick, nearDistance, farDistance, shape);
ViewportEvent.RenderFog event = new ViewportEvent.RenderFog(type, camera, partialTick, nearDistance, farDistance, shape);
ViewportEvent.RenderFog event = new ViewportEvent.RenderFog(mode, type, camera, partialTick, nearDistance, farDistance, shape);
if (MinecraftForge.EVENT_BUS.post(event))
{
RenderSystem.setShaderFogStart(event.getNearPlaneDistance());
@@ -8,6 +8,7 @@ package net.minecraftforge.client.event;
import com.mojang.blaze3d.shaders.FogShape;
import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.FogRenderer.FogMode;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.world.level.material.FogType;
import net.minecraftforge.common.MinecraftForge;
@@ -79,25 +80,35 @@ public abstract class ViewportEvent extends Event
@Cancelable
public static class RenderFog extends ViewportEvent
{
private final FogMode mode;
private final FogType type;
private float farPlaneDistance;
private float nearPlaneDistance;
private FogShape fogShape;
@ApiStatus.Internal
public RenderFog(FogType type, Camera camera, float partialTicks, float nearPlaneDistance, float farPlaneDistance, FogShape fogShape)
public RenderFog(FogMode mode, FogType type, Camera camera, float partialTicks, float nearPlaneDistance, float farPlaneDistance, FogShape fogShape)
{
super(Minecraft.getInstance().gameRenderer, camera, partialTicks);
this.mode = mode;
this.type = type;
setFarPlaneDistance(farPlaneDistance);
setNearPlaneDistance(nearPlaneDistance);
setFogShape(fogShape);
}
/**
* {@return the mode of fog being rendered}
*/
public FogMode getMode()
{
return mode;
}
/**
* {@return the type of fog being rendered}
*/
public FogType getMode()
public FogType getType()
{
return type;
}