Class SkyboxControl
java.lang.Object
net.ixdarklord.coolcatcanvas.api.sky.SkyboxControl
Drives players' client-side skyboxes from the server, by the id they were registered under with
Skyboxes.register (or a resource pack skybox's file id). Clients without that skybox ignore the command.
The static methods address one player; for several, pick them first:
SkyboxControl.toggle(player, MyMod.id("blood_moon"));
SkyboxControl.to(players).enableFor(MyMod.id("blood_moon"), 1200);
SkyboxControl.inLevel(serverLevel).setEnabled(MyMod.id("aurora"), true);
SkyboxControl.everyone(server).disable(MyMod.id("aurora"));
Server state isn't kept: a client that relogs starts over, so resend what should persist (on join, for instance).
A skybox that enables itself in its dimensions keeps doing so; these commands are for skyboxes left to code.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classPlayers to send skybox commands to: the same commands as the static methods, each sent to all of them. -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddisable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox) static voiddisableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox) static voidenable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox) static voidenableFor(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, int ticks) Fades in, stays forticks, then fades out.static voidenableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox) static SkyboxControl.Targeteveryone(net.minecraft.server.MinecraftServer server) Everyone online when each command is sent.static SkyboxControl.TargetinLevel(net.minecraft.server.level.ServerLevel level) Everyone in a dimension when each command is sent.static voidresetLayer(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, String layer) Undoes what code or commands changed on a layer: visible, full opacity, the definition's tint and params.static voidsetEnabled(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, boolean enabled) static voidsetLayerAlpha(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, String layer, float alpha, int ticks) Moves a layer's opacity multiplier toalphaoverticks, 0 for instantly.static voidsetLayerParam(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, String layer, int index, int ticks, float... values) Moves a layer'sSkyParams[index]tovalues(at most 4) overticks, 0 for instantly.static voidsetLayerVisible(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, String layer, boolean visible) static SkyboxControl.Targetto(Collection<? extends net.minecraft.server.level.ServerPlayer> players) The given players, as they are when each command is sent.static SkyboxControl.Targetto(net.minecraft.server.level.ServerPlayer... players) static voidtoggle(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox) Turns it on if the player's client has it off, and off if on.
-
Method Details
-
to
-
to
public static SkyboxControl.Target to(Collection<? extends net.minecraft.server.level.ServerPlayer> players) The given players, as they are when each command is sent. -
inLevel
Everyone in a dimension when each command is sent. -
everyone
Everyone online when each command is sent. -
enable
public static void enable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox) -
disable
public static void disable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox) -
toggle
public static void toggle(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox) Turns it on if the player's client has it off, and off if on. -
setEnabled
public static void setEnabled(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, boolean enabled) -
enableFor
public static void enableFor(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, int ticks) Fades in, stays forticks, then fades out. -
enableInstantly
public static void enableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox) -
disableInstantly
public static void disableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox) -
setLayerVisible
public static void setLayerVisible(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, String layer, boolean visible) -
setLayerAlpha
public static void setLayerAlpha(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, String layer, float alpha, int ticks) Moves a layer's opacity multiplier toalphaoverticks, 0 for instantly. -
setLayerParam
public static void setLayerParam(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, String layer, int index, int ticks, float... values) Moves a layer'sSkyParams[index]tovalues(at most 4) overticks, 0 for instantly. -
resetLayer
public static void resetLayer(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, String layer) Undoes what code or commands changed on a layer: visible, full opacity, the definition's tint and params.
-