Class MathHelper

java.lang.Object
net.minecraft.util.math.MathHelper

public class MathHelper extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final double[]
     
    private static final double[]
     
    private static final double
     
    private static final int[]
     
    private static final Random
     
    private static final float[]
     
    static final float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    abs(float p_76135_0_)
     
    static int
    abs(int p_76130_0_)
     
    static double
    absMax(double p_76132_0_, double p_76132_2_)
     
    static float
    approach(float p_203300_0_, float p_203300_1_, float p_203300_2_)
     
    static float
    approachDegrees(float p_203303_0_, float p_203303_1_, float p_203303_2_)
     
    static double
    atan2(double p_181159_0_, double p_181159_2_)
     
    static double
    average(long[] p_76127_0_)
     
    static int
    binarySearch(int p_199093_0_, int p_199093_1_, IntPredicate p_199093_2_)
     
    static int
    ceil(double p_76143_0_)
     
    static int
    ceil(float p_76123_0_)
     
    static int
    ceillog2(int p_151241_0_)
     
    static double
    clamp(double p_151237_0_, double p_151237_2_, double p_151237_4_)
     
    static float
    clamp(float p_76131_0_, float p_76131_1_, float p_76131_2_)
     
    static int
    clamp(int p_76125_0_, int p_76125_1_, int p_76125_2_)
     
    static long
    clamp(long p_226163_0_, long p_226163_2_, long p_226163_4_)
     
    static double
    clampedLerp(double p_151238_0_, double p_151238_2_, double p_151238_4_)
     
    static int
    color(float p_180183_0_, float p_180183_1_, float p_180183_2_)
     
    static int
    color(int p_180181_0_, int p_180181_1_, int p_180181_2_)
     
    static float
    cos(float p_76134_0_)
     
    static UUID
     
    static UUID
     
    static float
    degreesDifference(float p_203302_0_, float p_203302_1_)
     
    static float
    degreesDifferenceAbs(float p_203301_0_, float p_203301_1_)
     
    static boolean
    equal(double p_219806_0_, double p_219806_2_)
     
    static boolean
    equal(float p_180185_0_, float p_180185_1_)
     
    static int
    fastFloor(double p_76140_0_)
     
    static float
    fastInvCubeRoot(float p_226166_0_)
     
    static double
    fastInvSqrt(double p_181161_0_)
     
    static float
    fastInvSqrt(float p_226165_0_)
     
    static int
    floor(double p_76128_0_)
     
    static int
    floor(float p_76141_0_)
     
    static double
    frac(double p_181162_0_)
     
    static float
    frac(float p_226164_0_)
     
    static int
    getInt(String p_82715_0_, int p_82715_1_)
     
    static long
    getSeed(int p_180187_0_, int p_180187_1_, int p_180187_2_)
     
    static long
    getSeed(Vector3i p_180186_0_)
     
    static int
    hsvToRgb(float p_181758_0_, float p_181758_1_, float p_181758_2_)
     
    static int
    intFloorDiv(int p_76137_0_, int p_76137_1_)
     
    static double
    inverseLerp(double p_233020_0_, double p_233020_2_, double p_233020_4_)
     
    static boolean
    isPowerOfTwo(int p_151235_0_)
     
    static double
    lerp(double p_219803_0_, double p_219803_2_, double p_219803_4_)
     
    static float
    lerp(float p_219799_0_, float p_219799_1_, float p_219799_2_)
     
    static double
    lerp2(double p_219804_0_, double p_219804_2_, double p_219804_4_, double p_219804_6_, double p_219804_8_, double p_219804_10_)
     
    static double
    lerp3(double p_219807_0_, double p_219807_2_, double p_219807_4_, double p_219807_6_, double p_219807_8_, double p_219807_10_, double p_219807_12_, double p_219807_14_, double p_219807_16_, double p_219807_18_, double p_219807_20_)
     
    static long
    lfloor(double p_76124_0_)
     
    static int
    log2(int p_151239_0_)
     
    static int
    murmurHash3Mixer(int p_188208_0_)
     
    static double
    nextDouble(Random p_82716_0_, double p_82716_1_, double p_82716_3_)
     
    static float
    nextFloat(Random p_151240_0_, float p_151240_1_, float p_151240_2_)
     
    static int
    nextInt(Random p_76136_0_, int p_76136_1_, int p_76136_2_)
     
    static double
    positiveModulo(double p_191273_0_, double p_191273_2_)
     
    static float
    positiveModulo(float p_188207_0_, float p_188207_1_)
     
    static int
    positiveModulo(int p_180184_0_, int p_180184_1_)
     
    static float
    rotateIfNecessary(float p_219800_0_, float p_219800_1_, float p_219800_2_)
     
    static float
    rotlerp(float p_226167_0_, float p_226167_1_, float p_226167_2_)
    Deprecated.
    static float
    rotLerp(float p_219805_0_, float p_219805_1_, float p_219805_2_)
     
    static float
    rotWrap(double p_226168_0_)
    Deprecated.
    static int
    roundUp(int p_154354_0_, int p_154354_1_)
     
    static int
    sign(double p_219802_0_)
     
    static float
    sin(float p_76126_0_)
     
    static int
     
    static double
    smoothstep(double p_219801_0_)
     
    static float
    sqrt(double p_76133_0_)
     
    static float
    sqrt(float p_76129_0_)
     
    static float
    square(float p_233022_0_)
     
    static float
    triangleWave(float p_233021_0_, float p_233021_1_)
     
    static double
    wrapDegrees(double p_76138_0_)
     
    static float
    wrapDegrees(float p_76142_0_)
     
    static int
    wrapDegrees(int p_188209_0_)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SQRT_OF_TWO

      public static final float SQRT_OF_TWO
    • SIN

      private static final float[] SIN
    • RANDOM

      private static final Random RANDOM
    • MULTIPLY_DE_BRUIJN_BIT_POSITION

      private static final int[] MULTIPLY_DE_BRUIJN_BIT_POSITION
    • 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

    • MathHelper

      public MathHelper()
  • Method Details

    • sin

      public static float sin(float p_76126_0_)
    • cos

      public static float cos(float p_76134_0_)
    • sqrt

      public static float sqrt(float p_76129_0_)
    • sqrt

      public static float sqrt(double p_76133_0_)
    • floor

      public static int floor(float p_76141_0_)
    • fastFloor

      public static int fastFloor(double p_76140_0_)
    • floor

      public static int floor(double p_76128_0_)
    • lfloor

      public static long lfloor(double p_76124_0_)
    • abs

      public static float abs(float p_76135_0_)
    • abs

      public static int abs(int p_76130_0_)
    • ceil

      public static int ceil(float p_76123_0_)
    • ceil

      public static int ceil(double p_76143_0_)
    • clamp

      public static int clamp(int p_76125_0_, int p_76125_1_, int p_76125_2_)
    • clamp

      public static long clamp(long p_226163_0_, long p_226163_2_, long p_226163_4_)
    • clamp

      public static float clamp(float p_76131_0_, float p_76131_1_, float p_76131_2_)
    • clamp

      public static double clamp(double p_151237_0_, double p_151237_2_, double p_151237_4_)
    • clampedLerp

      public static double clampedLerp(double p_151238_0_, double p_151238_2_, double p_151238_4_)
    • absMax

      public static double absMax(double p_76132_0_, double p_76132_2_)
    • intFloorDiv

      public static int intFloorDiv(int p_76137_0_, int p_76137_1_)
    • nextInt

      public static int nextInt(Random p_76136_0_, int p_76136_1_, int p_76136_2_)
    • nextFloat

      public static float nextFloat(Random p_151240_0_, float p_151240_1_, float p_151240_2_)
    • nextDouble

      public static double nextDouble(Random p_82716_0_, double p_82716_1_, double p_82716_3_)
    • average

      public static double average(long[] p_76127_0_)
    • equal

      public static boolean equal(float p_180185_0_, float p_180185_1_)
    • equal

      public static boolean equal(double p_219806_0_, double p_219806_2_)
    • positiveModulo

      public static int positiveModulo(int p_180184_0_, int p_180184_1_)
    • positiveModulo

      public static float positiveModulo(float p_188207_0_, float p_188207_1_)
    • positiveModulo

      public static double positiveModulo(double p_191273_0_, double p_191273_2_)
    • wrapDegrees

      public static int wrapDegrees(int p_188209_0_)
    • wrapDegrees

      public static float wrapDegrees(float p_76142_0_)
    • wrapDegrees

      public static double wrapDegrees(double p_76138_0_)
    • degreesDifference

      public static float degreesDifference(float p_203302_0_, float p_203302_1_)
    • degreesDifferenceAbs

      public static float degreesDifferenceAbs(float p_203301_0_, float p_203301_1_)
    • rotateIfNecessary

      public static float rotateIfNecessary(float p_219800_0_, float p_219800_1_, float p_219800_2_)
    • approach

      public static float approach(float p_203300_0_, float p_203300_1_, float p_203300_2_)
    • approachDegrees

      public static float approachDegrees(float p_203303_0_, float p_203303_1_, float p_203303_2_)
    • getInt

      public static int getInt(String p_82715_0_, int p_82715_1_)
    • smallestEncompassingPowerOfTwo

      public static int smallestEncompassingPowerOfTwo(int p_151236_0_)
    • isPowerOfTwo

      public static boolean isPowerOfTwo(int p_151235_0_)
    • ceillog2

      public static int ceillog2(int p_151241_0_)
    • log2

      public static int log2(int p_151239_0_)
    • roundUp

      public static int roundUp(int p_154354_0_, int p_154354_1_)
    • color

      public static int color(float p_180183_0_, float p_180183_1_, float p_180183_2_)
    • color

      public static int color(int p_180181_0_, int p_180181_1_, int p_180181_2_)
    • frac

      public static float frac(float p_226164_0_)
    • frac

      public static double frac(double p_181162_0_)
    • getSeed

      public static long getSeed(Vector3i p_180186_0_)
    • getSeed

      public static long getSeed(int p_180187_0_, int p_180187_1_, int p_180187_2_)
    • createInsecureUUID

      public static UUID createInsecureUUID(Random p_180182_0_)
    • createInsecureUUID

      public static UUID createInsecureUUID()
    • inverseLerp

      public static double inverseLerp(double p_233020_0_, double p_233020_2_, double p_233020_4_)
    • atan2

      public static double atan2(double p_181159_0_, double p_181159_2_)
    • fastInvSqrt

      public static float fastInvSqrt(float p_226165_0_)
    • fastInvSqrt

      public static double fastInvSqrt(double p_181161_0_)
    • fastInvCubeRoot

      public static float fastInvCubeRoot(float p_226166_0_)
    • hsvToRgb

      public static int hsvToRgb(float p_181758_0_, float p_181758_1_, float p_181758_2_)
    • murmurHash3Mixer

      public static int murmurHash3Mixer(int p_188208_0_)
    • binarySearch

      public static int binarySearch(int p_199093_0_, int p_199093_1_, IntPredicate p_199093_2_)
    • lerp

      public static float lerp(float p_219799_0_, float p_219799_1_, float p_219799_2_)
    • lerp

      public static double lerp(double p_219803_0_, double p_219803_2_, double p_219803_4_)
    • lerp2

      public static double lerp2(double p_219804_0_, double p_219804_2_, double p_219804_4_, double p_219804_6_, double p_219804_8_, double p_219804_10_)
    • lerp3

      public static double lerp3(double p_219807_0_, double p_219807_2_, double p_219807_4_, double p_219807_6_, double p_219807_8_, double p_219807_10_, double p_219807_12_, double p_219807_14_, double p_219807_16_, double p_219807_18_, double p_219807_20_)
    • smoothstep

      public static double smoothstep(double p_219801_0_)
    • sign

      public static int sign(double p_219802_0_)
    • rotLerp

      public static float rotLerp(float p_219805_0_, float p_219805_1_, float p_219805_2_)
    • rotlerp

      @Deprecated public static float rotlerp(float p_226167_0_, float p_226167_1_, float p_226167_2_)
      Deprecated.
    • rotWrap

      @Deprecated public static float rotWrap(double p_226168_0_)
      Deprecated.
    • triangleWave

      public static float triangleWave(float p_233021_0_, float p_233021_1_)
    • square

      public static float square(float p_233022_0_)