Interface Transition

All Known Implementing Classes:
FadeToColorTransition, NoopTransition, SmoothEaseTransition

public interface Transition
A Transition provides a smooth change between the player doing their business and watching a cutscene.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A transition serializer, representing a transition type.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Transition
    fromJSON(com.google.gson.JsonObject json)
     
    static Transition
    fromJSON(com.google.gson.JsonObject json, Transition defaultIfNull)
    Returns a Transition from json, or a fallback value if json is null
    static Transition
    fromNetwork(net.minecraft.network.FriendlyByteBuf buf)
     
    int
     
    int
    Returns the time that will be added to the total cutscene time as a result of this transition running.
    int
    Returns the time of this transition that will be taken from the cutscene's time.
    net.minecraft.world.phys.Vec3
    getPos(double progress, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 startPos, net.minecraft.world.phys.Vec3 pathRot, net.minecraft.world.phys.Vec3 initCamPos, CutsceneType cutscene)
    Returns the camera position at the specified moment
    net.minecraft.world.phys.Vec3
    getRot(double progress, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 startPos, net.minecraft.world.phys.Vec3 startRot, net.minecraft.world.phys.Vec3 initCamRot, CutsceneType cutscene)
    Returns the camera rotation at the specified moment
     
    default void
    onEnd(CutsceneType cutscene)
    Executed when the transition ends.
    default void
    onFrame(double progress, CutsceneType cutscene)
    Executed every frame that this transition is active.
    default void
    Executed when the transition begins.
    void
    toNetwork(net.minecraft.network.FriendlyByteBuf buf)
    Saves this transition for network transfer, so that it can be fully recreated on the receiving end.
  • Method Details

    • getLength

      int getLength()
      Returns:
      the total length of this transition.
    • getOffCutsceneTime

      int getOffCutsceneTime()
      Returns the time that will be added to the total cutscene time as a result of this transition running. Should not change during a cutscene.
      Returns:
      the time spent outside the cutscene's length
    • getOnCutsceneTime

      int getOnCutsceneTime()
      Returns the time of this transition that will be taken from the cutscene's time. This means that the cutscene itself will be running, so a path will be shown.
      Returns:
      the time spent inside the cutscene's length
    • getPos

      net.minecraft.world.phys.Vec3 getPos(double progress, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 startPos, net.minecraft.world.phys.Vec3 pathRot, net.minecraft.world.phys.Vec3 initCamPos, CutsceneType cutscene)
      Returns the camera position at the specified moment
      Parameters:
      progress - the progress of the transition [0-1]
      level - the level the transition is executed in
      startPos - the cutscene start position (specified in the command, defaults to [0, 100, 0])
      pathRot - the rotation of the path
      initCamPos - the camera position right before the cutscene started
      cutscene - the cutscene the transition is associated with
    • getRot

      net.minecraft.world.phys.Vec3 getRot(double progress, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 startPos, net.minecraft.world.phys.Vec3 startRot, net.minecraft.world.phys.Vec3 initCamRot, CutsceneType cutscene)
      Returns the camera rotation at the specified moment
      Parameters:
      progress - the progress of the transition [0-1]
      level - the level the transition is executed in
      startPos - the cutscene start position (world coordinates)
      startRot - the start rotation (specified in the command defaults to [0, 0, 0])
      initCamRot - the camera rotation right before the cutscene started
      cutscene - the cutscene the transition is associated with
    • toNetwork

      void toNetwork(net.minecraft.network.FriendlyByteBuf buf)
      Saves this transition for network transfer, so that it can be fully recreated on the receiving end.
      Parameters:
      buf - the buffer to write to
    • getSerializer

      Returns:
      a serializer that creates transitions of this type
    • onStart

      default void onStart(CutsceneType cutscene)
      Executed when the transition begins. It is guaranteed to be executed exactly once during the cutscene if it isn't stopped before this transition begins.
      Parameters:
      cutscene - the cutscene this transition is associated with
    • onEnd

      default void onEnd(CutsceneType cutscene)
      Executed when the transition ends. It is guaranteed to be executed exactly once during the cutscene if it isn't stopped before this transition begins.
      Parameters:
      cutscene - the cutscene this transition is associated with
    • onFrame

      default void onFrame(double progress, CutsceneType cutscene)
      Executed every frame that this transition is active. This may not ever happen if the transition is too short.
      Parameters:
      progress - the progress of this transition
      cutscene - the cutscene this transition is associated with
    • fromJSON

      static Transition fromJSON(com.google.gson.JsonObject json)
    • fromJSON

      static Transition fromJSON(com.google.gson.JsonObject json, Transition defaultIfNull)
      Returns a Transition from json, or a fallback value if json is null
    • fromNetwork

      static Transition fromNetwork(net.minecraft.network.FriendlyByteBuf buf)