Package net.thewinnt.cutscenes.path
Class CatmullRomSpline
java.lang.Object
net.thewinnt.cutscenes.path.CatmullRomSpline
- All Implemented Interfaces:
PathLike
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.thewinnt.cutscenes.path.PathLike
PathLike.SegmentSerializer<T extends PathLike> -
Constructor Summary
ConstructorsConstructorDescriptionCatmullRomSpline(int weight, net.minecraft.world.phys.Vec3... points) CatmullRomSpline(int weight, PointProvider... points) CatmullRomSpline(net.minecraft.world.phys.Vec3... points) -
Method Summary
Modifier and TypeMethodDescriptionstatic CatmullRomSplinestatic CatmullRomSplinefromNetwork(net.minecraft.network.FriendlyByteBuf buf, Path path) getEnd(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 l, net.minecraft.world.phys.Vec3 s) Returns the position at the given moment.Returns the serializer that is associated with this segment type.intgetSize()getStart(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Returns aPointProviderrepresenting the starting position for this segment.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.
-
Constructor Details
-
CatmullRomSpline
public CatmullRomSpline(net.minecraft.world.phys.Vec3... points) -
CatmullRomSpline
public CatmullRomSpline(int weight, net.minecraft.world.phys.Vec3... points) -
CatmullRomSpline
-
-
Method Details
-
getPoint
public net.minecraft.world.phys.Vec3 getPoint(double t, net.minecraft.world.level.Level l, net.minecraft.world.phys.Vec3 s) Description copied from interface:PathLikeReturns 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.
- Specified by:
getPointin interfacePathLike- Parameters:
t- the progress of the current segment, in range [0, 1]. 0 corresponds to the starting position and 1 is the end position.l- the level where the cutscene is runs- the starting position of the cutscene- Returns:
- a point corresponding to the given progress value of the segment.
-
getStart
public PointProvider getStart(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Description copied from interface:PathLikeReturns aPointProviderrepresenting the starting position for this segment. Ideally, this should match the output ofgetPoint(0, level, cutsceneStart). Used inpathsandpath transitions.- Specified by:
getStartin interfacePathLike- 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
public PointProvider getEnd(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart) Description copied from interface:PathLikeReturns aPointProviderrepresenting the end position for this segment. Ideally, this should match the output ofgetPoint(1, level, cutsceneStart). Used inpathsandpath transitions.- Specified by:
getEndin interfacePathLike- 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
public int getWeight()Description copied from interface:PathLikeReturns 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. -
getUtilityPoints
public Collection<PathPreviewRenderer.Line> getUtilityPoints(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart, int initLevel) Description copied from interface:PathLikeReturns a list oflinesrepresenting the utility points used for constructing this segment's path. Used for rendering a cutscene's preview.- Specified by:
getUtilityPointsin interfacePathLike- 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:
-
fromNetwork
-
toNetwork
public void toNetwork(net.minecraft.network.FriendlyByteBuf buf) Description copied from interface:PathLikeWrites this segment's parameters to the providedFriendlyByteBuf. This data should be enough to fully reconstruct this segment on the client. -
fromJSON
-
getSerializer
Description copied from interface:PathLikeReturns the serializer that is associated with this segment type. Preferably, this should return the same object every time it's called.- Specified by:
getSerializerin interfacePathLike- Returns:
- a serializer for this segment's type
-
getSize
public int getSize()
-