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.

  • Field Details

    • mode

      private final FogRenderer.FogMode mode
    • type

      private final FogType type
    • farPlaneDistance

      private float farPlaneDistance
    • nearPlaneDistance

      private float nearPlaneDistance
    • fogShape

      private FogShape fogShape
  • Constructor Details

  • Method Details

    • getMode

      public FogRenderer.FogMode getMode()
      Returns the mode of fog being rendered.
      Returns:
      the mode of fog being rendered
    • getType

      public FogType getType()
      Returns the type of fog being rendered.
      Returns:
      the type of fog being rendered
    • getFarPlaneDistance

      public float getFarPlaneDistance()
      Returns the distance to the far plane where the fog ends.
      Returns:
      the distance to the far plane where the fog ends
    • getNearPlaneDistance

      public float getNearPlaneDistance()
      Returns the distance to the near plane where the fog starts.
      Returns:
      the distance to the near plane where the fog starts
    • getFogShape

      public FogShape getFogShape()
      Returns the shape of the fog being rendered.
      Returns:
      the shape of the fog being rendered
    • setFarPlaneDistance

      public 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:
    • setNearPlaneDistance

      public 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:
    • setFogShape

      public void setFogShape(FogShape shape)
      Sets 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
    • scaleFarPlaneDistance

      public 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
    • scaleNearPlaneDistance

      public 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