yarn/mappings/net/minecraft/util/math/MathHelper.mapping

450 lines
15 KiB
Plaintext
Raw Normal View History

2019-06-28 17:55:20 -04:00
CLASS net/minecraft/class_3532 net/minecraft/util/math/MathHelper
COMMENT Contains math-related helper methods. This includes {@code float}-specific extensions
COMMENT to {@link Math}, linear interpolation (lerp), and color-related methods.
COMMENT
COMMENT <p>Trigonometric functions defined in this class use the "sine table", a pre-calculated
COMMENT table of {@code sin(N)} ({@code 0 <= N < pi * 2}).
2019-06-28 17:55:20 -04:00
FIELD field_15722 COSINE_TABLE [D
2019-10-07 06:46:49 -04:00
FIELD field_15723 MULTIPLY_DE_BRUIJN_BIT_POSITION [I
2019-06-28 17:55:20 -04:00
FIELD field_15724 SQUARE_ROOT_OF_TWO F
FIELD field_15725 SINE_TABLE [F
2022-04-06 15:01:01 -04:00
FIELD field_15726 RANDOM Lnet/minecraft/class_5819;
2019-06-28 17:55:20 -04:00
FIELD field_15727 ARCSINE_TABLE [D
FIELD field_15728 SMALLEST_FRACTION_FREE_DOUBLE D
FIELD field_29844 PI F
FIELD field_29845 HALF_PI F
FIELD field_29846 TAU F
COMMENT Tau is equal to {@code 2 * PI}.
FIELD field_29847 RADIANS_PER_DEGREE F
FIELD field_29848 DEGREES_PER_RADIAN F
FIELD field_29849 EPSILON F
FIELD field_29853 HALF_PI_RADIANS_SINE_TABLE_INDEX J
FIELD field_29856 DEGREES_TO_SINE_TABLE_INDEX F
2019-06-28 17:55:20 -04:00
METHOD method_15338 wrapDegrees (D)D
COMMENT Wraps an angle in degrees to the interval {@code [-180, 180)}.
ARG 0 degrees
2019-06-28 17:55:20 -04:00
METHOD method_15339 smallestEncompassingPowerOfTwo (I)I
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15340 clamp (III)I
ARG 0 value
ARG 1 min
ARG 2 max
2019-06-28 17:55:20 -04:00
METHOD method_15341 floorMod (FF)F
ARG 0 dividend
ARG 1 divisor
METHOD method_15342 ceilLog2 (I)I
COMMENT {@return ceil(log<sub>2</sub>({@code value}))}
COMMENT
COMMENT <p>The vanilla implementation uses the de Bruijn sequence.
COMMENT
COMMENT @see Integer#numberOfLeadingZeros(int)
2021-01-31 07:37:36 -05:00
ARG 0 value
COMMENT the input value
2019-06-28 17:55:20 -04:00
METHOD method_15343 parseInt (Ljava/lang/String;I)I
ARG 0 string
ARG 1 fallback
2022-04-06 15:01:01 -04:00
METHOD method_15344 nextFloat (Lnet/minecraft/class_5819;FF)F
ARG 0 random
ARG 1 min
ARG 2 max
2019-06-28 17:55:20 -04:00
METHOD method_15345 fastInverseSqrt (D)D
COMMENT {@return an approximation of {@code 1 / Math.sqrt(x)}}
ARG 0 x
METHOD method_15347 approximatelyEquals (FF)Z
ARG 0 a
ARG 1 b
METHOD method_15348 stepTowards (FFF)F
COMMENT Steps from {@code from} towards {@code to}, changing the value by at most {@code step}.
ARG 0 from
ARG 1 to
ARG 2 step
2019-06-28 17:55:20 -04:00
METHOD method_15349 atan2 (DD)D
ARG 0 y
ARG 2 x
2019-06-28 17:55:20 -04:00
METHOD method_15350 clamp (DDD)D
ARG 0 value
ARG 2 min
ARG 4 max
METHOD method_15351 floorLog2 (I)I
COMMENT {@return floor(log<sub>2</sub>({@code value}))}
COMMENT
COMMENT <p>The vanilla implementation uses the de Bruijn sequence.
COMMENT
COMMENT @see Integer#numberOfLeadingZeros(int)
2021-01-31 07:37:36 -05:00
ARG 0 value
COMMENT the input value
2019-06-28 17:55:20 -04:00
METHOD method_15352 isPowerOfTwo (I)Z
2021-01-31 07:37:36 -05:00
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15353 packRgb (FFF)I
ARG 0 r
ARG 1 g
ARG 2 b
METHOD method_15354 idealHash (I)I
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15355 sqrt (F)F
2021-01-31 07:37:36 -05:00
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15356 angleBetween (FF)F
ARG 0 first
ARG 1 second
METHOD method_15357 floor (D)I
2021-01-31 07:37:36 -05:00
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15360 binarySearch (IILjava/util/function/IntPredicate;)I
COMMENT Finds the minimum value in {@code [min, max)} that satisfies the
COMMENT monotonic {@code predicate}.
COMMENT
COMMENT <p>The {@code predicate} must be monotonic, i.e. if for any {@code a},
COMMENT {@code predicate.test(a)} is {@code true}, then for all {@code b > a},
COMMENT {@code predicate.test(b)} must also be {@code true}.
COMMENT
COMMENT <p>Examples:
COMMENT <ul>
COMMENT <li>{@code binarySearch(3, 7, x -> true)} returns {@code 3}.
COMMENT <li>{@code binarySearch(3, 7, x -> x >= 5)} returns {@code 5}.
COMMENT <li>{@code binarySearch(3, 7, x -> false)} returns {@code 7}.
COMMENT </ul>
COMMENT
COMMENT @return the minimum value if such value is found, otherwise {@code max}
ARG 0 min
COMMENT the minimum value (inclusive) to be tested
ARG 1 max
COMMENT the maximum value (exclusive) to be tested
ARG 2 predicate
COMMENT the predicate that returns {@code true} for integers greater than or
COMMENT equal to the value to be searched for
2019-06-28 17:55:20 -04:00
METHOD method_15362 cos (F)F
2021-01-31 07:37:36 -05:00
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15363 clamp (FFF)F
ARG 0 value
ARG 1 min
ARG 2 max
2022-04-06 15:01:01 -04:00
METHOD method_15366 nextDouble (Lnet/minecraft/class_5819;DD)D
ARG 0 random
ARG 1 min
ARG 3 max
2019-06-28 17:55:20 -04:00
METHOD method_15367 floorMod (DD)D
ARG 0 dividend
ARG 2 divisor
2019-06-28 17:55:20 -04:00
METHOD method_15369 hsvToRgb (FFF)I
ARG 0 hue
ARG 1 saturation
ARG 2 value
METHOD method_15370 getLerpProgress (DDD)D
COMMENT Gets the fraction of the way that {@code value} is between {@code start} and {@code end}.
COMMENT This is the delta value needed to lerp between {@code start} and {@code end} to get {@code value}.
COMMENT In other words, {@code getLerpProgress(lerp(delta, start, end), start, end) == delta}.
ARG 0 value
COMMENT the result of the lerp function
ARG 2 start
COMMENT the value interpolated from
ARG 4 end
COMMENT the value interpolated to
2019-06-28 17:55:20 -04:00
METHOD method_15371 hashCode (III)J
ARG 0 x
ARG 1 y
ARG 2 z
2019-06-28 17:55:20 -04:00
METHOD method_15372 lfloor (D)J
2021-01-31 07:37:36 -05:00
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15374 sin (F)F
2021-01-31 07:37:36 -05:00
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15375 floor (F)I
2021-01-31 07:37:36 -05:00
ARG 0 value
METHOD method_15376 ([F)V
ARG 0 sineTable
2022-04-06 15:01:01 -04:00
METHOD method_15378 randomUuid (Lnet/minecraft/class_5819;)Ljava/util/UUID;
ARG 0 random
2019-06-28 17:55:20 -04:00
METHOD method_15379 abs (F)F
2021-01-31 07:37:36 -05:00
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15381 subtractAngles (FF)F
ARG 0 start
ARG 1 end
METHOD method_15382 abs (I)I
2021-01-31 07:37:36 -05:00
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15384 ceil (D)I
2021-01-31 07:37:36 -05:00
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15385 fractionalPart (D)D
ARG 0 value
METHOD method_15386 ceil (F)I
2021-01-31 07:37:36 -05:00
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_15387 floorMod (II)I
ARG 0 dividend
ARG 1 divisor
METHOD method_15388 stepUnwrappedAngleTowards (FFF)F
COMMENT Steps from {@code from} degrees towards {@code to} degrees, changing the value by at most {@code step} degrees.
ARG 0 from
ARG 1 to
ARG 2 step
2019-06-28 17:55:20 -04:00
METHOD method_15389 hashCode (Lnet/minecraft/class_2382;)J
ARG 0 vec
METHOD method_15390 clampedLerp (DDD)D
ARG 0 start
ARG 2 end
2019-06-28 17:55:20 -04:00
ARG 4 delta
METHOD method_15391 absMax (DD)D
ARG 0 a
ARG 2 b
2019-06-28 17:55:20 -04:00
METHOD method_15392 wrapDegrees (I)I
COMMENT Wraps an angle in degrees to the interval {@code [-180, 180)}.
ARG 0 degrees
2019-06-28 17:55:20 -04:00
METHOD method_15393 wrapDegrees (F)F
COMMENT Wraps an angle in degrees to the interval {@code [-180, 180)}.
ARG 0 degrees
METHOD method_15394 randomUuid ()Ljava/util/UUID;
2022-04-06 15:01:01 -04:00
METHOD method_15395 nextInt (Lnet/minecraft/class_5819;II)I
COMMENT {@return a random, uniformly distributed integer value in {@code
COMMENT [min, max]}} If the range is empty (i.e. {@code max < min}), it
COMMENT returns {@code min}.
ARG 0 random
2019-06-28 17:55:20 -04:00
ARG 1 min
COMMENT the minimum value, inclusive
2019-06-28 17:55:20 -04:00
ARG 2 max
COMMENT the maximum value, inclusive
2019-06-28 17:55:20 -04:00
METHOD method_16435 perlinFade (D)D
ARG 0 value
2019-06-28 17:55:20 -04:00
METHOD method_16436 lerp (DDD)D
ARG 0 delta
ARG 2 start
ARG 4 end
2019-06-28 17:55:20 -04:00
METHOD method_16437 lerp2 (DDDDDD)D
COMMENT A two-dimensional lerp between values on the 4 corners of the unit square. Arbitrary values are specified for the corners and the output is interpolated between them.
2019-06-28 17:55:20 -04:00
ARG 0 deltaX
COMMENT the x-coordinate on the unit square
2019-06-28 17:55:20 -04:00
ARG 2 deltaY
COMMENT the y-coordinate on the unit square
ARG 4 x0y0
COMMENT the output if {@code deltaX} is 0 and {@code deltaY} is 0
ARG 6 x1y0
COMMENT the output if {@code deltaX} is 1 and {@code deltaY} is 0
ARG 8 x0y1
COMMENT the output if {@code deltaX} is 0 and {@code deltaY} is 1
ARG 10 x1y1
COMMENT the output if {@code deltaX} is 1 and {@code deltaY} is 1
2019-06-28 17:55:20 -04:00
METHOD method_16438 lerp3 (DDDDDDDDDDD)D
COMMENT A three-dimensional lerp between values on the 8 corners of the unit cube. Arbitrary values are specified for the corners and the output is interpolated between them.
2019-06-28 17:55:20 -04:00
ARG 0 deltaX
COMMENT the x-coordinate on the unit cube
2019-06-28 17:55:20 -04:00
ARG 2 deltaY
COMMENT the y-coordinate on the unit cube
2019-06-28 17:55:20 -04:00
ARG 4 deltaZ
COMMENT the z-coordinate on the unit cube
ARG 6 x0y0z0
COMMENT the output if {@code deltaX} is 0, {@code deltaY} is 0 and {@code deltaZ} is 0
ARG 8 x1y0z0
COMMENT the output if {@code deltaX} is 1, {@code deltaY} is 0 and {@code deltaZ} is 0
ARG 10 x0y1z0
COMMENT the output if {@code deltaX} is 0, {@code deltaY} is 1 and {@code deltaZ} is 0
ARG 12 x1y1z0
COMMENT the output if {@code deltaX} is 1, {@code deltaY} is 1 and {@code deltaZ} is 0
ARG 14 x0y0z1
COMMENT the output if {@code deltaX} is 0, {@code deltaY} is 0 and {@code deltaZ} is 1
ARG 16 x1y0z1
COMMENT the output if {@code deltaX} is 1, {@code deltaY} is 0 and {@code deltaZ} is 1
ARG 18 x0y1z1
COMMENT the output if {@code deltaX} is 0, {@code deltaY} is 1 and {@code deltaZ} is 1
ARG 20 x1y1z1
COMMENT the output if {@code deltaX} is 1, {@code deltaY} is 1 and {@code deltaZ} is 1
2019-06-28 17:55:20 -04:00
METHOD method_16439 lerp (FFF)F
ARG 0 delta
ARG 1 start
ARG 2 end
2019-06-28 17:55:20 -04:00
METHOD method_17821 lerpAngleDegrees (FFF)F
ARG 0 delta
ARG 1 start
ARG 2 end
2019-06-28 17:55:20 -04:00
METHOD method_17822 sign (D)I
ARG 0 value
METHOD method_20306 clampAngle (FFF)F
COMMENT Clamps {@code value}, as an angle, between {@code mean - delta} and {@code
COMMENT mean + delta} degrees.
COMMENT
COMMENT @return the clamped {@code value}
ARG 0 value
COMMENT the value to clamp
ARG 1 mean
COMMENT the mean value of the clamp angle range
ARG 2 delta
COMMENT the maximum difference allowed from the mean, must not be negative
METHOD method_20390 approximatelyEquals (DD)Z
ARG 0 a
ARG 2 b
METHOD method_22450 fractionalPart (F)F
ARG 0 value
METHOD method_23278 fastInverseCbrt (F)F
COMMENT {@return an approximation of {@code 1 / Math.cbrt(x)}}
ARG 0 x
METHOD method_24504 wrap (FF)F
ARG 0 value
ARG 1 maxDeviation
METHOD method_27285 square (F)F
ARG 0 n
METHOD method_28139 roundUpToMultiple (II)I
COMMENT Returns a value farther than or as far as {@code value} from zero that
COMMENT is a multiple of {@code divisor}.
ARG 0 value
ARG 1 divisor
2022-04-06 15:01:01 -04:00
METHOD method_32750 nextBetween (Lnet/minecraft/class_5819;FF)F
ARG 0 random
ARG 1 min
ARG 2 max
2022-04-06 15:01:01 -04:00
METHOD method_32751 nextBetween (Lnet/minecraft/class_5819;II)I
COMMENT {@return a random, uniformly distributed integer value in {@code
COMMENT [min, max]}}
COMMENT
COMMENT @throws IllegalArgumentException if the range is empty (i.e. {@code
COMMENT max < min})
ARG 0 random
ARG 1 min
COMMENT the minimum value, inclusive
ARG 2 max
COMMENT the maximum value, inclusive
METHOD method_32854 clampedMap (DDDDD)D
COMMENT Linearly maps a value from one number range to another
COMMENT and clamps the result.
COMMENT
COMMENT @return the mapped value, clamped between {@code newStart} and {@code newEnd}
COMMENT @see #map(double, double, double, double, double) the unclamped variant
ARG 0 value
COMMENT the input value
ARG 2 oldStart
COMMENT the starting value of the original range
ARG 4 oldEnd
COMMENT the end value of the original range
ARG 6 newStart
COMMENT the starting value of the new range
ARG 8 newEnd
COMMENT the end value of the new range
2022-04-06 15:01:01 -04:00
METHOD method_32855 nextGaussian (Lnet/minecraft/class_5819;FF)F
ARG 0 random
ARG 1 mean
2020-12-16 13:52:22 -05:00
ARG 2 deviation
METHOD method_33722 map (DDDDD)D
COMMENT Linearly maps a value from one number range to another, unclamped.
COMMENT
COMMENT <p>For the return value {@code result}, {@code getLerpProgress(value, oldStart, oldEnd)}
COMMENT is approximately equal to {@code getLerpProgress(result, newStart, newEnd)}
COMMENT (accounting for floating point errors).
COMMENT
COMMENT @return the mapped value
ARG 0 value
COMMENT the input value
ARG 2 oldStart
COMMENT the starting value of the original range
ARG 4 oldEnd
COMMENT the end value of the original range
ARG 6 newStart
COMMENT the starting value of the new range
ARG 8 newEnd
COMMENT the end value of the new range
METHOD method_33723 square (D)D
ARG 0 n
2021-11-11 13:05:24 -05:00
METHOD method_33825 magnitude (DDD)D
ARG 0 a
ARG 2 b
ARG 4 c
METHOD method_34954 square (I)I
ARG 0 n
2021-04-16 10:19:52 -04:00
METHOD method_34956 perlinFadeDerivative (D)D
ARG 0 value
METHOD method_37166 clampedLerp (FFF)F
ARG 0 start
ARG 1 end
ARG 2 delta
METHOD method_37958 clampedMap (FFFFF)F
COMMENT Linearly maps a value from one number range to another
COMMENT and clamps the result.
COMMENT
COMMENT @return the mapped value, clamped between {@code newStart} and {@code newEnd}
COMMENT @see #map(float, float, float, float, float) the unclamped variant
ARG 0 value
COMMENT the input value
ARG 1 oldStart
COMMENT the starting value of the original range
ARG 2 oldEnd
COMMENT the end value of the original range
ARG 3 newStart
COMMENT the starting value of the new range
ARG 4 newEnd
COMMENT the end value of the new range
METHOD method_37959 map (FFFFF)F
COMMENT Linearly maps a value from one number range to another, unclamped.
COMMENT
COMMENT <p>For the return value {@code result}, {@code getLerpProgress(value, oldStart, oldEnd)}
COMMENT is approximately equal to {@code getLerpProgress(result, newStart, newEnd)}
COMMENT (accounting for floating point errors).
COMMENT
COMMENT @return the mapped value
ARG 0 value
COMMENT the input value
ARG 1 oldStart
COMMENT the starting value of the original range
ARG 2 oldEnd
COMMENT the end value of the original range
ARG 3 newStart
COMMENT the starting value of the new range
ARG 4 newEnd
COMMENT the end value of the new range
METHOD method_37960 getLerpProgress (FFF)F
ARG 0 value
ARG 1 start
ARG 2 end
METHOD method_38652 square (J)J
ARG 0 n
METHOD method_38788 ceilDiv (II)I
ARG 0 a
ARG 1 b
METHOD method_38961 roundDownToMultiple (DI)I
COMMENT {@return {@code a} rounded down to the nearest multiple of {@code b}}
ARG 0 a
ARG 2 b
2021-11-11 13:05:24 -05:00
METHOD method_39241 hypot (DD)D
ARG 0 a
ARG 2 b
2022-02-22 11:29:15 -05:00
METHOD method_41189 squaredHypot (DD)D
ARG 0 a
ARG 2 b
METHOD method_41190 squaredMagnitude (DDD)D
ARG 0 a
ARG 2 b
ARG 4 c
METHOD method_41303 catmullRom (FFFFF)F
COMMENT Interpolates a point on a Catmull-Rom Spline. This spline has a property that if there are two
COMMENT splines with arguments {@code p0, p1, p2, p3} and {@code p1, p2, p3, p4}, the resulting curve
COMMENT will have a continuous first derivative at {@code p2}, where the two input curves connect. For
COMMENT higher-dimensional curves, the interpolation on the curve is done component-wise: for
COMMENT inputs {@code delta, (p0x, p0y), (p1x, p1y), (p2x, p2y), (p3x, p3y)}, the output is
COMMENT {@code (catmullRom(delta, p0x, p1x, p2x, p3x), catmullRom(delta, p0y, p1y, p2y, p3y))}.
COMMENT
COMMENT @see <a href="https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull%E2%80%93Rom_spline">Cubic Hermite spline (CatmullRom spline)</a>
ARG 0 delta
COMMENT the progress along the interpolation
ARG 1 p0
COMMENT the previous data point to assist in curve-smoothing
ARG 2 p1
COMMENT the output if {@code delta} is 0
ARG 3 p2
COMMENT the output if {@code delta} is 1
ARG 4 p3
COMMENT the next data point to assist in curve-smoothing
2022-03-30 05:19:16 -04:00
METHOD method_42117 stream (IIII)Ljava/util/stream/IntStream;
ARG 0 seed
ARG 1 lowerBound
ARG 2 upperBound
ARG 3 steps
METHOD method_42118 (IIIII)I
ARG 4 i
METHOD method_42119 (IIII)Z
ARG 3 i
METHOD method_42120 stream (III)Ljava/util/stream/IntStream;
ARG 0 seed
ARG 1 lowerBound
ARG 2 upperBound
METHOD method_48116 floorDiv (II)I
ARG 0 dividend
ARG 1 divisor
METHOD method_48117 isMultipleOf (II)Z
ARG 0 a
ARG 1 b
METHOD method_48118 inverseSqrt (D)D
ARG 0 x
METHOD method_48119 inverseSqrt (F)F
ARG 0 x