Package net.minecraft.util.math
Class MathHelper
java.lang.Object
net.minecraft.util.math.MathHelper
Contains math-related helper methods. This includes
float-specific extensions
to Math, linear interpolation (lerp), and color-related methods.
Trigonometric functions defined in this class use the "sine table", a pre-calculated
table of sin(N) (0 <= N < pi * 2).
- Mappings:
Namespace Name official apaintermediary net/minecraft/class_3532named net/minecraft/util/math/MathHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final double[]private static final double[]static final floatprivate static final floatstatic final floatprivate static final longprivate static final longprivate static final longprivate static final doubleprivate static final intprivate static final intstatic final floatprivate static final longprivate static final int[]static final floatstatic final floatprivate static final Randomprivate static final float[]private static final doublestatic final floatstatic final floatTau is equal to2 * PI. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatabs(float value) static intabs(int value) static doubleabsMax(double a, double b) static floatangleBetween(float first, float second) static booleanapproximatelyEquals(double a, double b) static booleanapproximatelyEquals(float a, float b) static doubleatan2(double y, double x) static intbinarySearch(int min, int max, IntPredicate predicate) Finds the minimum value in[min, max)that satisfies the monotonicpredicate.static floatcatmullRom(float delta, float p0, float p1, float p2, float p3) Interpolates a point on a Catmull-Rom Spline.static intceil(double value) static intceil(float value) static intceilDiv(int a, int b) static intceilLog2(int value) Returns ceil(log2(value)).static doubleclamp(double value, double min, double max) static floatclamp(float value, float min, float max) static intclamp(int value, int min, int max) static floatclampAngle(float value, float mean, float delta) Clampsvalue, as an angle, betweenmean - deltaandmean + deltadegrees.static doubleclampedLerp(double start, double end, double delta) static floatclampedLerp(float start, float end, float delta) static doubleclampedMap(double value, double oldStart, double oldEnd, double newStart, double newEnd) Linearly maps a value from one number range to another and clamps the result.static floatclampedMap(float value, float oldStart, float oldEnd, float newStart, float newEnd) Linearly maps a value from one number range to another and clamps the result.static floatcos(float value) static floatfastInverseCbrt(float x) Returns an approximation of1 / Math.cbrt(x).static doublefastInverseSqrt(double x) Deprecated.static intfloor(double value) static intfloor(float value) static intfloorDiv(int dividend, int divisor) static intfloorLog2(int value) Returns floor(log2(value)).static doublefloorMod(double dividend, double divisor) static floatfloorMod(float dividend, float divisor) static intfloorMod(int dividend, int divisor) static doublefractionalPart(double value) static floatfractionalPart(float value) static doublegetLerpProgress(double value, double start, double end) Gets the fraction of the way thatvalueis betweenstartandend.static floatgetLerpProgress(float value, float start, float end) static longhashCode(int x, int y, int z) Deprecated.static longDeprecated.static inthsvToRgb(float hue, float saturation, float value) static doublehypot(double a, double b) static intidealHash(int value) static doubleinverseSqrt(double x) static floatinverseSqrt(float x) static booleanisMultipleOf(int a, int b) static booleanisPowerOfTwo(int value) static doublelerp(double delta, double start, double end) static floatlerp(float delta, float start, float end) static intlerp(float delta, int start, int end) static doublelerp2(double deltaX, double deltaY, double x0y0, double x1y0, double x0y1, double x1y1) A two-dimensional lerp between values on the 4 corners of the unit square.static doublelerp3(double deltaX, double deltaY, double deltaZ, double x0y0z0, double x1y0z0, double x0y1z0, double x1y1z0, double x0y0z1, double x1y0z1, double x0y1z1, double x1y1z1) A three-dimensional lerp between values on the 8 corners of the unit cube.static floatlerpAngleDegrees(float delta, float start, float end) static longlfloor(double value) static doublemagnitude(double a, double b, double c) static doublemap(double value, double oldStart, double oldEnd, double newStart, double newEnd) Linearly maps a value from one number range to another, unclamped.static floatmap(float value, float oldStart, float oldEnd, float newStart, float newEnd) Linearly maps a value from one number range to another, unclamped.static booleanmethod_34945(Vec3d vec3d, Vec3d vec3d2, Box box) static doublemethod_34957(double double2) static floatnextBetween(Random random, float min, float max) static intnextBetween(Random random, int min, int max) Returns a random, uniformly distributed integer value in[min, max].static doublenextDouble(Random random, double min, double max) static floatstatic floatnextGaussian(Random random, float mean, float deviation) static intReturns a random, uniformly distributed integer value in[min, max].static intpackRgb(float r, float g, float b) static intstatic doubleperlinFade(double value) static doubleperlinFadeDerivative(double value) static UUIDstatic UUIDrandomUuid(Random random) static introundDownToMultiple(double a, int b) Returnsarounded down to the nearest multiple ofb.static introundUpToMultiple(int value, int divisor) Returns a value farther than or as far asvaluefrom zero that is a multiple ofdivisor.static intsign(double value) static floatsin(float value) static intsmallestEncompassingPowerOfTwo(int value) static floatsqrt(float value) static doublesquare(double n) static floatsquare(float n) static intsquare(int n) static longsquare(long n) static doublesquaredHypot(double a, double b) static doublesquaredMagnitude(double a, double b, double c) static floatstepTowards(float from, float to, float step) Steps fromfromtowardsto, changing the value by at moststep.static floatstepUnwrappedAngleTowards(float from, float to, float step) Steps fromfromdegrees towardstodegrees, changing the value by at moststepdegrees.static IntStreamstream(int seed, int lowerBound, int upperBound) static IntStreamstream(int seed, int lowerBound, int upperBound, int steps) static floatsubtractAngles(float start, float end) static floatwrap(float value, float maxDeviation) static doublewrapDegrees(double degrees) Wraps an angle in degrees to the interval[-180, 180).static floatwrapDegrees(float degrees) Wraps an angle in degrees to the interval[-180, 180).static intwrapDegrees(int degrees) Wraps an angle in degrees to the interval[-180, 180).
-
Field Details
-
field_29852
private static final long field_29852- See Also:
- Mappings:
Namespace Name Mixin selector official hLapa;h:Jintermediary field_29852Lnet/minecraft/class_3532;field_29852:Jnamed field_29852Lnet/minecraft/util/math/MathHelper;field_29852:J
-
HALF_PI_RADIANS_SINE_TABLE_INDEX
private static final long HALF_PI_RADIANS_SINE_TABLE_INDEX- See Also:
- Mappings:
Namespace Name Mixin selector official iLapa;i:Jintermediary field_29853Lnet/minecraft/class_3532;field_29853:Jnamed HALF_PI_RADIANS_SINE_TABLE_INDEXLnet/minecraft/util/math/MathHelper;HALF_PI_RADIANS_SINE_TABLE_INDEX:J
-
field_29854
private static final long field_29854- See Also:
- Mappings:
Namespace Name Mixin selector official jLapa;j:Jintermediary field_29854Lnet/minecraft/class_3532;field_29854:Jnamed field_29854Lnet/minecraft/util/math/MathHelper;field_29854:J
-
field_29855
private static final long field_29855- See Also:
- Mappings:
Namespace Name Mixin selector official kLapa;k:Jintermediary field_29855Lnet/minecraft/class_3532;field_29855:Jnamed field_29855Lnet/minecraft/util/math/MathHelper;field_29855:J
-
PI
public static final float PI- See Also:
- Mappings:
Namespace Name Mixin selector official aLapa;a:Fintermediary field_29844Lnet/minecraft/class_3532;field_29844:Fnamed PILnet/minecraft/util/math/MathHelper;PI:F
-
HALF_PI
public static final float HALF_PI- See Also:
- Mappings:
Namespace Name Mixin selector official bLapa;b:Fintermediary field_29845Lnet/minecraft/class_3532;field_29845:Fnamed HALF_PILnet/minecraft/util/math/MathHelper;HALF_PI:F
-
TAU
public static final float TAUTau is equal to2 * PI.- See Also:
- Mappings:
Namespace Name Mixin selector official cLapa;c:Fintermediary field_29846Lnet/minecraft/class_3532;field_29846:Fnamed TAULnet/minecraft/util/math/MathHelper;TAU:F
-
RADIANS_PER_DEGREE
public static final float RADIANS_PER_DEGREE- See Also:
- Mappings:
Namespace Name Mixin selector official dLapa;d:Fintermediary field_29847Lnet/minecraft/class_3532;field_29847:Fnamed RADIANS_PER_DEGREELnet/minecraft/util/math/MathHelper;RADIANS_PER_DEGREE:F
-
DEGREES_PER_RADIAN
public static final float DEGREES_PER_RADIAN- See Also:
- Mappings:
Namespace Name Mixin selector official eLapa;e:Fintermediary field_29848Lnet/minecraft/class_3532;field_29848:Fnamed DEGREES_PER_RADIANLnet/minecraft/util/math/MathHelper;DEGREES_PER_RADIAN:F
-
EPSILON
public static final float EPSILON- See Also:
- Mappings:
Namespace Name Mixin selector official fLapa;f:Fintermediary field_29849Lnet/minecraft/class_3532;field_29849:Fnamed EPSILONLnet/minecraft/util/math/MathHelper;EPSILON:F
-
SQUARE_ROOT_OF_TWO
public static final float SQUARE_ROOT_OF_TWO- Mappings:
Namespace Name Mixin selector official gLapa;g:Fintermediary field_15724Lnet/minecraft/class_3532;field_15724:Fnamed SQUARE_ROOT_OF_TWOLnet/minecraft/util/math/MathHelper;SQUARE_ROOT_OF_TWO:F
-
DEGREES_TO_SINE_TABLE_INDEX
private static final float DEGREES_TO_SINE_TABLE_INDEX- See Also:
- Mappings:
Namespace Name Mixin selector official lLapa;l:Fintermediary field_29856Lnet/minecraft/class_3532;field_29856:Fnamed DEGREES_TO_SINE_TABLE_INDEXLnet/minecraft/util/math/MathHelper;DEGREES_TO_SINE_TABLE_INDEX:F
-
SINE_TABLE
private static final float[] SINE_TABLE- Mappings:
Namespace Name Mixin selector official mLapa;m:[Fintermediary field_15725Lnet/minecraft/class_3532;field_15725:[Fnamed SINE_TABLELnet/minecraft/util/math/MathHelper;SINE_TABLE:[F
-
RANDOM
- Mappings:
Namespace Name Mixin selector official nLapa;n:Lapf;intermediary field_15726Lnet/minecraft/class_3532;field_15726:Lnet/minecraft/class_5819;named RANDOMLnet/minecraft/util/math/MathHelper;RANDOM:Lnet/minecraft/util/math/random/Random;
-
MULTIPLY_DE_BRUIJN_BIT_POSITION
private static final int[] MULTIPLY_DE_BRUIJN_BIT_POSITION- Mappings:
Namespace Name Mixin selector official oLapa;o:[Iintermediary field_15723Lnet/minecraft/class_3532;field_15723:[Inamed MULTIPLY_DE_BRUIJN_BIT_POSITIONLnet/minecraft/util/math/MathHelper;MULTIPLY_DE_BRUIJN_BIT_POSITION:[I
-
field_29857
private static final double field_29857- See Also:
- Mappings:
Namespace Name Mixin selector official pLapa;p:Dintermediary field_29857Lnet/minecraft/class_3532;field_29857:Dnamed field_29857Lnet/minecraft/util/math/MathHelper;field_29857:D
-
field_29858
private static final int field_29858- See Also:
- Mappings:
Namespace Name Mixin selector official qLapa;q:Iintermediary field_29858Lnet/minecraft/class_3532;field_29858:Inamed field_29858Lnet/minecraft/util/math/MathHelper;field_29858:I
-
field_29859
private static final int field_29859- See Also:
- Mappings:
Namespace Name Mixin selector official rLapa;r:Iintermediary field_29859Lnet/minecraft/class_3532;field_29859:Inamed field_29859Lnet/minecraft/util/math/MathHelper;field_29859:I
-
SMALLEST_FRACTION_FREE_DOUBLE
private static final double SMALLEST_FRACTION_FREE_DOUBLE- Mappings:
Namespace Name Mixin selector official sLapa;s:Dintermediary field_15728Lnet/minecraft/class_3532;field_15728:Dnamed SMALLEST_FRACTION_FREE_DOUBLELnet/minecraft/util/math/MathHelper;SMALLEST_FRACTION_FREE_DOUBLE:D
-
ARCSINE_TABLE
private static final double[] ARCSINE_TABLE- Mappings:
Namespace Name Mixin selector official tLapa;t:[Dintermediary field_15727Lnet/minecraft/class_3532;field_15727:[Dnamed ARCSINE_TABLELnet/minecraft/util/math/MathHelper;ARCSINE_TABLE:[D
-
COSINE_TABLE
private static final double[] COSINE_TABLE- Mappings:
Namespace Name Mixin selector official uLapa;u:[Dintermediary field_15722Lnet/minecraft/class_3532;field_15722:[Dnamed COSINE_TABLELnet/minecraft/util/math/MathHelper;COSINE_TABLE:[D
-
-
Constructor Details
-
MathHelper
public MathHelper()
-
-
Method Details
-
sin
public static float sin(float value) - Mappings:
Namespace Name Mixin selector official aLapa;a(F)Fintermediary method_15374Lnet/minecraft/class_3532;method_15374(F)Fnamed sinLnet/minecraft/util/math/MathHelper;sin(F)F
-
cos
public static float cos(float value) - Mappings:
Namespace Name Mixin selector official bLapa;b(F)Fintermediary method_15362Lnet/minecraft/class_3532;method_15362(F)Fnamed cosLnet/minecraft/util/math/MathHelper;cos(F)F
-
sqrt
public static float sqrt(float value) - Mappings:
Namespace Name Mixin selector official cLapa;c(F)Fintermediary method_15355Lnet/minecraft/class_3532;method_15355(F)Fnamed sqrtLnet/minecraft/util/math/MathHelper;sqrt(F)F
-
floor
public static int floor(float value) - Mappings:
Namespace Name Mixin selector official dLapa;d(F)Iintermediary method_15375Lnet/minecraft/class_3532;method_15375(F)Inamed floorLnet/minecraft/util/math/MathHelper;floor(F)I
-
floor
public static int floor(double value) - Mappings:
Namespace Name Mixin selector official aLapa;a(D)Iintermediary method_15357Lnet/minecraft/class_3532;method_15357(D)Inamed floorLnet/minecraft/util/math/MathHelper;floor(D)I
-
lfloor
public static long lfloor(double value) - Mappings:
Namespace Name Mixin selector official bLapa;b(D)Jintermediary method_15372Lnet/minecraft/class_3532;method_15372(D)Jnamed lfloorLnet/minecraft/util/math/MathHelper;lfloor(D)J
-
abs
public static float abs(float value) - Mappings:
Namespace Name Mixin selector official eLapa;e(F)Fintermediary method_15379Lnet/minecraft/class_3532;method_15379(F)Fnamed absLnet/minecraft/util/math/MathHelper;abs(F)F
-
abs
public static int abs(int value) - Mappings:
Namespace Name Mixin selector official aLapa;a(I)Iintermediary method_15382Lnet/minecraft/class_3532;method_15382(I)Inamed absLnet/minecraft/util/math/MathHelper;abs(I)I
-
ceil
public static int ceil(float value) - Mappings:
Namespace Name Mixin selector official fLapa;f(F)Iintermediary method_15386Lnet/minecraft/class_3532;method_15386(F)Inamed ceilLnet/minecraft/util/math/MathHelper;ceil(F)I
-
ceil
public static int ceil(double value) - Mappings:
Namespace Name Mixin selector official cLapa;c(D)Iintermediary method_15384Lnet/minecraft/class_3532;method_15384(D)Inamed ceilLnet/minecraft/util/math/MathHelper;ceil(D)I
-
clamp
public static int clamp(int value, int min, int max) - Mappings:
Namespace Name Mixin selector official aLapa;a(III)Iintermediary method_15340Lnet/minecraft/class_3532;method_15340(III)Inamed clampLnet/minecraft/util/math/MathHelper;clamp(III)I
-
clamp
public static float clamp(float value, float min, float max) - Mappings:
Namespace Name Mixin selector official aLapa;a(FFF)Fintermediary method_15363Lnet/minecraft/class_3532;method_15363(FFF)Fnamed clampLnet/minecraft/util/math/MathHelper;clamp(FFF)F
-
clamp
public static double clamp(double value, double min, double max) - Mappings:
Namespace Name Mixin selector official aLapa;a(DDD)Dintermediary method_15350Lnet/minecraft/class_3532;method_15350(DDD)Dnamed clampLnet/minecraft/util/math/MathHelper;clamp(DDD)D
-
clampedLerp
public static double clampedLerp(double start, double end, double delta) - Mappings:
Namespace Name Mixin selector official bLapa;b(DDD)Dintermediary method_15390Lnet/minecraft/class_3532;method_15390(DDD)Dnamed clampedLerpLnet/minecraft/util/math/MathHelper;clampedLerp(DDD)D
-
clampedLerp
public static float clampedLerp(float start, float end, float delta) - Mappings:
Namespace Name Mixin selector official bLapa;b(FFF)Fintermediary method_37166Lnet/minecraft/class_3532;method_37166(FFF)Fnamed clampedLerpLnet/minecraft/util/math/MathHelper;clampedLerp(FFF)F
-
absMax
public static double absMax(double a, double b) - Mappings:
Namespace Name Mixin selector official aLapa;a(DD)Dintermediary method_15391Lnet/minecraft/class_3532;method_15391(DD)Dnamed absMaxLnet/minecraft/util/math/MathHelper;absMax(DD)D
-
floorDiv
public static int floorDiv(int dividend, int divisor) - Mappings:
Namespace Name Mixin selector official aLapa;a(II)Iintermediary method_48116Lnet/minecraft/class_3532;method_48116(II)Inamed floorDivLnet/minecraft/util/math/MathHelper;floorDiv(II)I
-
nextInt
Returns a random, uniformly distributed integer value in[min, max]. If the range is empty (i.e.max < min), it returnsmin.- Parameters:
min- the minimum value, inclusivemax- the maximum value, inclusive- Returns:
- a random, uniformly distributed integer value in
[min, max] - Mappings:
Namespace Name Mixin selector official aLapa;a(Lapf;II)Iintermediary method_15395Lnet/minecraft/class_3532;method_15395(Lnet/minecraft/class_5819;II)Inamed nextIntLnet/minecraft/util/math/MathHelper;nextInt(Lnet/minecraft/util/math/random/Random;II)I
-
nextFloat
- Mappings:
Namespace Name Mixin selector official aLapa;a(Lapf;FF)Fintermediary method_15344Lnet/minecraft/class_3532;method_15344(Lnet/minecraft/class_5819;FF)Fnamed nextFloatLnet/minecraft/util/math/MathHelper;nextFloat(Lnet/minecraft/util/math/random/Random;FF)F
-
nextDouble
- Mappings:
Namespace Name Mixin selector official aLapa;a(Lapf;DD)Dintermediary method_15366Lnet/minecraft/class_3532;method_15366(Lnet/minecraft/class_5819;DD)Dnamed nextDoubleLnet/minecraft/util/math/MathHelper;nextDouble(Lnet/minecraft/util/math/random/Random;DD)D
-
approximatelyEquals
public static boolean approximatelyEquals(float a, float b) - Mappings:
Namespace Name Mixin selector official aLapa;a(FF)Zintermediary method_15347Lnet/minecraft/class_3532;method_15347(FF)Znamed approximatelyEqualsLnet/minecraft/util/math/MathHelper;approximatelyEquals(FF)Z
-
approximatelyEquals
public static boolean approximatelyEquals(double a, double b) - Mappings:
Namespace Name Mixin selector official bLapa;b(DD)Zintermediary method_20390Lnet/minecraft/class_3532;method_20390(DD)Znamed approximatelyEqualsLnet/minecraft/util/math/MathHelper;approximatelyEquals(DD)Z
-
floorMod
public static int floorMod(int dividend, int divisor) - Mappings:
Namespace Name Mixin selector official bLapa;b(II)Iintermediary method_15387Lnet/minecraft/class_3532;method_15387(II)Inamed floorModLnet/minecraft/util/math/MathHelper;floorMod(II)I
-
floorMod
public static float floorMod(float dividend, float divisor) - Mappings:
Namespace Name Mixin selector official bLapa;b(FF)Fintermediary method_15341Lnet/minecraft/class_3532;method_15341(FF)Fnamed floorModLnet/minecraft/util/math/MathHelper;floorMod(FF)F
-
floorMod
public static double floorMod(double dividend, double divisor) - Mappings:
Namespace Name Mixin selector official cLapa;c(DD)Dintermediary method_15367Lnet/minecraft/class_3532;method_15367(DD)Dnamed floorModLnet/minecraft/util/math/MathHelper;floorMod(DD)D
-
isMultipleOf
public static boolean isMultipleOf(int a, int b) - Mappings:
Namespace Name Mixin selector official cLapa;c(II)Zintermediary method_48117Lnet/minecraft/class_3532;method_48117(II)Znamed isMultipleOfLnet/minecraft/util/math/MathHelper;isMultipleOf(II)Z
-
wrapDegrees
public static int wrapDegrees(int degrees) Wraps an angle in degrees to the interval[-180, 180).- Mappings:
Namespace Name Mixin selector official bLapa;b(I)Iintermediary method_15392Lnet/minecraft/class_3532;method_15392(I)Inamed wrapDegreesLnet/minecraft/util/math/MathHelper;wrapDegrees(I)I
-
wrapDegrees
public static float wrapDegrees(float degrees) Wraps an angle in degrees to the interval[-180, 180).- Mappings:
Namespace Name Mixin selector official gLapa;g(F)Fintermediary method_15393Lnet/minecraft/class_3532;method_15393(F)Fnamed wrapDegreesLnet/minecraft/util/math/MathHelper;wrapDegrees(F)F
-
wrapDegrees
public static double wrapDegrees(double degrees) Wraps an angle in degrees to the interval[-180, 180).- Mappings:
Namespace Name Mixin selector official dLapa;d(D)Dintermediary method_15338Lnet/minecraft/class_3532;method_15338(D)Dnamed wrapDegreesLnet/minecraft/util/math/MathHelper;wrapDegrees(D)D
-
subtractAngles
public static float subtractAngles(float start, float end) - Mappings:
Namespace Name Mixin selector official cLapa;c(FF)Fintermediary method_15381Lnet/minecraft/class_3532;method_15381(FF)Fnamed subtractAnglesLnet/minecraft/util/math/MathHelper;subtractAngles(FF)F
-
angleBetween
public static float angleBetween(float first, float second) - Mappings:
Namespace Name Mixin selector official dLapa;d(FF)Fintermediary method_15356Lnet/minecraft/class_3532;method_15356(FF)Fnamed angleBetweenLnet/minecraft/util/math/MathHelper;angleBetween(FF)F
-
clampAngle
public static float clampAngle(float value, float mean, float delta) Clampsvalue, as an angle, betweenmean - deltaandmean + deltadegrees.- Parameters:
value- the value to clampmean- the mean value of the clamp angle rangedelta- the maximum difference allowed from the mean, must not be negative- Returns:
- the clamped
value - Mappings:
Namespace Name Mixin selector official cLapa;c(FFF)Fintermediary method_20306Lnet/minecraft/class_3532;method_20306(FFF)Fnamed clampAngleLnet/minecraft/util/math/MathHelper;clampAngle(FFF)F
-
stepTowards
public static float stepTowards(float from, float to, float step) Steps fromfromtowardsto, changing the value by at moststep.- Mappings:
Namespace Name Mixin selector official dLapa;d(FFF)Fintermediary method_15348Lnet/minecraft/class_3532;method_15348(FFF)Fnamed stepTowardsLnet/minecraft/util/math/MathHelper;stepTowards(FFF)F
-
stepUnwrappedAngleTowards
public static float stepUnwrappedAngleTowards(float from, float to, float step) Steps fromfromdegrees towardstodegrees, changing the value by at moststepdegrees.- Mappings:
Namespace Name Mixin selector official eLapa;e(FFF)Fintermediary method_15388Lnet/minecraft/class_3532;method_15388(FFF)Fnamed stepUnwrappedAngleTowardsLnet/minecraft/util/math/MathHelper;stepUnwrappedAngleTowards(FFF)F
-
parseInt
- Mappings:
Namespace Name Mixin selector official aLapa;a(Ljava/lang/String;I)Iintermediary method_15343Lnet/minecraft/class_3532;method_15343(Ljava/lang/String;I)Inamed parseIntLnet/minecraft/util/math/MathHelper;parseInt(Ljava/lang/String;I)I
-
smallestEncompassingPowerOfTwo
public static int smallestEncompassingPowerOfTwo(int value) - Mappings:
Namespace Name Mixin selector official cLapa;c(I)Iintermediary method_15339Lnet/minecraft/class_3532;method_15339(I)Inamed smallestEncompassingPowerOfTwoLnet/minecraft/util/math/MathHelper;smallestEncompassingPowerOfTwo(I)I
-
isPowerOfTwo
public static boolean isPowerOfTwo(int value) - Mappings:
Namespace Name Mixin selector official dLapa;d(I)Zintermediary method_15352Lnet/minecraft/class_3532;method_15352(I)Znamed isPowerOfTwoLnet/minecraft/util/math/MathHelper;isPowerOfTwo(I)Z
-
ceilLog2
public static int ceilLog2(int value) Returns ceil(log2(value)).The vanilla implementation uses the de Bruijn sequence.
- Parameters:
value- the input value- Returns:
- ceil(log2(
value)) - See Also:
- Mappings:
Namespace Name Mixin selector official eLapa;e(I)Iintermediary method_15342Lnet/minecraft/class_3532;method_15342(I)Inamed ceilLog2Lnet/minecraft/util/math/MathHelper;ceilLog2(I)I
-
floorLog2
public static int floorLog2(int value) Returns floor(log2(value)).The vanilla implementation uses the de Bruijn sequence.
- Parameters:
value- the input value- Returns:
- floor(log2(
value)) - See Also:
- Mappings:
Namespace Name Mixin selector official fLapa;f(I)Iintermediary method_15351Lnet/minecraft/class_3532;method_15351(I)Inamed floorLog2Lnet/minecraft/util/math/MathHelper;floorLog2(I)I
-
packRgb
public static int packRgb(float r, float g, float b) - Mappings:
Namespace Name Mixin selector official fLapa;f(FFF)Iintermediary method_15353Lnet/minecraft/class_3532;method_15353(FFF)Inamed packRgbLnet/minecraft/util/math/MathHelper;packRgb(FFF)I
-
fractionalPart
public static float fractionalPart(float value) - Mappings:
Namespace Name Mixin selector official hLapa;h(F)Fintermediary method_22450Lnet/minecraft/class_3532;method_22450(F)Fnamed fractionalPartLnet/minecraft/util/math/MathHelper;fractionalPart(F)F
-
fractionalPart
public static double fractionalPart(double value) - Mappings:
Namespace Name Mixin selector official eLapa;e(D)Dintermediary method_15385Lnet/minecraft/class_3532;method_15385(D)Dnamed fractionalPartLnet/minecraft/util/math/MathHelper;fractionalPart(D)D
-
hashCode
Deprecated.- Mappings:
Namespace Name Mixin selector official aLapa;a(Lhz;)Jintermediary method_15389Lnet/minecraft/class_3532;method_15389(Lnet/minecraft/class_2382;)Jnamed hashCodeLnet/minecraft/util/math/MathHelper;hashCode(Lnet/minecraft/util/math/Vec3i;)J
-
hashCode
Deprecated.- Mappings:
Namespace Name Mixin selector official bLapa;b(III)Jintermediary method_15371Lnet/minecraft/class_3532;method_15371(III)Jnamed hashCodeLnet/minecraft/util/math/MathHelper;hashCode(III)J
-
randomUuid
- Mappings:
Namespace Name Mixin selector official aLapa;a(Lapf;)Ljava/util/UUID;intermediary method_15378Lnet/minecraft/class_3532;method_15378(Lnet/minecraft/class_5819;)Ljava/util/UUID;named randomUuidLnet/minecraft/util/math/MathHelper;randomUuid(Lnet/minecraft/util/math/random/Random;)Ljava/util/UUID;
-
randomUuid
- Mappings:
Namespace Name Mixin selector official aLapa;a()Ljava/util/UUID;intermediary method_15394Lnet/minecraft/class_3532;method_15394()Ljava/util/UUID;named randomUuidLnet/minecraft/util/math/MathHelper;randomUuid()Ljava/util/UUID;
-
getLerpProgress
public static double getLerpProgress(double value, double start, double end) Gets the fraction of the way thatvalueis betweenstartandend. This is the delta value needed to lerp betweenstartandendto getvalue. In other words,getLerpProgress(lerp(delta, start, end), start, end) == delta.- Parameters:
value- the result of the lerp functionstart- the value interpolated fromend- the value interpolated to- Mappings:
Namespace Name Mixin selector official cLapa;c(DDD)Dintermediary method_15370Lnet/minecraft/class_3532;method_15370(DDD)Dnamed getLerpProgressLnet/minecraft/util/math/MathHelper;getLerpProgress(DDD)D
-
getLerpProgress
public static float getLerpProgress(float value, float start, float end) - Mappings:
Namespace Name Mixin selector official gLapa;g(FFF)Fintermediary method_37960Lnet/minecraft/class_3532;method_37960(FFF)Fnamed getLerpProgressLnet/minecraft/util/math/MathHelper;getLerpProgress(FFF)F
-
method_34945
- Mappings:
Namespace Name Mixin selector official aLapa;a(Leea;Leea;Ledv;)Zintermediary method_34945Lnet/minecraft/class_3532;method_34945(Lnet/minecraft/class_243;Lnet/minecraft/class_243;Lnet/minecraft/class_238;)Znamed method_34945Lnet/minecraft/util/math/MathHelper;method_34945(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Box;)Z
-
atan2
public static double atan2(double y, double x) - Mappings:
Namespace Name Mixin selector official dLapa;d(DD)Dintermediary method_15349Lnet/minecraft/class_3532;method_15349(DD)Dnamed atan2Lnet/minecraft/util/math/MathHelper;atan2(DD)D
-
inverseSqrt
public static float inverseSqrt(float x) - Mappings:
Namespace Name Mixin selector official iLapa;i(F)Fintermediary method_48119Lnet/minecraft/class_3532;method_48119(F)Fnamed inverseSqrtLnet/minecraft/util/math/MathHelper;inverseSqrt(F)F
-
inverseSqrt
public static double inverseSqrt(double x) - Mappings:
Namespace Name Mixin selector official fLapa;f(D)Dintermediary method_48118Lnet/minecraft/class_3532;method_48118(D)Dnamed inverseSqrtLnet/minecraft/util/math/MathHelper;inverseSqrt(D)D
-
fastInverseSqrt
Deprecated.Returns an approximation of1 / Math.sqrt(x).- Returns:
- an approximation of
1 / Math.sqrt(x) - Mappings:
Namespace Name Mixin selector official gLapa;g(D)Dintermediary method_15345Lnet/minecraft/class_3532;method_15345(D)Dnamed fastInverseSqrtLnet/minecraft/util/math/MathHelper;fastInverseSqrt(D)D
-
fastInverseCbrt
public static float fastInverseCbrt(float x) Returns an approximation of1 / Math.cbrt(x).- Returns:
- an approximation of
1 / Math.cbrt(x) - Mappings:
Namespace Name Mixin selector official jLapa;j(F)Fintermediary method_23278Lnet/minecraft/class_3532;method_23278(F)Fnamed fastInverseCbrtLnet/minecraft/util/math/MathHelper;fastInverseCbrt(F)F
-
hsvToRgb
public static int hsvToRgb(float hue, float saturation, float value) - Mappings:
Namespace Name Mixin selector official hLapa;h(FFF)Iintermediary method_15369Lnet/minecraft/class_3532;method_15369(FFF)Inamed hsvToRgbLnet/minecraft/util/math/MathHelper;hsvToRgb(FFF)I
-
idealHash
public static int idealHash(int value) - Mappings:
Namespace Name Mixin selector official gLapa;g(I)Iintermediary method_15354Lnet/minecraft/class_3532;method_15354(I)Inamed idealHashLnet/minecraft/util/math/MathHelper;idealHash(I)I
-
binarySearch
Finds the minimum value in[min, max)that satisfies the monotonicpredicate.The
predicatemust be monotonic, i.e. if for anya,predicate.test(a)istrue, then for allb > a,predicate.test(b)must also betrue.Examples:
binarySearch(3, 7, x -> true)returns3.binarySearch(3, 7, x -> x >= 5)returns5.binarySearch(3, 7, x -> false)returns7.
- Parameters:
min- the minimum value (inclusive) to be testedmax- the maximum value (exclusive) to be testedpredicate- the predicate that returnstruefor integers greater than or equal to the value to be searched for- Returns:
- the minimum value if such value is found, otherwise
max - Mappings:
Namespace Name Mixin selector official aLapa;a(IILjava/util/function/IntPredicate;)Iintermediary method_15360Lnet/minecraft/class_3532;method_15360(IILjava/util/function/IntPredicate;)Inamed binarySearchLnet/minecraft/util/math/MathHelper;binarySearch(IILjava/util/function/IntPredicate;)I
-
lerp
public static int lerp(float delta, int start, int end) - Mappings:
Namespace Name Mixin selector official aLapa;a(FII)Iintermediary method_48781Lnet/minecraft/class_3532;method_48781(FII)Inamed lerpLnet/minecraft/util/math/MathHelper;lerp(FII)I
-
lerp
public static float lerp(float delta, float start, float end) - Mappings:
Namespace Name Mixin selector official iLapa;i(FFF)Fintermediary method_16439Lnet/minecraft/class_3532;method_16439(FFF)Fnamed lerpLnet/minecraft/util/math/MathHelper;lerp(FFF)F
-
lerp
public static double lerp(double delta, double start, double end) - Mappings:
Namespace Name Mixin selector official dLapa;d(DDD)Dintermediary method_16436Lnet/minecraft/class_3532;method_16436(DDD)Dnamed lerpLnet/minecraft/util/math/MathHelper;lerp(DDD)D
-
lerp2
public static double lerp2(double deltaX, double deltaY, double x0y0, double x1y0, double x0y1, double x1y1) 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.- Parameters:
deltaX- the x-coordinate on the unit squaredeltaY- the y-coordinate on the unit squarex0y0- the output ifdeltaXis 0 anddeltaYis 0x1y0- the output ifdeltaXis 1 anddeltaYis 0x0y1- the output ifdeltaXis 0 anddeltaYis 1x1y1- the output ifdeltaXis 1 anddeltaYis 1- Mappings:
Namespace Name Mixin selector official aLapa;a(DDDDDD)Dintermediary method_16437Lnet/minecraft/class_3532;method_16437(DDDDDD)Dnamed lerp2Lnet/minecraft/util/math/MathHelper;lerp2(DDDDDD)D
-
lerp3
public static double lerp3(double deltaX, double deltaY, double deltaZ, double x0y0z0, double x1y0z0, double x0y1z0, double x1y1z0, double x0y0z1, double x1y0z1, double x0y1z1, double x1y1z1) 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.- Parameters:
deltaX- the x-coordinate on the unit cubedeltaY- the y-coordinate on the unit cubedeltaZ- the z-coordinate on the unit cubex0y0z0- the output ifdeltaXis 0,deltaYis 0 anddeltaZis 0x1y0z0- the output ifdeltaXis 1,deltaYis 0 anddeltaZis 0x0y1z0- the output ifdeltaXis 0,deltaYis 1 anddeltaZis 0x1y1z0- the output ifdeltaXis 1,deltaYis 1 anddeltaZis 0x0y0z1- the output ifdeltaXis 0,deltaYis 0 anddeltaZis 1x1y0z1- the output ifdeltaXis 1,deltaYis 0 anddeltaZis 1x0y1z1- the output ifdeltaXis 0,deltaYis 1 anddeltaZis 1x1y1z1- the output ifdeltaXis 1,deltaYis 1 anddeltaZis 1- Mappings:
Namespace Name Mixin selector official aLapa;a(DDDDDDDDDDD)Dintermediary method_16438Lnet/minecraft/class_3532;method_16438(DDDDDDDDDDD)Dnamed lerp3Lnet/minecraft/util/math/MathHelper;lerp3(DDDDDDDDDDD)D
-
catmullRom
public static float catmullRom(float delta, float p0, float p1, float p2, float p3) Interpolates a point on a Catmull-Rom Spline. This spline has a property that if there are two splines with argumentsp0, p1, p2, p3andp1, p2, p3, p4, the resulting curve will have a continuous first derivative atp2, where the two input curves connect. For higher-dimensional curves, the interpolation on the curve is done component-wise: for inputsdelta, (p0x, p0y), (p1x, p1y), (p2x, p2y), (p3x, p3y), the output is(catmullRom(delta, p0x, p1x, p2x, p3x), catmullRom(delta, p0y, p1y, p2y, p3y)).- Parameters:
delta- the progress along the interpolationp0- the previous data point to assist in curve-smoothingp1- the output ifdeltais 0p2- the output ifdeltais 1p3- the next data point to assist in curve-smoothing- See Also:
- Mappings:
Namespace Name Mixin selector official aLapa;a(FFFFF)Fintermediary method_41303Lnet/minecraft/class_3532;method_41303(FFFFF)Fnamed catmullRomLnet/minecraft/util/math/MathHelper;catmullRom(FFFFF)F
-
perlinFade
public static double perlinFade(double value) - Mappings:
Namespace Name Mixin selector official hLapa;h(D)Dintermediary method_16435Lnet/minecraft/class_3532;method_16435(D)Dnamed perlinFadeLnet/minecraft/util/math/MathHelper;perlinFade(D)D
-
perlinFadeDerivative
public static double perlinFadeDerivative(double value) - Mappings:
Namespace Name Mixin selector official iLapa;i(D)Dintermediary method_34956Lnet/minecraft/class_3532;method_34956(D)Dnamed perlinFadeDerivativeLnet/minecraft/util/math/MathHelper;perlinFadeDerivative(D)D
-
sign
public static int sign(double value) - Mappings:
Namespace Name Mixin selector official jLapa;j(D)Iintermediary method_17822Lnet/minecraft/class_3532;method_17822(D)Inamed signLnet/minecraft/util/math/MathHelper;sign(D)I
-
lerpAngleDegrees
public static float lerpAngleDegrees(float delta, float start, float end) - Mappings:
Namespace Name Mixin selector official jLapa;j(FFF)Fintermediary method_17821Lnet/minecraft/class_3532;method_17821(FFF)Fnamed lerpAngleDegreesLnet/minecraft/util/math/MathHelper;lerpAngleDegrees(FFF)F
-
wrap
public static float wrap(float value, float maxDeviation) - Mappings:
Namespace Name Mixin selector official eLapa;e(FF)Fintermediary method_24504Lnet/minecraft/class_3532;method_24504(FF)Fnamed wrapLnet/minecraft/util/math/MathHelper;wrap(FF)F
-
square
public static float square(float n) - Mappings:
Namespace Name Mixin selector official kLapa;k(F)Fintermediary method_27285Lnet/minecraft/class_3532;method_27285(F)Fnamed squareLnet/minecraft/util/math/MathHelper;square(F)F
-
square
public static double square(double n) - Mappings:
Namespace Name Mixin selector official kLapa;k(D)Dintermediary method_33723Lnet/minecraft/class_3532;method_33723(D)Dnamed squareLnet/minecraft/util/math/MathHelper;square(D)D
-
square
public static int square(int n) - Mappings:
Namespace Name Mixin selector official hLapa;h(I)Iintermediary method_34954Lnet/minecraft/class_3532;method_34954(I)Inamed squareLnet/minecraft/util/math/MathHelper;square(I)I
-
square
public static long square(long n) - Mappings:
Namespace Name Mixin selector official aLapa;a(J)Jintermediary method_38652Lnet/minecraft/class_3532;method_38652(J)Jnamed squareLnet/minecraft/util/math/MathHelper;square(J)J
-
clampedMap
public static double clampedMap(double value, double oldStart, double oldEnd, double newStart, double newEnd) Linearly maps a value from one number range to another and clamps the result.- Parameters:
value- the input valueoldStart- the starting value of the original rangeoldEnd- the end value of the original rangenewStart- the starting value of the new rangenewEnd- the end value of the new range- Returns:
- the mapped value, clamped between
newStartandnewEnd - See Also:
- Mappings:
Namespace Name Mixin selector official aLapa;a(DDDDD)Dintermediary method_32854Lnet/minecraft/class_3532;method_32854(DDDDD)Dnamed clampedMapLnet/minecraft/util/math/MathHelper;clampedMap(DDDDD)D
-
clampedMap
public static float clampedMap(float value, float oldStart, float oldEnd, float newStart, float newEnd) Linearly maps a value from one number range to another and clamps the result.- Parameters:
value- the input valueoldStart- the starting value of the original rangeoldEnd- the end value of the original rangenewStart- the starting value of the new rangenewEnd- the end value of the new range- Returns:
- the mapped value, clamped between
newStartandnewEnd - See Also:
- Mappings:
Namespace Name Mixin selector official bLapa;b(FFFFF)Fintermediary method_37958Lnet/minecraft/class_3532;method_37958(FFFFF)Fnamed clampedMapLnet/minecraft/util/math/MathHelper;clampedMap(FFFFF)F
-
map
public static double map(double value, double oldStart, double oldEnd, double newStart, double newEnd) Linearly maps a value from one number range to another, unclamped.For the return value
result,getLerpProgress(value, oldStart, oldEnd)is approximately equal togetLerpProgress(result, newStart, newEnd)(accounting for floating point errors).- Parameters:
value- the input valueoldStart- the starting value of the original rangeoldEnd- the end value of the original rangenewStart- the starting value of the new rangenewEnd- the end value of the new range- Returns:
- the mapped value
- Mappings:
Namespace Name Mixin selector official bLapa;b(DDDDD)Dintermediary method_33722Lnet/minecraft/class_3532;method_33722(DDDDD)Dnamed mapLnet/minecraft/util/math/MathHelper;map(DDDDD)D
-
map
public static float map(float value, float oldStart, float oldEnd, float newStart, float newEnd) Linearly maps a value from one number range to another, unclamped.For the return value
result,getLerpProgress(value, oldStart, oldEnd)is approximately equal togetLerpProgress(result, newStart, newEnd)(accounting for floating point errors).- Parameters:
value- the input valueoldStart- the starting value of the original rangeoldEnd- the end value of the original rangenewStart- the starting value of the new rangenewEnd- the end value of the new range- Returns:
- the mapped value
- Mappings:
Namespace Name Mixin selector official cLapa;c(FFFFF)Fintermediary method_37959Lnet/minecraft/class_3532;method_37959(FFFFF)Fnamed mapLnet/minecraft/util/math/MathHelper;map(FFFFF)F
-
method_34957
public static double method_34957(double double2) - Mappings:
Namespace Name Mixin selector official lLapa;l(D)Dintermediary method_34957Lnet/minecraft/class_3532;method_34957(D)Dnamed method_34957Lnet/minecraft/util/math/MathHelper;method_34957(D)D
-
roundUpToMultiple
public static int roundUpToMultiple(int value, int divisor) Returns a value farther than or as far asvaluefrom zero that is a multiple ofdivisor.- Mappings:
Namespace Name Mixin selector official dLapa;d(II)Iintermediary method_28139Lnet/minecraft/class_3532;method_28139(II)Inamed roundUpToMultipleLnet/minecraft/util/math/MathHelper;roundUpToMultiple(II)I
-
ceilDiv
public static int ceilDiv(int a, int b) - Mappings:
Namespace Name Mixin selector official eLapa;e(II)Iintermediary method_38788Lnet/minecraft/class_3532;method_38788(II)Inamed ceilDivLnet/minecraft/util/math/MathHelper;ceilDiv(II)I
-
nextBetween
Returns a random, uniformly distributed integer value in[min, max].- Parameters:
min- the minimum value, inclusivemax- the maximum value, inclusive- Returns:
- a random, uniformly distributed integer value in
[min, max] - Throws:
IllegalArgumentException- if the range is empty (i.e.max < min)- Mappings:
Namespace Name Mixin selector official bLapa;b(Lapf;II)Iintermediary method_32751Lnet/minecraft/class_3532;method_32751(Lnet/minecraft/class_5819;II)Inamed nextBetweenLnet/minecraft/util/math/MathHelper;nextBetween(Lnet/minecraft/util/math/random/Random;II)I
-
nextBetween
- Mappings:
Namespace Name Mixin selector official bLapa;b(Lapf;FF)Fintermediary method_32750Lnet/minecraft/class_3532;method_32750(Lnet/minecraft/class_5819;FF)Fnamed nextBetweenLnet/minecraft/util/math/MathHelper;nextBetween(Lnet/minecraft/util/math/random/Random;FF)F
-
nextGaussian
- Mappings:
Namespace Name Mixin selector official cLapa;c(Lapf;FF)Fintermediary method_32855Lnet/minecraft/class_3532;method_32855(Lnet/minecraft/class_5819;FF)Fnamed nextGaussianLnet/minecraft/util/math/MathHelper;nextGaussian(Lnet/minecraft/util/math/random/Random;FF)F
-
squaredHypot
public static double squaredHypot(double a, double b) - Mappings:
Namespace Name Mixin selector official eLapa;e(DD)Dintermediary method_41189Lnet/minecraft/class_3532;method_41189(DD)Dnamed squaredHypotLnet/minecraft/util/math/MathHelper;squaredHypot(DD)D
-
hypot
public static double hypot(double a, double b) - Mappings:
Namespace Name Mixin selector official fLapa;f(DD)Dintermediary method_39241Lnet/minecraft/class_3532;method_39241(DD)Dnamed hypotLnet/minecraft/util/math/MathHelper;hypot(DD)D
-
squaredMagnitude
public static double squaredMagnitude(double a, double b, double c) - Mappings:
Namespace Name Mixin selector official eLapa;e(DDD)Dintermediary method_41190Lnet/minecraft/class_3532;method_41190(DDD)Dnamed squaredMagnitudeLnet/minecraft/util/math/MathHelper;squaredMagnitude(DDD)D
-
magnitude
public static double magnitude(double a, double b, double c) - Mappings:
Namespace Name Mixin selector official fLapa;f(DDD)Dintermediary method_33825Lnet/minecraft/class_3532;method_33825(DDD)Dnamed magnitudeLnet/minecraft/util/math/MathHelper;magnitude(DDD)D
-
roundDownToMultiple
public static int roundDownToMultiple(double a, int b) Returnsarounded down to the nearest multiple ofb.- Returns:
arounded down to the nearest multiple ofb- Mappings:
Namespace Name Mixin selector official aLapa;a(DI)Iintermediary method_38961Lnet/minecraft/class_3532;method_38961(DI)Inamed roundDownToMultipleLnet/minecraft/util/math/MathHelper;roundDownToMultiple(DI)I
-
stream
- Mappings:
Namespace Name Mixin selector official cLapa;c(III)Ljava/util/stream/IntStream;intermediary method_42120Lnet/minecraft/class_3532;method_42120(III)Ljava/util/stream/IntStream;named streamLnet/minecraft/util/math/MathHelper;stream(III)Ljava/util/stream/IntStream;
-
stream
- Mappings:
Namespace Name Mixin selector official aLapa;a(IIII)Ljava/util/stream/IntStream;intermediary method_42117Lnet/minecraft/class_3532;method_42117(IIII)Ljava/util/stream/IntStream;named streamLnet/minecraft/util/math/MathHelper;stream(IIII)Ljava/util/stream/IntStream;
-