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 ClassesModifier and TypeInterfaceDescriptionstatic interfaceTransition.TransitionSerializer<T extends Transition>A transition serializer, representing a transition type. -
Method Summary
Modifier and TypeMethodDescriptionstatic TransitionfromJSON(com.google.gson.JsonObject json) static TransitionfromJSON(com.google.gson.JsonObject json, Transition defaultIfNull) Returns a Transition from json, or a fallback value if json is nullstatic TransitionfromNetwork(net.minecraft.network.FriendlyByteBuf buf) intintReturns the time that will be added to the total cutscene time as a result of this transition running.intReturns the time of this transition that will be taken from the cutscene's time.net.minecraft.world.phys.Vec3getPos(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 momentnet.minecraft.world.phys.Vec3getRot(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 momentdefault voidonEnd(CutsceneType cutscene) Executed when the transition ends.default voidonFrame(double progress, CutsceneType cutscene) Executed every frame that this transition is active.default voidonStart(CutsceneType cutscene) Executed when the transition begins.voidtoNetwork(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 instartPos- the cutscene start position (specified in the command, defaults to [0, 100, 0])pathRot- the rotation of the pathinitCamPos- the camera position right before the cutscene startedcutscene- 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 instartPos- 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 startedcutscene- 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
Transition.TransitionSerializer<?> getSerializer()- Returns:
- a serializer that creates transitions of this type
-
onStart
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
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
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 transitioncutscene- the cutscene this transition is associated with
-
fromJSON
-
fromJSON
Returns a Transition from json, or a fallback value if json is null -
fromNetwork
-