Interface GradientCurve
- All Known Implementing Classes:
GradientCurve.Exponential,GradientCurve.Linear,GradientCurve.Logarithmic,GradientCurve.Polynomial,GradientCurve.Sigmoid
public sealed interface GradientCurve
permits GradientCurve.Linear, GradientCurve.Sigmoid, GradientCurve.Logarithmic, GradientCurve.Polynomial, GradientCurve.Exponential
A sealed interface representing a mathematical easing/scaling curve applied to a normalized
position fraction
t in [0.0, 1.0] within a GradientOutput.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA normalized exponential curve (f(t) = (base^t - 1) / (base - 1)).static final recordA linear 1:1 gradient curve (f(t) = clamp(t, 0, 1)).static final recordA logarithmic curve (f(t) = ln(1 + baseMultiplier * t) / ln(1 + baseMultiplier)) that rises rapidly near0.0and flattens toward1.0.static final recordA power/polynomial curve (f(t) = t^exponent).static final recordA logistic S-curve (f(t) = 1 / (1 + e^(-steepness * (t - midpoint)))) for sharp or smooth transitions. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<GradientCurve> Dispatch codec for serializing and deserializing anyGradientCurveimplementation based on its"type"field. -
Method Summary
-
Field Details
-
CODEC
Dispatch codec for serializing and deserializing anyGradientCurveimplementation based on its"type"field.
-
-
Method Details
-
getTypeId
String getTypeId()Retrieves the unique string identifier for this curve type.- Returns:
- The curve type ID string.
-
apply
float apply(float t) Applies the selected scaling curve to the provided normalized fractiont.- Parameters:
t- A float between0.0and1.0representing distance along the gradient.- Returns:
- The scaled float representing the new weight mapped along the curve.
-