Klasse BezierPath
java.lang.Object
de.luckymcdev.foundryengine.common.easing.BezierPath
Represents a complete Bézier path composed of multiple splines.
Provides arc-length parameterization for constant-speed motion.
-
Feldübersicht
Felder -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungBezierPath(net.minecraft.nbt.ListTag list) Creates a BezierPath from serialized NBT data.BezierPath(net.minecraft.world.phys.Vec3 startPos) Creates a new BezierPath starting at the given position. -
Methodenübersicht
Modifikator und TypMethodeBeschreibungintReturns the number of non-tangent ("node") points in this path.Returns all non-tangent ("node") points in order from start to end.doublegetDistanceAtTime(double time) Returns the approximate arc-length distance (in blocks) along the path at the given time parameter (0..1) oflerp(double).doublegetNormalizedDistanceAtTime(double time) Returns the normalized arc-length distance (0..1) along the path at the given time parameter (0..1) oflerp(double).Gets all control points in the path.doubleGets the total arc length of the path.voidInvalidates the LUT cache, forcing recalculation on next use.booleanisPointFirstOrLast(BezierPoint point) Checks if a point is at the start or end of the path.booleanReturns true if the path consists of a single point with no spline.net.minecraft.world.phys.Vec3lerpSpeedWeighted(double t) Interpolates a position using arc-length parameterization.voidremovePoint(BezierPoint point) Removes a point and its associated spline(s).net.minecraft.nbt.ListTagtoNbt()Serializes the path to NBT format.voidUpdates the Look-Up Table (LUT) for arc-length parameterization.withPlayerEnd(net.minecraft.world.entity.player.Player player) Creates a new path with the player's eye position as the ending point.withPlayerOrigin(net.minecraft.world.entity.player.Player player) Creates a new path with the player's eye position as the starting point.
-
Felddetails
-
splines
-
-
Konstruktordetails
-
BezierPath
public BezierPath(net.minecraft.world.phys.Vec3 startPos) Creates a new BezierPath starting at the given position. -
BezierPath
public BezierPath(net.minecraft.nbt.ListTag list) Creates a BezierPath from serialized NBT data.
-
-
Methodendetails
-
isSinglePoint
public boolean isSinglePoint()Returns true if the path consists of a single point with no spline. -
withPlayerOrigin
Creates a new path with the player's eye position as the starting point. -
withPlayerEnd
Creates a new path with the player's eye position as the ending point. -
updateLUT
public void updateLUT()Updates the Look-Up Table (LUT) for arc-length parameterization. This should be called whenever any point on the path changes. -
getDistanceAtTime
public double getDistanceAtTime(double time) Returns the approximate arc-length distance (in blocks) along the path at the given time parameter (0..1) oflerp(double). This is derived from the same LUT used for constant-speed motion. -
getNormalizedDistanceAtTime
public double getNormalizedDistanceAtTime(double time) Returns the normalized arc-length distance (0..1) along the path at the given time parameter (0..1) oflerp(double). -
lerpSpeedWeighted
public net.minecraft.world.phys.Vec3 lerpSpeedWeighted(double t) Interpolates a position using arc-length parameterization. This provides constant-speed motion along the path.- Parameter:
t- parameter from 0 to 1 representing distance along the path
-
getPoints
Gets all control points in the path. -
getAnchorPoints
Returns all non-tangent ("node") points in order from start to end. -
getAnchorPointCount
public int getAnchorPointCount()Returns the number of non-tangent ("node") points in this path. -
removePoint
Removes a point and its associated spline(s). -
isPointFirstOrLast
Checks if a point is at the start or end of the path. -
toNbt
public net.minecraft.nbt.ListTag toNbt()Serializes the path to NBT format. -
getTotalLength
public double getTotalLength()Gets the total arc length of the path. -
invalidateLUT
public void invalidateLUT()Invalidates the LUT cache, forcing recalculation on next use.
-