java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.vfx.WorldRifts

public final class WorldRifts extends Object
Rifts: tears in the air, drawn by a shader (VfxMaterial.RIFT_SHADER) and run through three acts. A rift opens (a flash, a jagged slit that widens, its opening sound, a shake of the camera nearby), stays open (its edge crawls and pulses, motes are drawn into it, its ambient sound loops), and closes (it narrows to a line and snaps shut with a last flash and its closing sound). It turns to face whoever looks at it, unless it is held facing one way (Rift.facing(net.minecraft.world.phys.Vec3)), as a portal set in a wall is.

 Rift rift = WorldRifts.open(RiftSpec.DEFAULT, pos);          // stays until closed
 rift.close();

 WorldRifts.open(RiftSpec.DEFAULT, pos).facing(new Vec3(0, 0, 1));   // a fixed face, looking south

 WorldRifts.open(RiftSpec.DEFAULT, pos, 100);                 // closes by itself after five seconds open

 RiftSpec ember = RiftSpec.builder().size(3, 5).color(0xFF7030).timing(30, 12)
         .sounds(MySounds.TEAR, MySounds.HUM, MySounds.SNAP).build();
 WorldRifts.register(MyMod.id("ember_rift"), ember);          // so the server can open it by name
 
From the server, RiftControl.open(level, MyMod.id("ember_rift"), pos, ticks) opens a registered rift for everyone in range and hands back the id to close it with.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.resources.ResourceLocation
    The spec the server can always ask for: RiftSpec.DEFAULT.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Closes every rift at once, without their closing act.
    static Optional<Rift>
    get(UUID id)
    The rift the server opened under an id, if it is still there.
    static Rift
    open(RiftSpec spec, net.minecraft.world.phys.Vec3 position)
    Opens a rift that stays until it is closed.
    static Rift
    open(RiftSpec spec, net.minecraft.world.phys.Vec3 position, int openTicks)
    Opens a rift that closes by itself.
    static void
    register(net.minecraft.resources.ResourceLocation id, RiftSpec spec)
    Names a spec, so the server can open it.
    spec(net.minecraft.resources.ResourceLocation id)
     

    Methods inherited from class java.lang.Object

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

    • DEFAULT

      public static final net.minecraft.resources.ResourceLocation DEFAULT
      The spec the server can always ask for: RiftSpec.DEFAULT.
  • Method Details

    • register

      public static void register(net.minecraft.resources.ResourceLocation id, RiftSpec spec)
      Names a spec, so the server can open it. Client code only.
    • spec

      public static Optional<RiftSpec> spec(net.minecraft.resources.ResourceLocation id)
    • open

      public static Rift open(RiftSpec spec, net.minecraft.world.phys.Vec3 position)
      Opens a rift that stays until it is closed.
    • open

      public static Rift open(RiftSpec spec, net.minecraft.world.phys.Vec3 position, int openTicks)
      Opens a rift that closes by itself.
      Parameters:
      openTicks - how long it stays fully open before it begins to close
    • get

      public static Optional<Rift> get(UUID id)
      The rift the server opened under an id, if it is still there.
    • clear

      public static void clear()
      Closes every rift at once, without their closing act.