Class VfxControl

java.lang.Object
net.ixdarklord.coolcatcanvas.api.vfx.VfxControl

public final class VfxControl extends Object
Plays world effects on players' clients from the server, by the id they were registered under with VfxEffects.register. Clients without that effect ignore it, and players whose client can't take the packet (no Canvas, or a fake player) are skipped.

 VfxControl.play(level, MyMod.id("impact"), VfxParams.at(hit, 0xFF7A2A));
 VfxControl.play(level, MyMod.id("bolt"), VfxParams.between(from, to, 0x9AD8FF));
 
One call is one small packet to each player near enough to see it, in place of the dozens a burst of vanilla particles takes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    How far from an effect, in blocks, players are told about it by default.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    play(net.minecraft.server.level.ServerLevel level, net.minecraft.resources.ResourceLocation effect, VfxParams params)
    Plays an effect for everyone in the level within DEFAULT_RANGE of it.
    static void
    play(net.minecraft.server.level.ServerLevel level, net.minecraft.resources.ResourceLocation effect, VfxParams params, double range)
     
    static void
    play(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.ResourceLocation effect, VfxParams params)
    Plays an effect for one player only.

    Methods inherited from class java.lang.Object

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

    • DEFAULT_RANGE

      public static final double DEFAULT_RANGE
      How far from an effect, in blocks, players are told about it by default.
      See Also:
  • Method Details

    • play

      public static void play(net.minecraft.server.level.ServerLevel level, net.minecraft.resources.ResourceLocation effect, VfxParams params)
      Plays an effect for everyone in the level within DEFAULT_RANGE of it.
    • play

      public static void play(net.minecraft.server.level.ServerLevel level, net.minecraft.resources.ResourceLocation effect, VfxParams params, double range)
    • play

      public static void play(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.ResourceLocation effect, VfxParams params)
      Plays an effect for one player only.