Interface CutscenePlayback
- All Known Implementing Classes:
PlaybackImpl
public interface CutscenePlayback
A cutscene as it plays: what
Cutscenes.play(Identifier) hands back. One plays at a time; starting another ends it.
CutscenePlayback playback = Cutscenes.play(MyMod.id("intro"));
if (playback != null) playback.onEnd(reason -> { if (reason.completed()) showTitle(); });
-
Method Summary
Modifier and TypeMethodDescriptioncutscene()@Nullable net.minecraft.resources.Identifierid()The id it was started by, or null for one played straight from aCutscene.booleanisActive()Whether it is still the cutscene on screen: false once it has ended, for any reason.booleanisPaused()onEnd(Consumer<CutsceneEndReason> listener) Runs once it has ended, with the reason.voidpause()Holds it on its current frame, the camera staying where it is.pose()The camera this frame, in the world: where the cutscene has it, or would have it while it is paused.default floatprogress()Its time as a fraction of its length, 0 to 1.voidresume()voidseek(float time) Jumps to a time, in ticks.voidsetSpeed(float speed) How fast it runs: 1 is its own pace, 0.5 slow motion, 2 double time.voidskip()Ends it at once as if the player had skipped it, whether or not it is skippable.floatspeed()voidstop()Ends it at once, asCutsceneEndReason.STOPPED.floattime()How far in it is, in ticks.
-
Method Details
-
cutscene
Cutscene cutscene() -
id
@Nullable net.minecraft.resources.Identifier id()The id it was started by, or null for one played straight from aCutscene. -
time
float time()How far in it is, in ticks. -
progress
default float progress()Its time as a fraction of its length, 0 to 1. -
isActive
boolean isActive()Whether it is still the cutscene on screen: false once it has ended, for any reason. -
isPaused
boolean isPaused() -
pause
void pause()Holds it on its current frame, the camera staying where it is. -
resume
void resume() -
seek
void seek(float time) Jumps to a time, in ticks. Markers jumped over don't fire. -
speed
float speed() -
setSpeed
void setSpeed(float speed) How fast it runs: 1 is its own pace, 0.5 slow motion, 2 double time. -
stop
void stop()Ends it at once, asCutsceneEndReason.STOPPED. -
skip
void skip()Ends it at once as if the player had skipped it, whether or not it is skippable. -
onEnd
Runs once it has ended, with the reason. Called at once if it already has. -
pose
CameraPose pose()The camera this frame, in the world: where the cutscene has it, or would have it while it is paused.
-