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.ResourceLocation effect)
     
    static void
    disableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.ResourceLocation effect)
     
    static void
    enable(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.ResourceLocation effect)
     
    static void
    enableFor(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.ResourceLocation effect, int ticks)
    Fades in, stays for ticks, then fades out.
    static void
    enableInstantly(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.ResourceLocation effect)
     
    static void
    resetUniforms(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.ResourceLocation effect)
     
    static void
    setStrength(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.ResourceLocation 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.ResourceLocation 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.ResourceLocation tint, int argb)
    Tints the player's screen until disable(net.minecraft.server.level.ServerPlayer, net.minecraft.resources.ResourceLocation): 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.ResourceLocation tint, int argb, int ticks)
    Tints the player's screen for ticks, fading in and out: a flash.

    Methods inherited from class java.lang.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.ResourceLocation effect)
    • disable

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

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

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

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

      public static void tint(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.ResourceLocation tint, int argb)
      Tints the player's screen until disable(net.minecraft.server.level.ServerPlayer, net.minecraft.resources.ResourceLocation): 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.ResourceLocation tint, int argb, int ticks)
      Tints the player's screen for ticks, fading in and out: a flash. 0 keeps it until disable(net.minecraft.server.level.ServerPlayer, net.minecraft.resources.ResourceLocation).