Package net.thewinnt.cutscenes
Class CutsceneType
java.lang.Object
net.thewinnt.cutscenes.CutsceneType
A cutscene type consists of a camera path, rotation, transitions and some parameters. A cutscene has a fixed length,
and it can choose to let the player move their body and/or camera and hide their hand and block outlines.
When a cutscene is run, it's given a starting position and a starting camera rotation. The cutscene's path can be
rotated by some amount.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ActionTogglesfinal booleanfinal booleanfinal List<CutsceneEffect<?>> final Transitionfinal booleanfinal booleanfinal CutsceneLengthfinal @Nullable Pathfinal RotationHandlerfinal @Nullable Pathfinal Transition -
Constructor Summary
ConstructorsConstructorDescriptionCutsceneType(PathLike path, Path rotationProvider, int length) Constructs a simple cutscene type with default parameters for most settings.CutsceneType(PathLike path, Path rotationProvider, CutsceneLength length, Transition start, Transition end, boolean blockMovement, RotationHandler rotationHandler, ActionToggles toggles, boolean hideHand, boolean hideBlockOutline, List<CutsceneEffect<?>> effects) Constructs a cutscene type with all parameters specified. -
Method Summary
Modifier and TypeMethodDescriptionstatic CutsceneTypefromJSON(com.google.gson.JsonObject json) Reads a cutscene type from JSON.static CutsceneTypefromNetwork(net.minecraft.network.FriendlyByteBuf buf) Reads a cutscene type from network.@Nullable net.minecraft.world.phys.Vec3getPathPoint(double point, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns a point for this cutscene's camera path at the specified progress value, if there is a path.@Nullable net.minecraft.world.phys.Vec3getRotationAt(double point, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns a point for this cutscene's camera rotation at the specified progress value, if there is any rotation.net.minecraft.world.phys.Vec3getTransformedRotation(double point, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart, net.minecraft.world.phys.Vec3 initCamRot, net.minecraft.world.phys.Vec3 startRot, net.minecraft.world.phys.Vec3 playerRot, double dt) Returns a point for this cutscene's camera rotation at given progress value, transformed by the rotation handler.voidtoNetwork(net.minecraft.network.FriendlyByteBuf buf) Serializes this cutscene type to network, to fully reconstruct it later on the client side.
-
Field Details
-
length
-
path
-
rotationProvider
-
startTransition
-
endTransition
-
blockMovement
public final boolean blockMovement -
rotationHandler
-
actionToggles
-
hideHand
public final boolean hideHand -
hideBlockOutline
public final boolean hideBlockOutline -
disableF5
public final boolean disableF5 -
effects
-
-
Constructor Details
-
CutsceneType
public CutsceneType(PathLike path, Path rotationProvider, CutsceneLength length, Transition start, Transition end, boolean blockMovement, RotationHandler rotationHandler, ActionToggles toggles, boolean hideHand, boolean hideBlockOutline, List<CutsceneEffect<?>> effects) Constructs a cutscene type with all parameters specified. -
CutsceneType
Constructs a simple cutscene type with default parameters for most settings.
-
-
Method Details
-
getPathPoint
@Nullable public @Nullable net.minecraft.world.phys.Vec3 getPathPoint(double point, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns a point for this cutscene's camera path at the specified progress value, if there is a path.- Parameters:
point- the progress of this cutscene, in range [0, 1].level- the level where the cutscene is runcutsceneStart- the cutscene's starting position- Returns:
- a point for the given progress, or
nullif there's no path
-
getRotationAt
@Nullable public @Nullable net.minecraft.world.phys.Vec3 getRotationAt(double point, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns a point for this cutscene's camera rotation at the specified progress value, if there is any rotation.- Parameters:
point- the progress of this cutscene, in range [0, 1].level- the level where the cutscene is runcutsceneStart- the cutscene's starting position- Returns:
- a point for the given progress, or
nullif there's no path. The returned point's coordinates are [yaw, pitch, roll], matching Minecraft's [y, x, z] coordinates respectively.
-
getTransformedRotation
public net.minecraft.world.phys.Vec3 getTransformedRotation(double point, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart, net.minecraft.world.phys.Vec3 initCamRot, net.minecraft.world.phys.Vec3 startRot, net.minecraft.world.phys.Vec3 playerRot, double dt) Returns a point for this cutscene's camera rotation at given progress value, transformed by the rotation handler.- Parameters:
point- the progress value, in range [0, 1]level- the world where the cutscene is runcutsceneStart- the cutscene's starting positioninitCamRot- the player's camera rotation before the cutscene beganstartRot- the starting rotation of the cutsceneplayerRot- the player's current rotationdt- the time since last call, in seconds- Returns:
- a point for the given progress, in format [yaw, pitch, roll] (aka minecraft [y, x, z]).
-
toNetwork
public void toNetwork(net.minecraft.network.FriendlyByteBuf buf) Serializes this cutscene type to network, to fully reconstruct it later on the client side. -
fromNetwork
Reads a cutscene type from network. -
fromJSON
Reads a cutscene type from JSON.
-