Package net.minecraft.util
Class Mth
java.lang.Object
net.minecraft.util.Mth
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final double[]
private static final double[]
static final float
static final float
private static final double
private static final int
static final float
private static final int
private static final int[]
private static final double
static final float
static final float
private static final RandomSource
private static final float[]
private static final float
static final float
static final float
private static final long
private static final long
private static final long
private static final long
static final org.joml.Vector3f
static final org.joml.Vector3f
static final org.joml.Vector3f
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic float
abs
(float p_14155_) static int
abs
(int p_14041_) static double
absMax
(double p_14006_, double p_14007_) static float
approach
(float p_14122_, float p_14123_, float p_14124_) static float
approachDegrees
(float p_14149_, float p_14150_, float p_14151_) static double
atan2
(double p_14137_, double p_14138_) static int
binarySearch
(int p_14050_, int p_14051_, IntPredicate p_14052_) static float
catmullrom
(float p_216245_, float p_216246_, float p_216247_, float p_216248_, float p_216249_) static int
ceil
(double p_14166_) static int
ceil
(float p_14168_) static int
ceillog2
(int p_14164_) static double
clamp
(double p_14009_, double p_14010_, double p_14011_) static float
clamp
(float p_14037_, float p_14038_, float p_14039_) static int
clamp
(int p_14046_, int p_14047_, int p_14048_) static long
clamp
(long p_298408_, long p_298924_, long p_298326_) static double
clampedLerp
(double p_14086_, double p_14087_, double p_14088_) static float
clampedLerp
(float p_144921_, float p_144922_, float p_144923_) static double
clampedMap
(double p_144852_, double p_144853_, double p_144854_, double p_144855_, double p_144856_) static float
clampedMap
(float p_184632_, float p_184633_, float p_184634_, float p_184635_, float p_184636_) static int
color
(float p_14160_, float p_14161_, float p_14162_) static float
cos
(float p_14090_) static UUID
static UUID
createInsecureUUID
(RandomSource p_216262_) static float
degreesDifference
(float p_14119_, float p_14120_) static float
degreesDifferenceAbs
(float p_14146_, float p_14147_) static boolean
equal
(double p_14083_, double p_14084_) static boolean
equal
(float p_14034_, float p_14035_) static float
fastInvCubeRoot
(float p_14200_) static double
fastInvSqrt
(double p_14194_) Deprecated.static int
floor
(double p_14108_) static int
floor
(float p_14144_) static int
floorDiv
(int p_14043_, int p_14044_) static double
frac
(double p_14186_) static float
frac
(float p_14188_) static int
static long
getSeed
(int p_14131_, int p_14132_, int p_14133_) Deprecated.static long
Deprecated.static int
hsvToRgb
(float p_14170_, float p_14171_, float p_14172_) static double
inverseLerp
(double p_14113_, double p_14114_, double p_14115_) static float
inverseLerp
(float p_184656_, float p_184657_, float p_184658_) static double
invSqrt
(double p_265088_) static float
invSqrt
(float p_265060_) static boolean
isMultipleOf
(int p_265754_, int p_265543_) static boolean
isPowerOfTwo
(int p_14153_) static double
length
(double p_184646_, double p_184647_) static double
length
(double p_184649_, double p_184650_, double p_184651_) static double
lengthSquared
(double p_211590_, double p_211591_) static double
lengthSquared
(double p_211593_, double p_211594_, double p_211595_) static double
lerp
(double p_14140_, double p_14141_, double p_14142_) static float
lerp
(float p_14180_, float p_14181_, float p_14182_) static double
lerp2
(double p_14013_, double p_14014_, double p_14015_, double p_14016_, double p_14017_, double p_14018_) static double
lerp3
(double p_14020_, double p_14021_, double p_14022_, double p_14023_, double p_14024_, double p_14025_, double p_14026_, double p_14027_, double p_14028_, double p_14029_, double p_14030_) static int
lerpDiscrete
(float p_299072_, int p_298417_, int p_299185_) static int
lerpInt
(float p_270245_, int p_270597_, int p_270301_) static long
lfloor
(double p_14135_) static int
log2
(int p_14174_) static double
map
(double p_144915_, double p_144916_, double p_144917_, double p_144918_, double p_144919_) static float
map
(float p_184638_, float p_184639_, float p_184640_, float p_184641_, float p_184642_) static int
mulAndTruncate
(org.apache.commons.lang3.math.Fraction p_339645_, int p_339636_) static int
murmurHash3Mixer
(int p_14184_) static double
nextDouble
(RandomSource p_216264_, double p_216265_, double p_216266_) static float
nextFloat
(RandomSource p_216268_, float p_216269_, float p_216270_) static int
nextInt
(RandomSource p_216272_, int p_216273_, int p_216274_) static float
normal
(RandomSource p_216292_, float p_216293_, float p_216294_) static IntStream
outFromOrigin
(int p_216296_, int p_216297_, int p_216298_) static IntStream
outFromOrigin
(int p_216251_, int p_216252_, int p_216253_, int p_216254_) static int
positiveCeilDiv
(int p_184653_, int p_184654_) static double
positiveModulo
(double p_14110_, double p_14111_) static float
positiveModulo
(float p_14092_, float p_14093_) static int
positiveModulo
(int p_14101_, int p_14102_) static int
quantize
(double p_184629_, int p_184630_) static float
randomBetween
(RandomSource p_216284_, float p_216285_, float p_216286_) static int
randomBetweenInclusive
(RandomSource p_216288_, int p_216289_, int p_216290_) static boolean
rayIntersectsAABB
(Vec3 p_144889_, Vec3 p_144890_, AABB p_144891_) static float
rotateIfNecessary
(float p_14095_, float p_14096_, float p_14097_) static org.joml.Quaternionf
rotationAroundAxis
(org.joml.Vector3f p_304469_, org.joml.Quaternionf p_304737_, org.joml.Quaternionf p_304773_) static double
rotLerp
(double p_296301_, double p_294715_, double p_295496_) static float
rotLerp
(float p_14190_, float p_14191_, float p_14192_) static int
roundToward
(int p_144942_, int p_144943_) static int
sign
(double p_14206_) static float
sin
(float p_14032_) static int
smallestEncompassingPowerOfTwo
(int p_14126_) static double
smoothstep
(double p_14198_) static double
smoothstepDerivative
(double p_144947_) static float
sqrt
(float p_14117_) static double
square
(double p_144953_) static float
square
(float p_14208_) static int
square
(int p_144945_) static long
square
(long p_184644_) static float
triangleWave
(float p_14157_, float p_14158_) static double
wobble
(double p_144955_) static double
wrapDegrees
(double p_14176_) static float
wrapDegrees
(float p_14178_) static int
wrapDegrees
(int p_14099_)
-
Field Details
-
UUID_VERSION
private static final long UUID_VERSION- See Also:
-
UUID_VERSION_TYPE_4
private static final long UUID_VERSION_TYPE_4- See Also:
-
UUID_VARIANT
private static final long UUID_VARIANT- See Also:
-
UUID_VARIANT_2
private static final long UUID_VARIANT_2- See Also:
-
PI
public static final float PI- See Also:
-
HALF_PI
public static final float HALF_PI- See Also:
-
TWO_PI
public static final float TWO_PI- See Also:
-
DEG_TO_RAD
public static final float DEG_TO_RAD- See Also:
-
RAD_TO_DEG
public static final float RAD_TO_DEG- See Also:
-
EPSILON
public static final float EPSILON- See Also:
-
SQRT_OF_TWO
public static final float SQRT_OF_TWO -
SIN_SCALE
private static final float SIN_SCALE- See Also:
-
Y_AXIS
public static final org.joml.Vector3f Y_AXIS -
X_AXIS
public static final org.joml.Vector3f X_AXIS -
Z_AXIS
public static final org.joml.Vector3f Z_AXIS -
SIN
private static final float[] SIN -
RANDOM
-
MULTIPLY_DE_BRUIJN_BIT_POSITION
private static final int[] MULTIPLY_DE_BRUIJN_BIT_POSITION -
ONE_SIXTH
private static final double ONE_SIXTH- See Also:
-
FRAC_EXP
private static final int FRAC_EXP- See Also:
-
LUT_SIZE
private static final int LUT_SIZE- See Also:
-
FRAC_BIAS
private static final double FRAC_BIAS -
ASIN_TAB
private static final double[] ASIN_TAB -
COS_TAB
private static final double[] COS_TAB
-
-
Constructor Details
-
Mth
public Mth()
-
-
Method Details
-
sin
public static float sin(float p_14032_) -
cos
public static float cos(float p_14090_) -
sqrt
public static float sqrt(float p_14117_) -
floor
public static int floor(float p_14144_) -
floor
public static int floor(double p_14108_) -
lfloor
public static long lfloor(double p_14135_) -
abs
public static float abs(float p_14155_) -
abs
public static int abs(int p_14041_) -
ceil
public static int ceil(float p_14168_) -
ceil
public static int ceil(double p_14166_) -
clamp
public static int clamp(int p_14046_, int p_14047_, int p_14048_) -
clamp
public static long clamp(long p_298408_, long p_298924_, long p_298326_) -
clamp
public static float clamp(float p_14037_, float p_14038_, float p_14039_) -
clamp
public static double clamp(double p_14009_, double p_14010_, double p_14011_) -
clampedLerp
public static double clampedLerp(double p_14086_, double p_14087_, double p_14088_) -
clampedLerp
public static float clampedLerp(float p_144921_, float p_144922_, float p_144923_) -
absMax
public static double absMax(double p_14006_, double p_14007_) -
floorDiv
public static int floorDiv(int p_14043_, int p_14044_) -
nextInt
-
nextFloat
-
nextDouble
-
equal
public static boolean equal(float p_14034_, float p_14035_) -
equal
public static boolean equal(double p_14083_, double p_14084_) -
positiveModulo
public static int positiveModulo(int p_14101_, int p_14102_) -
positiveModulo
public static float positiveModulo(float p_14092_, float p_14093_) -
positiveModulo
public static double positiveModulo(double p_14110_, double p_14111_) -
isMultipleOf
public static boolean isMultipleOf(int p_265754_, int p_265543_) -
wrapDegrees
public static int wrapDegrees(int p_14099_) -
wrapDegrees
public static float wrapDegrees(float p_14178_) -
wrapDegrees
public static double wrapDegrees(double p_14176_) -
degreesDifference
public static float degreesDifference(float p_14119_, float p_14120_) -
degreesDifferenceAbs
public static float degreesDifferenceAbs(float p_14146_, float p_14147_) -
rotateIfNecessary
public static float rotateIfNecessary(float p_14095_, float p_14096_, float p_14097_) -
approach
public static float approach(float p_14122_, float p_14123_, float p_14124_) -
approachDegrees
public static float approachDegrees(float p_14149_, float p_14150_, float p_14151_) -
getInt
-
smallestEncompassingPowerOfTwo
public static int smallestEncompassingPowerOfTwo(int p_14126_) -
isPowerOfTwo
public static boolean isPowerOfTwo(int p_14153_) -
ceillog2
public static int ceillog2(int p_14164_) -
log2
public static int log2(int p_14174_) -
color
public static int color(float p_14160_, float p_14161_, float p_14162_) -
frac
public static float frac(float p_14188_) -
frac
public static double frac(double p_14186_) -
getSeed
Deprecated. -
getSeed
Deprecated. -
createInsecureUUID
-
createInsecureUUID
-
inverseLerp
public static double inverseLerp(double p_14113_, double p_14114_, double p_14115_) -
inverseLerp
public static float inverseLerp(float p_184656_, float p_184657_, float p_184658_) -
rayIntersectsAABB
-
atan2
public static double atan2(double p_14137_, double p_14138_) -
invSqrt
public static float invSqrt(float p_265060_) -
invSqrt
public static double invSqrt(double p_265088_) -
fastInvSqrt
Deprecated. -
fastInvCubeRoot
public static float fastInvCubeRoot(float p_14200_) -
hsvToRgb
public static int hsvToRgb(float p_14170_, float p_14171_, float p_14172_) -
murmurHash3Mixer
public static int murmurHash3Mixer(int p_14184_) -
binarySearch
-
lerpInt
public static int lerpInt(float p_270245_, int p_270597_, int p_270301_) -
lerpDiscrete
public static int lerpDiscrete(float p_299072_, int p_298417_, int p_299185_) -
lerp
public static float lerp(float p_14180_, float p_14181_, float p_14182_) -
lerp
public static double lerp(double p_14140_, double p_14141_, double p_14142_) -
lerp2
public static double lerp2(double p_14013_, double p_14014_, double p_14015_, double p_14016_, double p_14017_, double p_14018_) -
lerp3
public static double lerp3(double p_14020_, double p_14021_, double p_14022_, double p_14023_, double p_14024_, double p_14025_, double p_14026_, double p_14027_, double p_14028_, double p_14029_, double p_14030_) -
catmullrom
public static float catmullrom(float p_216245_, float p_216246_, float p_216247_, float p_216248_, float p_216249_) -
smoothstep
public static double smoothstep(double p_14198_) -
smoothstepDerivative
public static double smoothstepDerivative(double p_144947_) -
sign
public static int sign(double p_14206_) -
rotLerp
public static float rotLerp(float p_14190_, float p_14191_, float p_14192_) -
rotLerp
public static double rotLerp(double p_296301_, double p_294715_, double p_295496_) -
triangleWave
public static float triangleWave(float p_14157_, float p_14158_) -
square
public static float square(float p_14208_) -
square
public static double square(double p_144953_) -
square
public static int square(int p_144945_) -
square
public static long square(long p_184644_) -
clampedMap
public static double clampedMap(double p_144852_, double p_144853_, double p_144854_, double p_144855_, double p_144856_) -
clampedMap
public static float clampedMap(float p_184632_, float p_184633_, float p_184634_, float p_184635_, float p_184636_) -
map
public static double map(double p_144915_, double p_144916_, double p_144917_, double p_144918_, double p_144919_) -
map
public static float map(float p_184638_, float p_184639_, float p_184640_, float p_184641_, float p_184642_) -
wobble
public static double wobble(double p_144955_) -
roundToward
public static int roundToward(int p_144942_, int p_144943_) -
positiveCeilDiv
public static int positiveCeilDiv(int p_184653_, int p_184654_) -
randomBetweenInclusive
-
randomBetween
-
normal
-
lengthSquared
public static double lengthSquared(double p_211590_, double p_211591_) -
length
public static double length(double p_184646_, double p_184647_) -
lengthSquared
public static double lengthSquared(double p_211593_, double p_211594_, double p_211595_) -
length
public static double length(double p_184649_, double p_184650_, double p_184651_) -
quantize
public static int quantize(double p_184629_, int p_184630_) -
outFromOrigin
-
outFromOrigin
-
rotationAroundAxis
public static org.joml.Quaternionf rotationAroundAxis(org.joml.Vector3f p_304469_, org.joml.Quaternionf p_304737_, org.joml.Quaternionf p_304773_) -
mulAndTruncate
public static int mulAndTruncate(org.apache.commons.lang3.math.Fraction p_339645_, int p_339636_)
-