Class LineSegment

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

public class LineSegment extends Object implements PathLike
  • Constructor Details

    • LineSegment

      public LineSegment(PointProvider a, PointProvider b, Easing easingX, Easing easingY, Easing easingZ, int weight, boolean isRotation)
    • LineSegment

      public LineSegment(PointProvider a, PointProvider b, Easing easingX, Easing easingY, Easing easingZ, boolean isRotation)
    • LineSegment

      public LineSegment(PointProvider start, PointProvider end)
    • LineSegment

      public LineSegment(PointProvider start, PointProvider end, boolean isRotation)
    • LineSegment

      public LineSegment(PointProvider start, PointProvider end, Easing easing, boolean isRotation)
    • LineSegment

      public LineSegment(net.minecraft.world.phys.Vec3 a, net.minecraft.world.phys.Vec3 b, Easing easingX, Easing easingY, Easing easingZ, int weight, boolean isRotation)
    • LineSegment

      public LineSegment(net.minecraft.world.phys.Vec3 a, net.minecraft.world.phys.Vec3 b, Easing easingX, Easing easingY, Easing easingZ, boolean isRotation)
    • LineSegment

      public LineSegment(net.minecraft.world.phys.Vec3 start, net.minecraft.world.phys.Vec3 end)
    • LineSegment

      public LineSegment(net.minecraft.world.phys.Vec3 start, net.minecraft.world.phys.Vec3 end, boolean isRotation)
    • LineSegment

      public LineSegment(net.minecraft.world.phys.Vec3 start, net.minecraft.world.phys.Vec3 end, Easing easing, boolean isRotation)
  • Method Details

    • 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
    • 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.
    • 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
    • fromNetwork

      public static LineSegment fromNetwork(net.minecraft.network.FriendlyByteBuf buf, 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<LineSegment> 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
    • fromJSON

      public static LineSegment fromJSON(com.google.gson.JsonObject json, Path path)