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, withSkybox.layer(java.lang.String); unnamed layers are namedlayer_<index>texture- the full path of the image,<namespace>:textures/<path>.pngfragmentShader- replaces the type's built-in fragment shader, fromassets/<namespace>/shaders/<path>.fsh; seecoolcatcanvas:sky.glsltint- multiplies the layer's colors, packed ARGB: its alpha is the layer's base opacityorientation- a fixed rotation in degrees, applied as yaw (y), then pitch (x), then roll (z)rotation- a rotation over time, applied after the orientationanimation- plays the texture as a flipbook of frames stacked verticallydayFade- shows the layer only during part of the dayrainFade- 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 sharpsize- a sprite's width, in degrees of the skyparams- up to 4 values the shader reads asSkyParams[i]: 1 to 4 numbers, or a color
public record SkyLayerDefinition(String name, SkyLayerType type, Optional<net.minecraft.resources.ResourceLocation> texture, Optional<net.minecraft.resources.ResourceLocation> 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"]
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordPlays the texture as a flipbook:framesimages of equal height stacked top to bottom.static final classstatic final recordShows the layer during part of the day: it fades in over[startFadeIn, endFadeIn], stays, then fades out over[startFadeOut, endFadeOut].static final recordTurns the layer around an axis as its clock moves. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<SkyLayerDefinition> static final com.mojang.serialization.Codec<Integer> A color:"#AARRGGBB","#RRGGBB", a packed ARGB int, or 3 or 4 floats.static final intstatic final com.mojang.serialization.Codec<org.joml.Vector4fc> 1 to 4 numbers (the rest are 0), or a color as its RGBA components.static final int -
Constructor Summary
ConstructorsConstructorDescriptionSkyLayerDefinition(String name, SkyLayerType type, Optional<net.minecraft.resources.ResourceLocation> texture, Optional<net.minecraft.resources.ResourceLocation> 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 aSkyLayerDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theanimationrecord component.blend()Returns the value of theblendrecord component.booleanblur()Returns the value of theblurrecord component.static SkyLayerDefinition.Buildercubemap(net.minecraft.resources.ResourceLocation texture) A cube of six faces around the sky, from one image; seeSkyLayerType.CUBEMAPfor the layout.dayFade()Returns the value of thedayFaderecord component.final booleanIndicates whether some other object is "equal to" this one.floatfog()Returns the value of thefogrecord component.Optional<net.minecraft.resources.ResourceLocation> Returns the value of thefragmentShaderrecord component.static SkyLayerDefinition.Buildergradient(int zenith, int horizon, int nadir, float sharpness) A vertical gradient over the sky, packed ARGB colors.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.org.joml.Vector3fcReturns the value of theorientationrecord component.static SkyLayerDefinition.Builderpanorama(net.minecraft.resources.ResourceLocation texture) An equirectangular panorama around the sky.org.joml.Vector4fcparam(int index) Paramindex, or zero if the definition doesn't set it.List<org.joml.Vector4fc> params()Returns the value of theparamsrecord component.floatrainFade()Returns the value of therainFaderecord component.rotation()Returns the value of therotationrecord component.static SkyLayerDefinition.Buildershader(net.minecraft.resources.ResourceLocation fragmentShader) A procedural sky drawn by a fragment shader of your own, fromassets/<namespace>/shaders/<path>.fsh.floatsize()Returns the value of thesizerecord component.static SkyLayerDefinition.Buildersprite(net.minecraft.resources.ResourceLocation texture, float size) An image in the sky,sizedegrees wide, at the zenith until oriented or rotated.stage()Returns the value of thestagerecord component.Optional<net.minecraft.resources.ResourceLocation> texture()Returns the value of thetexturerecord component.inttint()Returns the value of thetintrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Field Details
-
MAX_PARAMS
public static final int MAX_PARAMS- See Also:
-
WHITE
public static final int WHITE- See Also:
-
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_CODEC1 to 4 numbers (the rest are 0), or a color as its RGBA components. -
CODEC
-
-
Constructor Details
-
SkyLayerDefinition
public SkyLayerDefinition(String name, SkyLayerType type, Optional<net.minecraft.resources.ResourceLocation> texture, Optional<net.minecraft.resources.ResourceLocation> 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 aSkyLayerDefinitionrecord class.- Parameters:
name- the value for thenamerecord componenttype- the value for thetyperecord componenttexture- the value for thetexturerecord componentfragmentShader- the value for thefragmentShaderrecord componentblend- the value for theblendrecord componenttint- the value for thetintrecord componentstage- the value for thestagerecord componentorientation- the value for theorientationrecord componentrotation- the value for therotationrecord componentanimation- the value for theanimationrecord componentdayFade- the value for thedayFaderecord componentrainFade- the value for therainFaderecord componentfog- the value for thefogrecord componentblur- the value for theblurrecord componentsize- the value for thesizerecord componentparams- the value for theparamsrecord component
-
-
Method Details
-
cubemap
A cube of six faces around the sky, from one image; seeSkyLayerType.CUBEMAPfor the layout. -
panorama
An equirectangular panorama around the sky. -
sprite
public static SkyLayerDefinition.Builder sprite(net.minecraft.resources.ResourceLocation texture, float size) An image in the sky,sizedegrees 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.ResourceLocation fragmentShader) A procedural sky drawn by a fragment shader of your own, fromassets/<namespace>/shaders/<path>.fsh. -
withName
-
param
public org.joml.Vector4fc param(int index) Paramindex, or zero if the definition doesn't set it. -
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
texture
Returns the value of thetexturerecord component.- Returns:
- the value of the
texturerecord component
-
fragmentShader
Returns the value of thefragmentShaderrecord component.- Returns:
- the value of the
fragmentShaderrecord component
-
blend
Returns the value of theblendrecord component.- Returns:
- the value of the
blendrecord component
-
tint
public int tint()Returns the value of thetintrecord component.- Returns:
- the value of the
tintrecord component
-
stage
Returns the value of thestagerecord component.- Returns:
- the value of the
stagerecord component
-
orientation
public org.joml.Vector3fc orientation()Returns the value of theorientationrecord component.- Returns:
- the value of the
orientationrecord component
-
rotation
Returns the value of therotationrecord component.- Returns:
- the value of the
rotationrecord component
-
animation
Returns the value of theanimationrecord component.- Returns:
- the value of the
animationrecord component
-
dayFade
Returns the value of thedayFaderecord component.- Returns:
- the value of the
dayFaderecord component
-
rainFade
public float rainFade()Returns the value of therainFaderecord component.- Returns:
- the value of the
rainFaderecord component
-
fog
public float fog()Returns the value of thefogrecord component.- Returns:
- the value of the
fogrecord component
-
blur
public boolean blur()Returns the value of theblurrecord component.- Returns:
- the value of the
blurrecord component
-
size
public float size()Returns the value of thesizerecord component.- Returns:
- the value of the
sizerecord component
-
params
Returns the value of theparamsrecord component.- Returns:
- the value of the
paramsrecord component
-