Class CutsceneControl

java.lang.Object
net.ixdarklord.coolcatcanvas.api.cutscene.CutsceneControl

public final class CutsceneControl extends Object
Plays cutscenes on players' clients from the server.
CutsceneControl.play(player, MyMod.id("intro"));                    // one the client has registered or in its resources
CutsceneControl.play(player, MyMod.id("reveal"), cutscene);         // one only the server knows: sent whole
CutsceneControl.playAt(player, MyMod.id("orbit"), altar, 0.0F);     // its positions measured from the altar
CutsceneControl.stop(player);
ServerCutsceneEvents.ENDED tells when the player has seen it through, skipped it or left.

The player's client holds them still and hides their HUD, but the server does nothing to them: they can still be hurt, pushed and targeted while they watch. Keep them safe yourself if the scene calls for it.

  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    play(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier cutscene)
    Plays a cutscene the player's client knows by id, placed by its own anchor.
    static boolean
    play(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier id, Cutscene cutscene)
    Sends a cutscene whole and plays it: nothing needs to be registered on the client.
    static boolean
    playAt(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier id, Cutscene cutscene, net.minecraft.world.phys.Vec3 origin, float yaw)
    Sends a cutscene whole and plays it with its positions measured from a point.
    static boolean
    playAt(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier cutscene, net.minecraft.world.phys.Vec3 origin, float yaw)
    Plays a cutscene the client knows with its positions measured from a point, whatever its own anchor says.
    static void
    stop(net.minecraft.server.level.ServerPlayer player)
    Stops whatever cutscene the player is watching, the server's or their client's own.
    static @Nullable net.minecraft.resources.Identifier
    watching(net.minecraft.server.level.ServerPlayer player)
    The cutscene the server started for this player that hasn't ended yet, or null.

    Methods inherited from class Object

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

    • play

      public static boolean play(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier cutscene)
      Plays a cutscene the player's client knows by id, placed by its own anchor.
      Returns:
      false when the player's client can't be told (no Canvas, or a fake player)
    • play

      public static boolean play(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier id, Cutscene cutscene)
      Sends a cutscene whole and plays it: nothing needs to be registered on the client.
      Parameters:
      id - the name it is reported under when it ends
      Throws:
      IllegalArgumentException - if one of its easings has no name in Easings
    • playAt

      public static boolean playAt(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier cutscene, net.minecraft.world.phys.Vec3 origin, float yaw)
      Plays a cutscene the client knows with its positions measured from a point, whatever its own anchor says.
      Parameters:
      yaw - the turn of the cutscene's space around the vertical, in degrees; 0 leaves it as written
    • playAt

      public static boolean playAt(net.minecraft.server.level.ServerPlayer player, net.minecraft.resources.Identifier id, Cutscene cutscene, net.minecraft.world.phys.Vec3 origin, float yaw)
      Sends a cutscene whole and plays it with its positions measured from a point.
    • stop

      public static void stop(net.minecraft.server.level.ServerPlayer player)
      Stops whatever cutscene the player is watching, the server's or their client's own.
    • watching

      public static @Nullable net.minecraft.resources.Identifier watching(net.minecraft.server.level.ServerPlayer player)
      The cutscene the server started for this player that hasn't ended yet, or null.