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 Type
    Method
    Description
     
    @Nullable net.minecraft.resources.Identifier
    id()
    The id it was started by, or null for one played straight from a Cutscene.
    boolean
    Whether it is still the cutscene on screen: false once it has ended, for any reason.
    boolean
     
    Runs once it has ended, with the reason.
    void
    Holds it on its current frame, the camera staying where it is.
    The camera this frame, in the world: where the cutscene has it, or would have it while it is paused.
    default float
    Its time as a fraction of its length, 0 to 1.
    void
     
    void
    seek(float time)
    Jumps to a time, in ticks.
    void
    setSpeed(float speed)
    How fast it runs: 1 is its own pace, 0.5 slow motion, 2 double time.
    void
    Ends it at once as if the player had skipped it, whether or not it is skippable.
    float
     
    void
    Ends it at once, as CutsceneEndReason.STOPPED.
    float
    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 a Cutscene.
    • 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, as CutsceneEndReason.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.