Class Cutscenes
java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.cutscene.Cutscenes
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 TypeMethodDescriptionstatic @Nullable CutscenePlaybackcurrent()The cutscene playing now, or null.static @Nullable Cutsceneget(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 booleanstatic voidOpens the in-game cutscene editor: a timeline of keyframes placed from where the player flies, previewed live through the camera, and saved as JSON underconfig/coolcatlib/cutscenes/.static @Nullable CutscenePlaybackPlays a cutscene; null when the player isn't in a world.static @Nullable CutscenePlaybackplay(net.minecraft.resources.Identifier id) Plays a cutscene by id, in place of any playing.static @Nullable CutscenePlaybackstatic @Nullable CutscenePlaybackplayAt(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 voidGives a cutscene an id, replacing any registered under it.static voidstop()Stops the cutscene playing, if any.static voidunregister(net.minecraft.resources.Identifier id)
-
Method Details
-
register
Gives a cutscene an id, replacing any registered under it. -
unregister
public static void unregister(net.minecraft.resources.Identifier id) -
get
The cutscene with this id, from code, resources or the editor's saves; null when there is none. -
ids
Every id a cutscene can be played by right now. -
play
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
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
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 underconfig/coolcatlib/cutscenes/. Players reach it with a key that is unbound by default. Does nothing outside a world.
-