Class ScreenEffectControl

java.lang.Object
net.ixdarklord.coolcatcanvas.api.effect.ScreenEffectControl

public final class ScreenEffectControl extends Object
Drives a player's client-side screen effects from the server, by the id they were registered under with ScreenEffects.register. Clients without that effect ignore the command.

Server state isn't kept: a client that relogs starts with its effects off, so resend what should persist (on join, for instance).

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    disable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect)
     
    static void
    disableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect)
     
    static void
    enable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect)
     
    static void
    enableFor(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect, int ticks)
    Fades in, stays for ticks, then fades out.
    static void
    enableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect)
     
    static void
    resetUniforms(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect)
     
    static void
    setStrength(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect, float strength, int ticks)
    Moves the effect's manual strength to strength over ticks, 0 for instantly.
    static void
    setUniform(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect, String uniform, int ticks, float... values)
    Moves a uniform to values (at most 16) over ticks, 0 for instantly.
    static void
    tint(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier tint, int argb)
    Tints the player's screen until disable(ServerPlayer, Identifier): the client makes the tint under tint if it has none yet (see ScreenEffects.tint), so nothing needs registering on either side.
    static void
    tint(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier tint, int argb, int ticks)
    Tints the player's screen for ticks, fading in and out: a flash.

    Methods inherited from class Object

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

    • enable

      public static void enable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect)
    • disable

      public static void disable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect)
    • enableFor

      public static void enableFor(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect, 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 effect)
    • disableInstantly

      public static void disableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect)
    • setStrength

      public static void setStrength(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect, float strength, int ticks)
      Moves the effect's manual strength to strength over ticks, 0 for instantly.
    • setUniform

      public static void setUniform(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect, String uniform, int ticks, float... values)
      Moves a uniform to values (at most 16) over ticks, 0 for instantly.
    • resetUniforms

      public static void resetUniforms(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier effect)
    • tint

      public static void tint(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier tint, int argb)
      Tints the player's screen until disable(ServerPlayer, Identifier): the client makes the tint under tint if it has none yet (see ScreenEffects.tint), so nothing needs registering on either side.
      Parameters:
      argb - the color; its alpha is how strong the tint is
    • tint

      public static void tint(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier tint, int argb, int ticks)
      Tints the player's screen for ticks, fading in and out: a flash. 0 keeps it until disable(ServerPlayer, Identifier).