类 Mth
java.lang.Object
net.minecraft.util.Mth
-
字段概要
字段修饰符和类型字段说明private 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 float
abs
(float pValue) static int
abs
(int pValue) static double
absMax
(double pX, double pY) static float
approach
(float pValue, float pLimit, float pStepSize) static float
approachDegrees
(float pAngle, float pLimit, float pStepSize) static double
atan2
(double pY, double pX) static int
binarySearch
(int pMin, int pMax, IntPredicate pIsTargetBeforeOrAt) static float
catmullrom
(float pDelta, float pControlPoint1, float pControlPoint2, float pControlPoint3, float pControlPoint4) static int
ceil
(double pValue) static int
ceil
(float pValue) static int
ceillog2
(int pValue) static double
clamp
(double pValue, double pMin, double pMax) static float
clamp
(float pValue, float pMin, float pMax) static int
clamp
(int pValue, int pMin, int pMax) static double
clampedLerp
(double pStart, double pEnd, double pDelta) static float
clampedLerp
(float pStart, float pEnd, float pDelta) static double
clampedMap
(double pInput, double pInputMin, double pInputMax, double pOuputMin, double pOutputMax) static float
clampedMap
(float pInput, float pInputMin, float pInputMax, float pOutputMin, float pOutputMax) static int
color
(float pR, float pG, float pB) static float
cos
(float pValue) static UUID
static UUID
createInsecureUUID
(RandomSource pRandom) static float
degreesDifference
(float pStart, float pEnd) static float
degreesDifferenceAbs
(float pStart, float pEnd) static boolean
equal
(double pX, double pY) static boolean
equal
(float pX, float pY) static float
fastInvCubeRoot
(float pNumber) static double
fastInvSqrt
(double pNumber) 已过时。static int
floor
(double pValue) static int
floor
(float pValue) static int
floorDiv
(int pDividend, int pDivisor) static double
frac
(double pNumber) static float
frac
(float pNumber) static int
static long
getSeed
(int pX, int pY, int pZ) 已过时。static long
已过时。static int
hsvToRgb
(float pHue, float pSaturation, float pValue) static double
inverseLerp
(double pDelta, double pStart, double pEnd) static float
inverseLerp
(float pDelta, float pStart, float pEnd) static double
invSqrt
(double pNumber) static float
invSqrt
(float pNumber) static boolean
isMultipleOf
(int pNumber, int pMultiple) static boolean
isPowerOfTwo
(int pValue) static double
length
(double pXDistance, double pYDistance) static double
length
(double pXDistance, double pYDistance, double pZDistance) static double
lengthSquared
(double pXDistance, double pYDistance) static double
lengthSquared
(double pXDistance, double pYDistance, double pZDistance) static double
lerp
(double pDelta, double pStart, double pEnd) static float
lerp
(float pDelta, float pStart, float pEnd) static double
lerp2
(double pDelta1, double pDelta2, double pStart1, double pEnd1, double pStart2, double pEnd2) static double
lerp3
(double pDelta1, double pDelta2, double pDelta3, double pStart1, double pEnd1, double pStart2, double pEnd2, double pStart3, double pEnd3, double pStart4, double pEnd4) static int
lerpInt
(float pDelta, int pStart, int pEnd) static long
lfloor
(double pValue) static int
log2
(int pValue) static double
map
(double pInput, double pInputMin, double pInputMax, double pOutputMin, double pOutputMax) static float
map
(float pInput, float pInputMin, float pInputMax, float pOutputMin, float pOutputMax) static int
murmurHash3Mixer
(int pInput) static double
nextDouble
(RandomSource pRandom, double pMinimum, double pMaximum) static float
nextFloat
(RandomSource pRandom, float pMinimum, float pMaximum) static int
nextInt
(RandomSource pRandom, int pMinimum, int pMaximum) static float
normal
(RandomSource pRandom, float pMean, float pDeviation) static IntStream
outFromOrigin
(int pInput, int pLowerBound, int pUpperBound) static IntStream
outFromOrigin
(int pInput, int pLowerBound, int pUpperBound, int pSteps) static int
positiveCeilDiv
(int pX, int pY) static double
positiveModulo
(double pNumerator, double pDenominator) static float
positiveModulo
(float pNumerator, float pDenominator) static int
positiveModulo
(int pX, int pY) static int
quantize
(double pValue, int pFactor) static float
randomBetween
(RandomSource pRandom, float pMinInclusive, float pMaxExclusive) static int
randomBetweenInclusive
(RandomSource pRandom, int pMinInclusive, int pMaxInclusive) static boolean
rayIntersectsAABB
(Vec3 pStart, Vec3 pEnd, AABB pBoundingBox) static float
rotateIfNecessary
(float pRotationToAdjust, float pActualRotation, float pMaxDifference) static float
rotLerp
(float pDelta, float pStart, float pEnd) static int
roundToward
(int pValue, int pFactor) static int
sign
(double pX) static float
sin
(float pValue) static int
smallestEncompassingPowerOfTwo
(int pValue) static double
smoothstep
(double pInput) static double
smoothstepDerivative
(double pInput) static float
sqrt
(float pValue) static double
square
(double pValue) static float
square
(float pValue) static int
square
(int pValue) static long
square
(long pValue) static float
triangleWave
(float pInput, float pPeriod) static double
wobble
(double pInput) static double
wrapDegrees
(double pValue) static float
wrapDegrees
(float pValue) static int
wrapDegrees
(int pAngle)
-
字段详细资料
-
UUID_VERSION
private static final long UUID_VERSION- 另请参阅:
-
UUID_VERSION_TYPE_4
private static final long UUID_VERSION_TYPE_4- 另请参阅:
-
UUID_VARIANT
private static final long UUID_VARIANT- 另请参阅:
-
UUID_VARIANT_2
private static final long UUID_VARIANT_2- 另请参阅:
-
PI
public static final float PI- 另请参阅:
-
HALF_PI
public static final float HALF_PI- 另请参阅:
-
TWO_PI
public static final float TWO_PI- 另请参阅:
-
DEG_TO_RAD
public static final float DEG_TO_RAD- 另请参阅:
-
RAD_TO_DEG
public static final float RAD_TO_DEG- 另请参阅:
-
EPSILON
public static final float EPSILON- 另请参阅:
-
SQRT_OF_TWO
public static final float SQRT_OF_TWO -
SIN_SCALE
private static final float SIN_SCALE- 另请参阅:
-
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- 另请参阅:
-
FRAC_EXP
private static final int FRAC_EXP- 另请参阅:
-
LUT_SIZE
private static final int LUT_SIZE- 另请参阅:
-
FRAC_BIAS
private static final double FRAC_BIAS -
ASIN_TAB
private static final double[] ASIN_TAB -
COS_TAB
private static final double[] COS_TAB
-
-
构造器详细资料
-
Mth
public Mth()
-
-
方法详细资料
-
sin
public static float sin(float pValue) -
cos
public static float cos(float pValue) -
sqrt
public static float sqrt(float pValue) -
floor
public static int floor(float pValue) -
floor
public static int floor(double pValue) -
lfloor
public static long lfloor(double pValue) -
abs
public static float abs(float pValue) -
abs
public static int abs(int pValue) -
ceil
public static int ceil(float pValue) -
ceil
public static int ceil(double pValue) -
clamp
public static int clamp(int pValue, int pMin, int pMax) -
clamp
public static float clamp(float pValue, float pMin, float pMax) -
clamp
public static double clamp(double pValue, double pMin, double pMax) -
clampedLerp
public static double clampedLerp(double pStart, double pEnd, double pDelta) -
clampedLerp
public static float clampedLerp(float pStart, float pEnd, float pDelta) -
absMax
public static double absMax(double pX, double pY) -
floorDiv
public static int floorDiv(int pDividend, int pDivisor) -
nextInt
-
nextFloat
-
nextDouble
-
equal
public static boolean equal(float pX, float pY) -
equal
public static boolean equal(double pX, double pY) -
positiveModulo
public static int positiveModulo(int pX, int pY) -
positiveModulo
public static float positiveModulo(float pNumerator, float pDenominator) -
positiveModulo
public static double positiveModulo(double pNumerator, double pDenominator) -
isMultipleOf
public static boolean isMultipleOf(int pNumber, int pMultiple) -
wrapDegrees
public static int wrapDegrees(int pAngle) -
wrapDegrees
public static float wrapDegrees(float pValue) -
wrapDegrees
public static double wrapDegrees(double pValue) -
degreesDifference
public static float degreesDifference(float pStart, float pEnd) -
degreesDifferenceAbs
public static float degreesDifferenceAbs(float pStart, float pEnd) -
rotateIfNecessary
public static float rotateIfNecessary(float pRotationToAdjust, float pActualRotation, float pMaxDifference) -
approach
public static float approach(float pValue, float pLimit, float pStepSize) -
approachDegrees
public static float approachDegrees(float pAngle, float pLimit, float pStepSize) -
getInt
-
smallestEncompassingPowerOfTwo
public static int smallestEncompassingPowerOfTwo(int pValue) -
isPowerOfTwo
public static boolean isPowerOfTwo(int pValue) -
ceillog2
public static int ceillog2(int pValue) -
log2
public static int log2(int pValue) -
color
public static int color(float pR, float pG, float pB) -
frac
public static float frac(float pNumber) -
frac
public static double frac(double pNumber) -
getSeed
已过时。 -
getSeed
已过时。 -
createInsecureUUID
-
createInsecureUUID
-
inverseLerp
public static double inverseLerp(double pDelta, double pStart, double pEnd) -
inverseLerp
public static float inverseLerp(float pDelta, float pStart, float pEnd) -
rayIntersectsAABB
-
atan2
public static double atan2(double pY, double pX) -
invSqrt
public static float invSqrt(float pNumber) -
invSqrt
public static double invSqrt(double pNumber) -
fastInvSqrt
已过时。 -
fastInvCubeRoot
public static float fastInvCubeRoot(float pNumber) -
hsvToRgb
public static int hsvToRgb(float pHue, float pSaturation, float pValue) -
murmurHash3Mixer
public static int murmurHash3Mixer(int pInput) -
binarySearch
-
lerpInt
public static int lerpInt(float pDelta, int pStart, int pEnd) -
lerp
public static float lerp(float pDelta, float pStart, float pEnd) -
lerp
public static double lerp(double pDelta, double pStart, double pEnd) -
lerp2
public static double lerp2(double pDelta1, double pDelta2, double pStart1, double pEnd1, double pStart2, double pEnd2) -
lerp3
public static double lerp3(double pDelta1, double pDelta2, double pDelta3, double pStart1, double pEnd1, double pStart2, double pEnd2, double pStart3, double pEnd3, double pStart4, double pEnd4) -
catmullrom
public static float catmullrom(float pDelta, float pControlPoint1, float pControlPoint2, float pControlPoint3, float pControlPoint4) -
smoothstep
public static double smoothstep(double pInput) -
smoothstepDerivative
public static double smoothstepDerivative(double pInput) -
sign
public static int sign(double pX) -
rotLerp
public static float rotLerp(float pDelta, float pStart, float pEnd) -
triangleWave
public static float triangleWave(float pInput, float pPeriod) -
square
public static float square(float pValue) -
square
public static double square(double pValue) -
square
public static int square(int pValue) -
square
public static long square(long pValue) -
clampedMap
public static double clampedMap(double pInput, double pInputMin, double pInputMax, double pOuputMin, double pOutputMax) -
clampedMap
public static float clampedMap(float pInput, float pInputMin, float pInputMax, float pOutputMin, float pOutputMax) -
map
public static double map(double pInput, double pInputMin, double pInputMax, double pOutputMin, double pOutputMax) -
map
public static float map(float pInput, float pInputMin, float pInputMax, float pOutputMin, float pOutputMax) -
wobble
public static double wobble(double pInput) -
roundToward
public static int roundToward(int pValue, int pFactor) -
positiveCeilDiv
public static int positiveCeilDiv(int pX, int pY) -
randomBetweenInclusive
public static int randomBetweenInclusive(RandomSource pRandom, int pMinInclusive, int pMaxInclusive) -
randomBetween
-
normal
-
lengthSquared
public static double lengthSquared(double pXDistance, double pYDistance) -
length
public static double length(double pXDistance, double pYDistance) -
lengthSquared
public static double lengthSquared(double pXDistance, double pYDistance, double pZDistance) -
length
public static double length(double pXDistance, double pYDistance, double pZDistance) -
quantize
public static int quantize(double pValue, int pFactor) -
outFromOrigin
-
outFromOrigin
-