Package net.minecraft.util
Class Mth
java.lang.Object
net.minecraft.util.Mth
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final double[]
private static final float
private static final int
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic float
abs
(float p_14155_) static int
abs
(int p_14041_) static int
absFloor
(double p_144940_) 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 double
average
(long[] p_14079_) static int
binarySearch
(int p_14050_, int p_14051_, IntPredicate p_14052_) static double[]
binBiModalNormalDistribution
(double p_144858_, double p_144859_, double p_144860_, double p_144861_, double p_144862_, double p_144863_, int p_144864_, int p_144865_) static double[]
binLogDistribution
(double p_144873_, double p_144874_, int p_144875_, int p_144876_) static double[]
binNormalDistribution
(double p_144867_, double p_144868_, double p_144869_, int p_144870_, int p_144871_) static float
catmullrom
(float p_216245_, float p_216246_, float p_216247_, float p_216248_, float p_216249_) static Vec3
catmullRomSplinePos
(Vec3 p_144893_, Vec3 p_144894_, Vec3 p_144895_, Vec3 p_144896_, double p_144897_) static int
ceil
(double p_14166_) static int
ceil
(float p_14168_) static int
ceillog2
(int p_14164_) static byte
clamp
(byte p_144848_, byte p_144849_, byte p_144850_) 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_14054_, long p_14055_, long p_14056_) 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 int
color
(int p_14104_, int p_14105_, int p_14106_) static int
colorMultiply
(int p_144882_, float p_144883_, float p_144884_, float p_144885_) static int
colorMultiply
(int p_144933_, int p_144934_) static float
cos
(float p_14090_) static UUID
static UUID
createInsecureUUID
(RandomSource p_216262_) static float
cube
(float p_216300_) static double[]
cumulativeSum
(double... p_144913_) static float
degreesDifference
(float p_14119_, float p_14120_) static float
degreesDifferenceAbs
(float p_14146_, float p_14147_) static float
diffuseLight
(float p_144949_, float p_144950_, float p_144951_) static boolean
equal
(double p_14083_, double p_14084_) static boolean
equal
(float p_14034_, float p_14035_) static int
fastFloor
(double p_14081_) static float
fastInvCubeRoot
(float p_14200_) static double
fastInvSqrt
(double p_14194_) static float
fastInvSqrt
(float p_14196_) static int
floor
(double p_14108_) static int
floor
(float p_14144_) static double
frac
(double p_14186_) static float
frac
(float p_14188_) static double
static double
static int
static int
static int
getRandomForDistributionIntegral
(RandomSource p_216276_, double[] p_216277_) static long
getSeed
(int p_14131_, int p_14132_, int p_14133_) static long
static int
hsvToRgb
(float p_14170_, float p_14171_, float p_14172_) static int
intFloorDiv
(int p_14043_, int p_14044_) 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 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 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
murmurHash3Mixer
(int p_14184_) static long
murmurHash3Mixer
(long p_144887_) 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 float
rotlerp
(float p_14202_, float p_14203_, float p_14204_) Deprecated.static float
rotLerp
(float p_14190_, float p_14191_, float p_14192_) static float
rotWrap
(double p_14210_) Deprecated.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
-
BIG_ENOUGH_INT
private static final int BIG_ENOUGH_INT- See Also:
-
BIG_ENOUGH_FLOAT
private static final float BIG_ENOUGH_FLOAT- See Also:
-
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:
-
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_) -
fastFloor
public static int fastFloor(double p_14081_) -
floor
public static int floor(double p_14108_) -
lfloor
public static long lfloor(double p_14135_) -
absFloor
public static int absFloor(double p_144940_) -
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 byte clamp(byte p_144848_, byte p_144849_, byte p_144850_) -
clamp
public static int clamp(int p_14046_, int p_14047_, int p_14048_) -
clamp
public static long clamp(long p_14054_, long p_14055_, long p_14056_) -
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_) -
intFloorDiv
public static int intFloorDiv(int p_14043_, int p_14044_) -
nextInt
-
nextFloat
-
nextDouble
-
average
public static double average(long[] p_14079_) -
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_) -
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
-
getInt
-
getDouble
-
getDouble
-
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_) -
color
public static int color(int p_14104_, int p_14105_, int p_14106_) -
colorMultiply
public static int colorMultiply(int p_144933_, int p_144934_) -
colorMultiply
public static int colorMultiply(int p_144882_, float p_144883_, float p_144884_, float p_144885_) -
frac
public static float frac(float p_14188_) -
frac
public static double frac(double p_14186_) -
catmullRomSplinePos
-
getSeed
-
getSeed
public static long getSeed(int p_14131_, int p_14132_, int p_14133_) -
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_) -
fastInvSqrt
public static float fastInvSqrt(float p_14196_) -
fastInvSqrt
public static double fastInvSqrt(double p_14194_) -
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_) -
murmurHash3Mixer
public static long murmurHash3Mixer(long p_144887_) -
cumulativeSum
public static double[] cumulativeSum(double... p_144913_) -
getRandomForDistributionIntegral
-
binNormalDistribution
public static double[] binNormalDistribution(double p_144867_, double p_144868_, double p_144869_, int p_144870_, int p_144871_) -
binBiModalNormalDistribution
public static double[] binBiModalNormalDistribution(double p_144858_, double p_144859_, double p_144860_, double p_144861_, double p_144862_, double p_144863_, int p_144864_, int p_144865_) -
binLogDistribution
public static double[] binLogDistribution(double p_144873_, double p_144874_, int p_144875_, int p_144876_) -
binarySearch
-
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_) -
diffuseLight
public static float diffuseLight(float p_144949_, float p_144950_, float p_144951_) -
rotlerp
Deprecated. -
rotWrap
Deprecated. -
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_) -
cube
public static float cube(float p_216300_) -
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
-