Record Class SkyLayerDefinition

java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcanvas.api.client.sky.SkyLayerDefinition
Record Components:
name - how the layer is found at runtime, with Skybox.layer(String); unnamed layers are named layer_<index>
texture - the full path of the image, <namespace>:textures/<path>.png
fragmentShader - replaces the type's built-in fragment shader, from assets/<namespace>/shaders/<path>.fsh; see coolcatcanvas:sky.glsl
tint - multiplies the layer's colors, packed ARGB: its alpha is the layer's base opacity
orientation - a fixed rotation in degrees, applied as yaw (y), then pitch (x), then roll (z)
rotation - a rotation over time, applied after the orientation
animation - plays the texture as a flipbook of frames stacked vertically
dayFade - shows the layer only during part of the day
rainFade - how much rain (and thunder) fades the layer out, from 0 (none) to 1 (gone in full rain)
fog - how much the layer blends into the fog color towards the horizon and in water, lava or snow, from 0 (never) to 1 (as much as vanilla's sky)
blur - linear texture filtering; false keeps pixels sharp
size - a sprite's width, in degrees of the sky
params - up to 4 values the shader reads as SkyParams[i]: 1 to 4 numbers, or a color

public record SkyLayerDefinition(String name, SkyLayerType type, Optional<net.minecraft.resources.Identifier> texture, Optional<net.minecraft.resources.Identifier> fragmentShader, SkyBlend blend, int tint, SkyLayerStage stage, org.joml.Vector3fc orientation, Optional<SkyLayerDefinition.Rotation> rotation, Optional<SkyLayerDefinition.Animation> animation, Optional<SkyLayerDefinition.DayFade> dayFade, float rainFade, float fog, boolean blur, float size, List<org.joml.Vector4fc> params) extends Record
One layer of a SkyboxDefinition: an image, a gradient or a shader drawn over the sky, and how it moves and fades. In JSON (only type and what the type needs are required):
{
  "name": "stars",
  "type": "panorama",
  "texture": "mymod:textures/sky/stars.png",
  "blend": "additive",
  "tint": "#FFFFFFFF",
  "stage": "behind_celestials",
  "orientation": [0, 0, 0],
  "rotation": {"axis": [0, 0, 1], "speed": 1, "clock": "star_angle"},
  "animation": {"frames": 4, "frame_time": 10, "interpolate": true},
  "day_fade": {"fade_in": [11000, 13000], "fade_out": [23000, 1000]},
  "rain_fade": 1,
  "fog": 1,
  "blur": true,
  "params": [[0.5, 1, 0, 0], "#FF3366CC"]
}
  • Field Details

    • MAX_PARAMS

      public static final int MAX_PARAMS
      See Also:
    • WHITE

      public static final int WHITE
      See Also:
    • COLOR_CODEC

      public static final com.mojang.serialization.Codec<Integer> COLOR_CODEC
      A color: "#AARRGGBB", "#RRGGBB", a packed ARGB int, or 3 or 4 floats.
    • PARAM_CODEC

      public static final com.mojang.serialization.Codec<org.joml.Vector4fc> PARAM_CODEC
      1 to 4 numbers (the rest are 0), or a color as its RGBA components.
    • CODEC

      public static final com.mojang.serialization.Codec<SkyLayerDefinition> CODEC
  • Constructor Details

    • SkyLayerDefinition

      public SkyLayerDefinition(String name, SkyLayerType type, Optional<net.minecraft.resources.Identifier> texture, Optional<net.minecraft.resources.Identifier> fragmentShader, SkyBlend blend, int tint, SkyLayerStage stage, org.joml.Vector3fc orientation, Optional<SkyLayerDefinition.Rotation> rotation, Optional<SkyLayerDefinition.Animation> animation, Optional<SkyLayerDefinition.DayFade> dayFade, float rainFade, float fog, boolean blur, float size, List<org.joml.Vector4fc> params)
      Creates an instance of a SkyLayerDefinition record class.
      Parameters:
      name - the value for the name record component
      type - the value for the type record component
      texture - the value for the texture record component
      fragmentShader - the value for the fragmentShader record component
      blend - the value for the blend record component
      tint - the value for the tint record component
      stage - the value for the stage record component
      orientation - the value for the orientation record component
      rotation - the value for the rotation record component
      animation - the value for the animation record component
      dayFade - the value for the dayFade record component
      rainFade - the value for the rainFade record component
      fog - the value for the fog record component
      blur - the value for the blur record component
      size - the value for the size record component
      params - the value for the params record component
  • Method Details

    • cubemap

      public static SkyLayerDefinition.Builder cubemap(net.minecraft.resources.Identifier texture)
      A cube of six faces around the sky, from one image; see SkyLayerType.CUBEMAP for the layout.
    • panorama

      public static SkyLayerDefinition.Builder panorama(net.minecraft.resources.Identifier texture)
      An equirectangular panorama around the sky.
    • sprite

      public static SkyLayerDefinition.Builder sprite(net.minecraft.resources.Identifier texture, float size)
      An image in the sky, size degrees wide, at the zenith until oriented or rotated.
    • gradient

      public static SkyLayerDefinition.Builder gradient(int zenith, int horizon, int nadir, float sharpness)
      A vertical gradient over the sky, packed ARGB colors.
      Parameters:
      sharpness - 1 fades linearly from the horizon, higher keeps the horizon color to a thinner band
    • shader

      public static SkyLayerDefinition.Builder shader(net.minecraft.resources.Identifier fragmentShader)
      A procedural sky drawn by a fragment shader of your own, from assets/<namespace>/shaders/<path>.fsh.
    • withName

      public SkyLayerDefinition withName(String name)
    • param

      public org.joml.Vector4fc param(int index)
      Param index, or zero if the definition doesn't set it.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • type

      public SkyLayerType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • texture

      public Optional<net.minecraft.resources.Identifier> texture()
      Returns the value of the texture record component.
      Returns:
      the value of the texture record component
    • fragmentShader

      public Optional<net.minecraft.resources.Identifier> fragmentShader()
      Returns the value of the fragmentShader record component.
      Returns:
      the value of the fragmentShader record component
    • blend

      public SkyBlend blend()
      Returns the value of the blend record component.
      Returns:
      the value of the blend record component
    • tint

      public int tint()
      Returns the value of the tint record component.
      Returns:
      the value of the tint record component
    • stage

      public SkyLayerStage stage()
      Returns the value of the stage record component.
      Returns:
      the value of the stage record component
    • orientation

      public org.joml.Vector3fc orientation()
      Returns the value of the orientation record component.
      Returns:
      the value of the orientation record component
    • rotation

      Returns the value of the rotation record component.
      Returns:
      the value of the rotation record component
    • animation

      Returns the value of the animation record component.
      Returns:
      the value of the animation record component
    • dayFade

      Returns the value of the dayFade record component.
      Returns:
      the value of the dayFade record component
    • rainFade

      public float rainFade()
      Returns the value of the rainFade record component.
      Returns:
      the value of the rainFade record component
    • fog

      public float fog()
      Returns the value of the fog record component.
      Returns:
      the value of the fog record component
    • blur

      public boolean blur()
      Returns the value of the blur record component.
      Returns:
      the value of the blur record component
    • size

      public float size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component
    • params

      public List<org.joml.Vector4fc> params()
      Returns the value of the params record component.
      Returns:
      the value of the params record component