Class ViewportEvent.RenderFog
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.ViewportEvent
net.neoforged.neoforge.client.event.ViewportEvent.RenderFog
- All Implemented Interfaces:
- net.neoforged.bus.api.ICancellableEvent
- Enclosing class:
- ViewportEvent
public static class ViewportEvent.RenderFog
extends ViewportEvent
implements net.neoforged.bus.api.ICancellableEvent
Fired for rendering custom fog. The plane distances are based on the player's render distance.
 
This event is cancellable, and 
. invalid reference
has a result
 The event must be cancelled for any changes to the plane distances to take effect.
This event is fired on the main Forge event bus, only on the logical client.
- 
Nested Class SummaryNested classes/interfaces inherited from class net.neoforged.neoforge.client.event.ViewportEventViewportEvent.ComputeCameraAngles, ViewportEvent.ComputeFogColor, ViewportEvent.ComputeFov, ViewportEvent.RenderFog
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate floatprivate FogShapeprivate final FogRenderer.FogModeprivate floatprivate final FogType
- 
Constructor SummaryConstructorsConstructorDescriptionRenderFog(FogRenderer.FogMode mode, FogType type, Camera camera, float partialTicks, float nearPlaneDistance, float farPlaneDistance, FogShape fogShape) 
- 
Method SummaryModifier and TypeMethodDescriptionfloatReturns the distance to the far plane where the fog ends.Returns the shape of the fog being rendered.getMode()Returns the mode of fog being rendered.floatReturns the distance to the near plane where the fog starts.getType()Returns the type of fog being rendered.voidscaleFarPlaneDistance(float factor) Scales the distance to the far plane of the fog by a given factor.voidscaleNearPlaneDistance(float factor) Scales the distance to the near plane of the fog by a given factor.voidsetFarPlaneDistance(float distance) Sets the distance to the far plane of the fog.voidsetFogShape(FogShape shape) Sets the new shape of the fog being rendered.voidsetNearPlaneDistance(float distance) Sets the distance to the near plane of the fog.Methods inherited from class net.neoforged.neoforge.client.event.ViewportEventgetCamera, getPartialTick, getRendererMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.bus.api.ICancellableEventisCanceled, setCanceled
- 
Field Details- 
mode
- 
type
- 
farPlaneDistanceprivate float farPlaneDistance
- 
nearPlaneDistanceprivate float nearPlaneDistance
- 
fogShape
 
- 
- 
Constructor Details- 
RenderFog@Internal public RenderFog(FogRenderer.FogMode mode, FogType type, Camera camera, float partialTicks, float nearPlaneDistance, float farPlaneDistance, FogShape fogShape) 
 
- 
- 
Method Details- 
getModeReturns the mode of fog being rendered.- Returns:
- the mode of fog being rendered
 
- 
getTypeReturns the type of fog being rendered.- Returns:
- the type of fog being rendered
 
- 
getFarPlaneDistancepublic float getFarPlaneDistance()Returns the distance to the far plane where the fog ends.- Returns:
- the distance to the far plane where the fog ends
 
- 
getNearPlaneDistancepublic float getNearPlaneDistance()Returns the distance to the near plane where the fog starts.- Returns:
- the distance to the near plane where the fog starts
 
- 
getFogShapeReturns the shape of the fog being rendered.- Returns:
- the shape of the fog being rendered
 
- 
setFarPlaneDistancepublic void setFarPlaneDistance(float distance) Sets the distance to the far plane of the fog.- Parameters:
- distance- the new distance to the far place
- See Also:
 
- 
setNearPlaneDistancepublic void setNearPlaneDistance(float distance) Sets the distance to the near plane of the fog.- Parameters:
- distance- the new distance to the near plane
- See Also:
 
- 
setFogShapeSets the new shape of the fog being rendered. The new shape will only take effect if the event is cancelled.- Parameters:
- shape- the new shape of the fog
 
- 
scaleFarPlaneDistancepublic void scaleFarPlaneDistance(float factor) Scales the distance to the far plane of the fog by a given factor.- Parameters:
- factor- the factor to scale the far plane distance by
 
- 
scaleNearPlaneDistancepublic void scaleNearPlaneDistance(float factor) Scales the distance to the near plane of the fog by a given factor.- Parameters:
- factor- the factor to scale the near plane distance by
 
 
-