Package net.thewinnt.cutscenes.path
Interface PathLike
- All Known Implementing Classes:
BezierCurve,CalculatedPoint,CatmullRomSpline,ConstantPoint,LineSegment,LookAtPoint,Path,PathTransition
public interface PathLike
A PathLike is the base interface responsible for camera positioning and rotating in a cutscene.
They are also commonly referred to as "segment serializers".
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacePathLike.SegmentSerializer<T extends PathLike>An object that constructs path segments from JSON and network. -
Method Summary
Modifier and TypeMethodDescriptiongetEnd(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns aPointProviderrepresenting the end position for this segment.net.minecraft.world.phys.Vec3getPoint(double t, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns the position at the given moment.Returns the serializer that is associated with this segment type.getStart(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns aPointProviderrepresenting the starting position for this segment.default Collection<PathPreviewRenderer.Line> getUtilityPoints(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart, int initLevel) Returns a list oflinesrepresenting the utility points used for constructing this segment's path.intReturns the weight of this segment.voidtoNetwork(net.minecraft.network.FriendlyByteBuf buf) Writes this segment's parameters to the providedFriendlyByteBuf.
-
Method Details
-
getPoint
net.minecraft.world.phys.Vec3 getPoint(double t, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns the position at the given moment. Depending on the context, it may be treated differently:- If the segment is representing the camera position, the resulting position will be treated as an offset from the cutscene starting position, which will then be rotated around the starting point by three axes, depending on the parameters the cutscene was started with.
- If the segment is representing camera rotation, this method's output will be treated as an offset from the starting camera rotation of the cutscene.
- Parameters:
t- the progress of the current segment, in range [0, 1]. 0 corresponds to the starting position and 1 is the end position.level- the level where the cutscene is runcutsceneStart- the starting position of the cutscene- Returns:
- a point corresponding to the given progress value of the segment.
-
getStart
PointProvider getStart(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns aPointProviderrepresenting the starting position for this segment. Ideally, this should match the output ofgetPoint(0, level, cutsceneStart). Used inpathsandpath transitions.- Parameters:
level- the level where the cutscene is runcutsceneStart- the starting position of the cutscene- Returns:
- the
PointProviderrepresenting the starting position for this segment
-
getEnd
PointProvider getEnd(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns aPointProviderrepresenting the end position for this segment. Ideally, this should match the output ofgetPoint(1, level, cutsceneStart). Used inpathsandpath transitions.- Parameters:
level- the level where the cutscene is runcutsceneStart- the starting position of the cutscene- Returns:
- the
PointProviderrepresenting the end position for this segment
-
getWeight
int getWeight()Returns the weight of this segment. Used for timing inpaths. The higher the value, the more time is dedicated to this segment and the slower it runs, and vice-versa.- Returns:
- this segment's weight
-
toNetwork
void toNetwork(net.minecraft.network.FriendlyByteBuf buf) Writes this segment's parameters to the providedFriendlyByteBuf. This data should be enough to fully reconstruct this segment on the client.- See Also:
-
getSerializer
PathLike.SegmentSerializer<?> getSerializer()Returns the serializer that is associated with this segment type. Preferably, this should return the same object every time it's called.- Returns:
- a serializer for this segment's type
-
getUtilityPoints
default Collection<PathPreviewRenderer.Line> getUtilityPoints(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart, int initLevel) Returns a list oflinesrepresenting the utility points used for constructing this segment's path. Used for rendering a cutscene's preview.- Parameters:
level- the level where the preview is renderedcutsceneStart- the starting position of the cutscene previewinitLevel- the depth level for this segment. For every segment nested inside another segment, this value increases by 1. This argument should be passed to created lines without changing it.- Returns:
- a collection of lines representing this segment's utility points.
- See Also:
-