Interface Skybox
public interface Skybox
A custom sky, made with
Skyboxes.register(Identifier, SkyboxDefinition): layers of images, gradients and shaders drawn into vanilla's sky,
and parts of vanilla's sky hidden. Any number can show at once, drawn by ascending priority.
A skybox shows while it's enabled, fading in and out. Unless told otherwise with activeWhen(Predicate), one whose
definition lists dimensions enables itself in those; others wait for enable() (or the server's
SkyboxControl).
Settings made here override the definition's, and survive resource reloads. Durations are in ticks of real time (20 per second). Only use a skybox from the render thread.
-
Method Summary
Modifier and TypeMethodDescriptionactiveWhen(@Nullable Predicate<SkyContext> condition) Enables the skybox whenever the condition holds and disables it otherwise, checked every frame.@Nullable net.minecraft.resources.IdentifierTheskyboxJSON it's loaded from, or null for a definition built in code.disable()Fades out.Hides the skybox right away, skipping the fade-out.enable()Fades in, or keeps the skybox on if it's already.enableFor(int ticks) Fades in, stays forticks, then fades out.Shows the skybox fully right away, skipping the fade-in.@Nullable Stringerror()Why it failed to load or draw, if it did.default Skyboxfade(int ticks) How it fades in and out.hidden()The parts of vanilla's sky it hides.hide(VanillaSky... parts) Replaces the parts of vanilla's sky it hides.net.minecraft.resources.Identifierid()booleanWhether it's enabled; it may still be fading in.booleanisLoaded()Whether its definition and shaders loaded, so it can be drawn.booleanWhether it's drawn this frame: enabled, or still fading out.The layer namednamein the definition (unnamed layers arelayer_0,layer_1, ...).layers()The layers of the loaded definition, in draw order; empty before it has loaded.onFrame(@Nullable Consumer<SkyContext> callback) Runs every frame while the skybox is visible, before it's drawn: a place to drive its layers.intpriority()priority(int priority) Lower priorities are drawn first, so higher ones end up on top.default SkyboxsetEnabled(boolean enabled) default Skyboxtoggle()floatHow visible it is this frame, from its fade: 0 to 1.
-
Method Details
-
id
net.minecraft.resources.Identifier id() -
definitionId
@Nullable net.minecraft.resources.Identifier definitionId()TheskyboxJSON it's loaded from, or null for a definition built in code. -
priority
int priority() -
priority
Lower priorities are drawn first, so higher ones end up on top. Defaults to the definition's. -
fade
How it fades in and out. Defaults to the definition's durations, withEasing.SINE_IN_OUT. -
fade
-
activeWhen
-
onFrame
Runs every frame while the skybox is visible, before it's drawn: a place to drive its layers. -
hide
Replaces the parts of vanilla's sky it hides. Defaults to the definition'shide. -
enable
Skybox enable()Fades in, or keeps the skybox on if it's already. Cancels a pendingenableFor(int)timeout. -
disable
Skybox disable()Fades out. -
setEnabled
-
toggle
-
enableFor
Fades in, stays forticks, then fades out. -
enableInstantly
Skybox enableInstantly()Shows the skybox fully right away, skipping the fade-in. -
disableInstantly
Skybox disableInstantly()Hides the skybox right away, skipping the fade-out. -
isEnabled
boolean isEnabled()Whether it's enabled; it may still be fading in. -
isVisible
boolean isVisible()Whether it's drawn this frame: enabled, or still fading out. -
visibility
float visibility()How visible it is this frame, from its fade: 0 to 1. -
layer
-
layers
Collection<SkyLayer> layers()The layers of the loaded definition, in draw order; empty before it has loaded. -
isLoaded
boolean isLoaded()Whether its definition and shaders loaded, so it can be drawn. False until the first resource load, and after errors. -
error
@Nullable String error()Why it failed to load or draw, if it did. Fixed by a resource reload.
-