Class BezierCurve

java.lang.Object
net.thewinnt.cutscenes.path.BezierCurve
All Implemented Interfaces:
PathLike

public class BezierCurve extends Object implements PathLike
  • Constructor Details

    • BezierCurve

      public BezierCurve(net.minecraft.world.phys.Vec3 start, @Nullable @Nullable net.minecraft.world.phys.Vec3 control_a, @Nullable @Nullable net.minecraft.world.phys.Vec3 control_b, net.minecraft.world.phys.Vec3 end)
    • BezierCurve

      public BezierCurve(PointProvider start, @Nullable @Nullable PointProvider control_a, @Nullable @Nullable PointProvider control_b, PointProvider end, int weight)
    • BezierCurve

      public BezierCurve(net.minecraft.world.phys.Vec3 start, @Nullable @Nullable net.minecraft.world.phys.Vec3 control_a, @Nullable @Nullable net.minecraft.world.phys.Vec3 control_b, net.minecraft.world.phys.Vec3 end, int weight)
  • 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: PathLike
      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.
      Specified by:
      getPoint in interface PathLike
      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 run
      s - 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: PathLike
      Returns a PointProvider representing the starting position for this segment. Ideally, this should match the output of getPoint(0, level, cutsceneStart). Used in paths and path transitions.
      Specified by:
      getStart in interface PathLike
      Parameters:
      level - the level where the cutscene is run
      cutsceneStart - the starting position of the cutscene
      Returns:
      the PointProvider representing 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: PathLike
      Returns a PointProvider representing the end position for this segment. Ideally, this should match the output of getPoint(1, level, cutsceneStart). Used in paths and path transitions.
      Specified by:
      getEnd in interface PathLike
      Parameters:
      level - the level where the cutscene is run
      cutsceneStart - the starting position of the cutscene
      Returns:
      the PointProvider representing the end position for this segment
    • getControlA

      @Nullable public @Nullable PointProvider getControlA()
    • getControlB

      @Nullable public @Nullable PointProvider getControlB()
    • getWeight

      public int getWeight()
      Description copied from interface: PathLike
      Returns the weight of this segment. Used for timing in paths. The higher the value, the more time is dedicated to this segment and the slower it runs, and vice-versa.
      Specified by:
      getWeight in interface PathLike
      Returns:
      this segment's weight
    • getUtilityPoints

      public Collection<PathPreviewRenderer.Line> getUtilityPoints(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart, int initLevel)
      Description copied from interface: PathLike
      Returns a list of lines representing the utility points used for constructing this segment's path. Used for rendering a cutscene's preview.
      Specified by:
      getUtilityPoints in interface PathLike
      Parameters:
      level - the level where the preview is rendered
      cutsceneStart - the starting position of the cutscene preview
      initLevel - 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

      public static BezierCurve fromNetwork(net.minecraft.network.FriendlyByteBuf buf, Path path)
    • fromJSON

      public static BezierCurve fromJSON(com.google.gson.JsonObject json, Path path)
    • toNetwork

      public void toNetwork(net.minecraft.network.FriendlyByteBuf buf)
      Description copied from interface: PathLike
      Writes this segment's parameters to the provided FriendlyByteBuf. This data should be enough to fully reconstruct this segment on the client.
      Specified by:
      toNetwork in interface PathLike
      See Also:
    • getSerializer

      public PathLike.SegmentSerializer<BezierCurve> getSerializer()
      Description copied from interface: PathLike
      Returns the serializer that is associated with this segment type. Preferably, this should return the same object every time it's called.
      Specified by:
      getSerializer in interface PathLike
      Returns:
      a serializer for this segment's type