Class CutsceneManager

java.lang.Object
net.thewinnt.cutscenes.CutsceneManager

public class CutsceneManager extends Object
  • Field Details

    • REGISTRY

      public static final com.google.common.collect.BiMap<net.minecraft.resources.ResourceLocation,CutsceneType> REGISTRY
      The cutscene registry, where all cutscenes are stored. Only read from this, please
    • previewOffset

      public static net.minecraft.world.phys.Vec3 previewOffset
      The start position of the preview
    • previewPathYaw

      public static float previewPathYaw
      The x rotation of the preview path
    • previewPathPitch

      public static float previewPathPitch
      The y rotation of the preview path
    • previewPathRoll

      public static float previewPathRoll
      The z rotation of the preview path
    • ASCEND_ID

      public static final net.minecraft.resources.ResourceLocation ASCEND_ID
    • COOL_PATH_ID

      public static final net.minecraft.resources.ResourceLocation COOL_PATH_ID
    • MULTI_TYPE_ID

      public static final net.minecraft.resources.ResourceLocation MULTI_TYPE_ID
    • HORIZONTAL_LINE_ID

      public static final net.minecraft.resources.ResourceLocation HORIZONTAL_LINE_ID
    • CATMULL_ROM_TEST_ID

      public static final net.minecraft.resources.ResourceLocation CATMULL_ROM_TEST_ID
    • ASCEND

      public static final CutsceneType ASCEND
      Ascends you 25 blocks up with a little twist
    • COOL_PATH

      public static final CutsceneType COOL_PATH
      A cool path made of continuous Bézier curves, also features rotation changes
    • MULTI_TYPE

      public static final CutsceneType MULTI_TYPE
      A path that combines some Bézier curve configurations
    • HORIZONTAL_LINE

      public static final CutsceneType HORIZONTAL_LINE
      A horizontal line going 12 blocks towards +X
    • CATMULL_ROM_TEST

      public static final CutsceneType CATMULL_ROM_TEST
      A path consisting of a Catmull-Rom spline with a lot of random points
    • LINE

      public static final PathLike.SegmentSerializer<LineSegment> LINE
      A line, consisting of 2 point, interpolated between each other with some easings.
    • BEZIER

      public static final PathLike.SegmentSerializer<BezierCurve> BEZIER
      A cubic or quadratic Bézier curve, depending on the points supplied.
    • CATMULL_ROM

      public static final PathLike.SegmentSerializer<CatmullRomSpline> CATMULL_ROM
      A Catmull-Rom spline, made of 2 or more points.
    • PATH

      public static final PathLike.SegmentSerializer<Path> PATH
      A segment made of other segments.
    • CONSTANT

      public static final PathLike.SegmentSerializer<ConstantPoint> CONSTANT
      A segment always returning a single point.
    • LOOK_AT_POINT

      public static final PathLike.SegmentSerializer<LookAtPoint> LOOK_AT_POINT
      A segment returning a look direction so that the player is looking at the specified point.
    • PATH_TRANSITION

      public static final PathLike.SegmentSerializer<PathTransition> PATH_TRANSITION
      A transition between two segments - the one before and the one after this.
    • CALCULATED_POINT

      public static final PathLike.SegmentSerializer<CalculatedPoint> CALCULATED_POINT
      A segment getting its coordinates from easings.
    • STATIC

      A simple point. Can be inlined as an array of 3 points.
    • WAYPOINT

      public static final PointProvider.PointSerializer<WaypointProvider> WAYPOINT
      A point that finds a waypoint entity with a specified name, and returns its position (maybe offset too).
    • WORLD

      A point type that is specified in world coordinates
    • NO_OP

      public static final Transition.TransitionSerializer<NoopTransition> NO_OP
      Does nothing.
    • SMOOTH_EASE

      public static final Transition.TransitionSerializer<SmoothEaseTransition> SMOOTH_EASE
      Smoothly transitions your camera from the starting point to the current point you should be at.
    • FADE

      Fades the screen to a color (or several colors that may change too)
    • KEEP_ROTATION

      public static final net.minecraft.world.phys.Vec3 KEEP_ROTATION
      Pass this as a camera rotation to startCutscene(ResourceLocation, Vec3, Vec3, Vec3, ServerPlayer) and it will make the start camera rotation equal to the current rotation.
  • Constructor Details

    • CutsceneManager

      public CutsceneManager()
  • Method Details

    • registerCutscene

      public static CutsceneType registerCutscene(net.minecraft.resources.ResourceLocation id, @NotNull @NotNull CutsceneType type)
      Registers a cutscene type
      Parameters:
      id - The ID of the cutscene type that will be used in commands
      type - The actual cutscene type you want to register
      Returns:
      Your cutscene type for storing
    • registerSegmentType

      public static void registerSegmentType(net.minecraft.resources.ResourceLocation id, PathLike.SegmentSerializer<?> type)
      Registers a segment serializer
      Parameters:
      id - The ID of the segment type that will be used in datapacks
      type - The serializer to register
    • registerPointType

      public static void registerPointType(net.minecraft.resources.ResourceLocation id, PointProvider.PointSerializer<?> type)
      Registers a point serializer
      Parameters:
      id - The ID of the point type that will be used in datapacks
      type - The serializer to register
    • registerTransitionType

      public static void registerTransitionType(net.minecraft.resources.ResourceLocation id, Transition.TransitionSerializer<?> type)
      Registers a transition serializer
      Parameters:
      id - The ID of the transition type that will be used in datapacks
      type - The serializer to register
    • getSegmentTypeId

      public static net.minecraft.resources.ResourceLocation getSegmentTypeId(PathLike.SegmentSerializer<?> type)
      Returns the ID of the specified serializer, or null if it's not registered
    • getSegmentType

      public static PathLike.SegmentSerializer<?> getSegmentType(net.minecraft.resources.ResourceLocation id)
      Returns the segment serializer with this ID, or null if it doesn't exist
    • getPointTypeId

      public static net.minecraft.resources.ResourceLocation getPointTypeId(PointProvider.PointSerializer<?> type)
      Returns the ID of the specified point type, or null if it's not registered
    • getPointType

      @Nullable public static @Nullable PointProvider.PointSerializer<?> getPointType(net.minecraft.resources.ResourceLocation id)
      Returns the point serializer with this ID, or null if it doesn't exist
    • getTransitionTypeId

      @Nullable public static @Nullable net.minecraft.resources.ResourceLocation getTransitionTypeId(Transition.TransitionSerializer<?> type)
      Returns the ID of the specified transition type, or null if it's not registered
    • getTransitionType

      @Nullable public static @Nullable Transition.TransitionSerializer<?> getTransitionType(net.minecraft.resources.ResourceLocation id)
      Returns the transition serializer with this ID, or null if it doesn't exist
    • setPreviewedCutscene

      public static void setPreviewedCutscene(CutsceneType type, net.minecraft.world.phys.Vec3 offset, float pathYaw, float pathPitch, float pathRoll)
      Sets the currently previewed cutscene and tells the clients
    • getPreviewedCutscene

      public static CutsceneType getPreviewedCutscene()
      Self-explanatory
    • getOffset

      public static org.joml.Vector3f getOffset()
      Returns the starting position of the current cutscene preview, or [0, 100, 0] if there isn't one
    • startCutscene

      public static void startCutscene(net.minecraft.resources.ResourceLocation id, net.minecraft.world.phys.Vec3 startPos, net.minecraft.world.phys.Vec3 camRot, net.minecraft.world.phys.Vec3 pathRot, net.minecraft.server.level.ServerPlayer player)
      Starts a cutscene for a player
      Parameters:
      id - The ID of the cutscene to start
      startPos - The starting position for the cutscene
      camRot - The initial camera rotation of the player as a vector of (yaw, pitch, roll)
      pathRot - The path rotation as a vector of (yaw, pitch, roll)
      player - The player to play the cutscene to
    • stopCutscene

      public static void stopCutscene(net.minecraft.server.level.ServerPlayer player)
      Stops a cutscene for a player, regardless of whether they were actually watching it or not.
      Parameters:
      player - The player to stop the cutscene for