Class Cutscenes

java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.cutscene.Cutscenes

public final class Cutscenes extends Object
Cutscenes on the client: the ones it knows by id, and the one playing.

A cutscene gets an id in one of three ways: register(Identifier, Cutscene) from code, a file at assets/<namespace>/cutscene/<path>.json (id <namespace>:<path>; resource packs can add and replace them, and they reload with resources), or saved from the in-game editor (id coolcatlib:saved/<name>). Registered ones win over files of the same id.

Cutscenes.register(MyMod.id("intro"), intro);
Cutscenes.play(MyMod.id("intro"));

Cutscenes.play(Cutscene.builder()...build());      // or with no id at all
if (Cutscenes.isPlaying()) Cutscenes.stop();
While one plays, the camera follows it, and by its own settings the HUD and hand are hidden and the player can't move, look or act. The player can pause the game as usual, and hold the skip key to end a skippable one.

CutsceneEvents reports starts, ends and markers; the server plays them through CutsceneControl.

  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable CutscenePlayback
    The cutscene playing now, or null.
    static @Nullable Cutscene
    get(net.minecraft.resources.Identifier id)
    The cutscene with this id, from code, resources or the editor's saves; null when there is none.
    static Set<net.minecraft.resources.Identifier>
    ids()
    Every id a cutscene can be played by right now.
    static boolean
     
    static void
    Opens the in-game cutscene editor: a timeline of keyframes placed from where the player flies, previewed live through the camera, and saved as JSON under config/coolcatlib/cutscenes/.
    static @Nullable CutscenePlayback
    play(Cutscene cutscene)
    Plays a cutscene; null when the player isn't in a world.
    static @Nullable CutscenePlayback
    play(net.minecraft.resources.Identifier id)
    Plays a cutscene by id, in place of any playing.
    static @Nullable CutscenePlayback
    playAt(Cutscene cutscene, net.minecraft.world.phys.Vec3 origin, float yaw)
     
    static @Nullable CutscenePlayback
    playAt(net.minecraft.resources.Identifier id, net.minecraft.world.phys.Vec3 origin, float yaw)
    Plays a cutscene by id with its positions measured from a point, whatever its own anchor says.
    static void
    register(net.minecraft.resources.Identifier id, Cutscene cutscene)
    Gives a cutscene an id, replacing any registered under it.
    static void
    Stops the cutscene playing, if any.
    static void
    unregister(net.minecraft.resources.Identifier id)
     

    Methods inherited from class Object

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

    • register

      public static void register(net.minecraft.resources.Identifier id, Cutscene cutscene)
      Gives a cutscene an id, replacing any registered under it.
    • unregister

      public static void unregister(net.minecraft.resources.Identifier id)
    • get

      public static @Nullable Cutscene get(net.minecraft.resources.Identifier id)
      The cutscene with this id, from code, resources or the editor's saves; null when there is none.
    • ids

      public static Set<net.minecraft.resources.Identifier> ids()
      Every id a cutscene can be played by right now.
    • play

      public static @Nullable CutscenePlayback play(net.minecraft.resources.Identifier id)
      Plays a cutscene by id, in place of any playing.
      Returns:
      the playback, or null when there is no such cutscene or the player isn't in a world
    • play

      public static @Nullable CutscenePlayback play(Cutscene cutscene)
      Plays a cutscene; null when the player isn't in a world.
    • playAt

      public static @Nullable CutscenePlayback playAt(net.minecraft.resources.Identifier id, net.minecraft.world.phys.Vec3 origin, float yaw)
      Plays a cutscene by id 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 @Nullable CutscenePlayback playAt(Cutscene cutscene, net.minecraft.world.phys.Vec3 origin, float yaw)
    • current

      public static @Nullable CutscenePlayback current()
      The cutscene playing now, or null.
    • isPlaying

      public static boolean isPlaying()
    • stop

      public static void stop()
      Stops the cutscene playing, if any.
    • openEditor

      public static void openEditor()
      Opens the in-game cutscene editor: a timeline of keyframes placed from where the player flies, previewed live through the camera, and saved as JSON under config/coolcatlib/cutscenes/. Players reach it with a key that is unbound by default. Does nothing outside a world.