Class SkyboxControl

java.lang.Object
net.ixdarklord.coolcatcanvas.api.sky.SkyboxControl

public final class SkyboxControl extends Object
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 Classes
    Modifier and Type
    Class
    Description
    static final class 
    Players to send skybox commands to: the same commands as the static methods, each sent to all of them.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    disable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox)
     
    static void
    disableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox)
     
    static void
    enable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox)
     
    static void
    enableFor(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, int ticks)
    Fades in, stays for ticks, then fades out.
    static void
    enableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox)
     
    everyone(net.minecraft.server.MinecraftServer server)
    Everyone online when each command is sent.
    inLevel(net.minecraft.server.level.ServerLevel level)
    Everyone in a dimension when each command is sent.
    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.
    static void
    setEnabled(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, boolean enabled)
     
    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 to alpha over ticks, 0 for instantly.
    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's SkyParams[index] to values (at most 4) over ticks, 0 for instantly.
    static void
    setLayerVisible(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier skybox, String layer, boolean visible)
     
    to(Collection<? extends net.minecraft.server.level.ServerPlayer> players)
    The given players, as they are when each command is sent.
    to(net.minecraft.server.level.ServerPlayer... players)
     
    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.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • to

      public static SkyboxControl.Target to(net.minecraft.server.level.ServerPlayer... players)
    • 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

      public static SkyboxControl.Target inLevel(net.minecraft.server.level.ServerLevel level)
      Everyone in a dimension when each command is sent.
    • everyone

      public static SkyboxControl.Target everyone(net.minecraft.server.MinecraftServer server)
      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 for ticks, 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 to alpha over ticks, 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's SkyParams[index] to values (at most 4) over ticks, 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.