Class MathHelper

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

public class MathHelper extends Object
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
named net/minecraft/util/math/MathHelper
intermediary net/minecraft/class_3532
official ayz
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final double
    Used for the third-order Maclaurin series approximation of the arcsin function, x + x^3/6.
    private static final double[]
    Holds values of arcsin(x): ARCSINE_TABLE[i] is equal to Math.arcsin(i / 256.0).
    private static final int
    The total number of entries in ARCSINE_TABLE and COSINE_OF_ARCSINE_TABLE.
    private static final double[]
    Holds values of cos(arcsin(x)): COSINE_OF_ARCSINE_TABLE[i] is equal to Math.cos(Math.arcsin(i / 256.0)).
    static final float
     
    private static final float
     
    static final float
     
    private static final long
     
    private static final long
     
    private static final long
     
    private static final int
     
    static final float
     
    private static final long
     
    private static final int[]
     
    static final float
     
    static final float
     
    private static final Random
     
    private static final double
    A constant for rounding a double to the nearest multiple of 1/256.
    private static final float[]
     
    static final float
     
    static final float
    Tau is equal to 2 * PI.
    static final Vector3f
     
    static final Vector3f
     
    static final Vector3f
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    abs(float value)
     
    static int
    abs(int value)
     
    static double
    absMax(double a, double b)
     
    static float
    angleBetween(float first, float second)
     
    static boolean
    approximatelyEquals(double a, double b)
     
    static boolean
    approximatelyEquals(float a, float b)
     
    static double
    atan2(double y, double x)
    Returns an approximation of Math.atan2(y, x).
    static int
    binarySearch(int min, int max, IntPredicate predicate)
    Finds the minimum value in [min, max) that satisfies the monotonic predicate.
    static float
    catmullRom(float delta, float p0, float p1, float p2, float p3)
    Interpolates a point on a Catmull-Rom Spline.
    static int
    ceil(double value)
     
    static int
    ceil(float value)
     
    static int
    ceilDiv(int a, int b)
     
    static int
    ceilLog2(int value)
    Returns ceil(log2(value)).
    static double
    clamp(double value, double min, double max)
     
    static float
    clamp(float value, float min, float max)
     
    static int
    clamp(int value, int min, int max)
     
    static long
    clamp(long value, long min, long max)
     
    static float
    clampAngle(float value, float mean, float delta)
    Clamps value, as an angle, between mean - delta and mean + delta degrees.
    static double
    clampedLerp(double start, double end, double delta)
     
    static float
    clampedLerp(float start, float end, float delta)
     
    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.
    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.
    static float
    cos(float value)
     
    static float
    fastInverseCbrt(float x)
    Returns an approximation of 1 / Math.cbrt(x).
    static double
    fastInverseSqrt(double x)
    Deprecated.
    static int
    floor(double value)
     
    static int
    floor(float value)
     
    static int
    floorDiv(int dividend, int divisor)
     
    static int
    floorLog2(int value)
    Returns floor(log2(value)).
    static double
    floorMod(double dividend, double divisor)
     
    static float
    floorMod(float dividend, float divisor)
     
    static int
    floorMod(int dividend, int divisor)
     
    static double
    fractionalPart(double value)
     
    static float
    fractionalPart(float value)
     
    static double
    getLerpProgress(double value, double start, double end)
    Gets the fraction of the way that value is between start and end.
    static float
    getLerpProgress(float value, float start, float end)
     
    static long
    hashCode(int x, int y, int z)
    Deprecated.
    static long
    Deprecated.
    static int
    hsvToRgb(float hue, float saturation, float value)
     
    static double
    hypot(double a, double b)
     
    static int
    idealHash(int value)
     
    static double
    inverseSqrt(double x)
     
    static float
    inverseSqrt(float x)
     
    static boolean
    isMultipleOf(int a, int b)
     
    static boolean
    isPowerOfTwo(int value)
     
    static double
    lerp(double delta, double start, double end)
     
    static float
    lerp(float delta, float start, float end)
     
    static int
    lerp(float delta, int start, int end)
     
    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.
    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.
    static double
    lerpAngleDegrees(double delta, double start, double end)
     
    static float
    lerpAngleDegrees(float delta, float start, float end)
     
    static int
    lerpPositive(float delta, int start, int end)
    Returns linear interpolation of delta between start and end, except that for any positive delta the value is positive.
    static long
    lfloor(double value)
     
    static double
    magnitude(double a, double b, double c)
     
    static double
    map(double value, double oldStart, double oldEnd, double newStart, double newEnd)
    Linearly maps a value from one number range to another, unclamped.
    static float
    map(float value, float oldStart, float oldEnd, float newStart, float newEnd)
    Linearly maps a value from one number range to another, unclamped.
    static boolean
    method_34945(Vec3d origin, Vec3d direction, Box box)
     
    static double
    method_34957(double double2)
     
    static int
    multiplyFraction(Fraction fraction, int multiplier)
     
    static float
    nextBetween(Random random, float min, float max)
     
    static int
    nextBetween(Random random, int min, int max)
    Returns a random, uniformly distributed integer value in [min, max].
    static double
    nextDouble(Random random, double min, double max)
     
    static float
    nextFloat(Random random, float min, float max)
     
    static float
    nextGaussian(Random random, float mean, float deviation)
     
    static int
    nextInt(Random random, int min, int max)
    Returns a random, uniformly distributed integer value in [min, max].
    static int
    packRgb(float r, float g, float b)
     
    static int
    parseInt(String string, int fallback)
     
    static double
    perlinFade(double value)
     
    static double
    perlinFadeDerivative(double value)
     
    static UUID
     
    static UUID
     
    rotateAround(Vector3f axis, Quaternionf rotation, Quaternionf result)
     
    static int
    roundDownToMultiple(double a, int b)
    Returns a rounded down to the nearest multiple of b.
    static int
    roundUpToMultiple(int value, int divisor)
    Returns a value farther than or as far as value from zero that is a multiple of divisor.
    static int
    sign(double value)
     
    static float
    sin(float value)
     
    static int
     
    static float
    sqrt(float value)
     
    static double
    square(double n)
     
    static float
    square(float n)
     
    static int
    square(int n)
     
    static long
    square(long n)
     
    static double
    squaredHypot(double a, double b)
     
    static double
    squaredMagnitude(double a, double b, double c)
     
    static float
    stepTowards(float from, float to, float step)
    Steps from from towards to, changing the value by at most step.
    static float
    stepUnwrappedAngleTowards(float from, float to, float step)
    Steps from from degrees towards to degrees, changing the value by at most step degrees.
    static IntStream
    stream(int seed, int lowerBound, int upperBound)
     
    static IntStream
    stream(int seed, int lowerBound, int upperBound, int steps)
     
    static float
    subtractAngles(float start, float end)
     
    static float
    wrap(float value, float maxDeviation)
     
    static double
    wrapDegrees(double degrees)
    Wraps an angle in degrees to the interval [-180, 180).
    static float
    wrapDegrees(float degrees)
    Wraps an angle in degrees to the interval [-180, 180).
    static int
    wrapDegrees(int degrees)
    Wraps an angle in degrees to the interval [-180, 180).

    Methods inherited from class java.lang.Object

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

    • field_29852

      private static final long field_29852
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_29852 Lnet/minecraft/util/math/MathHelper;field_29852:J
      intermediary field_29852 Lnet/minecraft/class_3532;field_29852:J
      official k Layz;k:J
    • HALF_PI_RADIANS_SINE_TABLE_INDEX

      private static final long HALF_PI_RADIANS_SINE_TABLE_INDEX
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named HALF_PI_RADIANS_SINE_TABLE_INDEX Lnet/minecraft/util/math/MathHelper;HALF_PI_RADIANS_SINE_TABLE_INDEX:J
      intermediary field_29853 Lnet/minecraft/class_3532;field_29853:J
      official l Layz;l:J
    • field_29854

      private static final long field_29854
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_29854 Lnet/minecraft/util/math/MathHelper;field_29854:J
      intermediary field_29854 Lnet/minecraft/class_3532;field_29854:J
      official m Layz;m:J
    • field_29855

      private static final long field_29855
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_29855 Lnet/minecraft/util/math/MathHelper;field_29855:J
      intermediary field_29855 Lnet/minecraft/class_3532;field_29855:J
      official n Layz;n:J
    • PI

      public static final float PI
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named PI Lnet/minecraft/util/math/MathHelper;PI:F
      intermediary field_29844 Lnet/minecraft/class_3532;field_29844:F
      official a Layz;a:F
    • HALF_PI

      public static final float HALF_PI
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named HALF_PI Lnet/minecraft/util/math/MathHelper;HALF_PI:F
      intermediary field_29845 Lnet/minecraft/class_3532;field_29845:F
      official b Layz;b:F
    • TAU

      public static final float TAU
      Tau is equal to 2 * PI.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named TAU Lnet/minecraft/util/math/MathHelper;TAU:F
      intermediary field_29846 Lnet/minecraft/class_3532;field_29846:F
      official c Layz;c:F
    • RADIANS_PER_DEGREE

      public static final float RADIANS_PER_DEGREE
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named RADIANS_PER_DEGREE Lnet/minecraft/util/math/MathHelper;RADIANS_PER_DEGREE:F
      intermediary field_29847 Lnet/minecraft/class_3532;field_29847:F
      official d Layz;d:F
    • DEGREES_PER_RADIAN

      public static final float DEGREES_PER_RADIAN
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named DEGREES_PER_RADIAN Lnet/minecraft/util/math/MathHelper;DEGREES_PER_RADIAN:F
      intermediary field_29848 Lnet/minecraft/class_3532;field_29848:F
      official e Layz;e:F
    • EPSILON

      public static final float EPSILON
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named EPSILON Lnet/minecraft/util/math/MathHelper;EPSILON:F
      intermediary field_29849 Lnet/minecraft/class_3532;field_29849:F
      official f Layz;f:F
    • SQUARE_ROOT_OF_TWO

      public static final float SQUARE_ROOT_OF_TWO
      Mappings:
      Namespace Name Mixin selector
      named SQUARE_ROOT_OF_TWO Lnet/minecraft/util/math/MathHelper;SQUARE_ROOT_OF_TWO:F
      intermediary field_15724 Lnet/minecraft/class_3532;field_15724:F
      official g Layz;g:F
    • DEGREES_TO_SINE_TABLE_INDEX

      private static final float DEGREES_TO_SINE_TABLE_INDEX
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named DEGREES_TO_SINE_TABLE_INDEX Lnet/minecraft/util/math/MathHelper;DEGREES_TO_SINE_TABLE_INDEX:F
      intermediary field_29856 Lnet/minecraft/class_3532;field_29856:F
      official o Layz;o:F
    • Y_AXIS

      public static final Vector3f Y_AXIS
      Mappings:
      Namespace Name Mixin selector
      named Y_AXIS Lnet/minecraft/util/math/MathHelper;Y_AXIS:Lorg/joml/Vector3f;
      intermediary field_46242 Lnet/minecraft/class_3532;field_46242:Lorg/joml/Vector3f;
      official h Layz;h:Lorg/joml/Vector3f;
    • X_AXIS

      public static final Vector3f X_AXIS
      Mappings:
      Namespace Name Mixin selector
      named X_AXIS Lnet/minecraft/util/math/MathHelper;X_AXIS:Lorg/joml/Vector3f;
      intermediary field_46243 Lnet/minecraft/class_3532;field_46243:Lorg/joml/Vector3f;
      official i Layz;i:Lorg/joml/Vector3f;
    • Z_AXIS

      public static final Vector3f Z_AXIS
      Mappings:
      Namespace Name Mixin selector
      named Z_AXIS Lnet/minecraft/util/math/MathHelper;Z_AXIS:Lorg/joml/Vector3f;
      intermediary field_46244 Lnet/minecraft/class_3532;field_46244:Lorg/joml/Vector3f;
      official j Layz;j:Lorg/joml/Vector3f;
    • SINE_TABLE

      private static final float[] SINE_TABLE
      Mappings:
      Namespace Name Mixin selector
      named SINE_TABLE Lnet/minecraft/util/math/MathHelper;SINE_TABLE:[F
      intermediary field_15725 Lnet/minecraft/class_3532;field_15725:[F
      official p Layz;p:[F
    • RANDOM

      private static final Random RANDOM
      Mappings:
      Namespace Name Mixin selector
      named RANDOM Lnet/minecraft/util/math/MathHelper;RANDOM:Lnet/minecraft/util/math/random/Random;
      intermediary field_15726 Lnet/minecraft/class_3532;field_15726:Lnet/minecraft/class_5819;
      official q Layz;q:Lazh;
    • MULTIPLY_DE_BRUIJN_BIT_POSITION

      private static final int[] MULTIPLY_DE_BRUIJN_BIT_POSITION
      Mappings:
      Namespace Name Mixin selector
      named MULTIPLY_DE_BRUIJN_BIT_POSITION Lnet/minecraft/util/math/MathHelper;MULTIPLY_DE_BRUIJN_BIT_POSITION:[I
      intermediary field_15723 Lnet/minecraft/class_3532;field_15723:[I
      official r Layz;r:[I
    • ARCSINE_MACLAURIN_3

      private static final double ARCSINE_MACLAURIN_3
      Used for the third-order Maclaurin series approximation of the arcsin function, x + x^3/6.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named ARCSINE_MACLAURIN_3 Lnet/minecraft/util/math/MathHelper;ARCSINE_MACLAURIN_3:D
      intermediary field_29857 Lnet/minecraft/class_3532;field_29857:D
      official s Layz;s:D
    • field_29858

      private static final int field_29858
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_29858 Lnet/minecraft/util/math/MathHelper;field_29858:I
      intermediary field_29858 Lnet/minecraft/class_3532;field_29858:I
      official t Layz;t:I
    • ARCSINE_TABLE_LENGTH

      private static final int ARCSINE_TABLE_LENGTH
      The total number of entries in ARCSINE_TABLE and COSINE_OF_ARCSINE_TABLE.

      These tables have 257 elements because they store values for multiples of 1/256 from 0 to 1, inclusive.

      See Also:
      Mappings:
      Namespace Name Mixin selector
      named ARCSINE_TABLE_LENGTH Lnet/minecraft/util/math/MathHelper;ARCSINE_TABLE_LENGTH:I
      intermediary field_29859 Lnet/minecraft/class_3532;field_29859:I
      official u Layz;u:I
    • ROUNDER_256THS

      private static final double ROUNDER_256THS
      A constant for rounding a double to the nearest multiple of 1/256.

      When this constant is added to a double that is not too large, then the bits of the result's mantissa reflect the original number times 256. Consequently, adding this constant and then subtracting it rounds such doubles to the nearest multiple of 1/256.

      This is used by atan2(double, double) to produce an index into ARCSINE_TABLE and COSINE_OF_ARCSINE_TABLE.

      Mappings:
      Namespace Name Mixin selector
      named ROUNDER_256THS Lnet/minecraft/util/math/MathHelper;ROUNDER_256THS:D
      intermediary field_15728 Lnet/minecraft/class_3532;field_15728:D
      official v Layz;v:D
    • ARCSINE_TABLE

      private static final double[] ARCSINE_TABLE
      Holds values of arcsin(x): ARCSINE_TABLE[i] is equal to Math.arcsin(i / 256.0).

      This is used by atan2(double, double) to approximate the inverse tangent function.

      Mappings:
      Namespace Name Mixin selector
      named ARCSINE_TABLE Lnet/minecraft/util/math/MathHelper;ARCSINE_TABLE:[D
      intermediary field_15727 Lnet/minecraft/class_3532;field_15727:[D
      official w Layz;w:[D
    • COSINE_OF_ARCSINE_TABLE

      private static final double[] COSINE_OF_ARCSINE_TABLE
      Holds values of cos(arcsin(x)): COSINE_OF_ARCSINE_TABLE[i] is equal to Math.cos(Math.arcsin(i / 256.0)).

      This is used by atan2(double, double) to approximate the inverse tangent function.

      Mappings:
      Namespace Name Mixin selector
      named COSINE_OF_ARCSINE_TABLE Lnet/minecraft/util/math/MathHelper;COSINE_OF_ARCSINE_TABLE:[D
      intermediary field_15722 Lnet/minecraft/class_3532;field_15722:[D
      official x Layz;x:[D
  • Constructor Details

    • MathHelper

      public MathHelper()
  • Method Details

    • sin

      public static float sin(float value)
      Mappings:
      Namespace Name Mixin selector
      named sin Lnet/minecraft/util/math/MathHelper;sin(F)F
      intermediary method_15374 Lnet/minecraft/class_3532;method_15374(F)F
      official a Layz;a(F)F
    • cos

      public static float cos(float value)
      Mappings:
      Namespace Name Mixin selector
      named cos Lnet/minecraft/util/math/MathHelper;cos(F)F
      intermediary method_15362 Lnet/minecraft/class_3532;method_15362(F)F
      official b Layz;b(F)F
    • sqrt

      public static float sqrt(float value)
      Mappings:
      Namespace Name Mixin selector
      named sqrt Lnet/minecraft/util/math/MathHelper;sqrt(F)F
      intermediary method_15355 Lnet/minecraft/class_3532;method_15355(F)F
      official c Layz;c(F)F
    • floor

      public static int floor(float value)
      Mappings:
      Namespace Name Mixin selector
      named floor Lnet/minecraft/util/math/MathHelper;floor(F)I
      intermediary method_15375 Lnet/minecraft/class_3532;method_15375(F)I
      official d Layz;d(F)I
    • floor

      public static int floor(double value)
      Mappings:
      Namespace Name Mixin selector
      named floor Lnet/minecraft/util/math/MathHelper;floor(D)I
      intermediary method_15357 Lnet/minecraft/class_3532;method_15357(D)I
      official a Layz;a(D)I
    • lfloor

      public static long lfloor(double value)
      Mappings:
      Namespace Name Mixin selector
      named lfloor Lnet/minecraft/util/math/MathHelper;lfloor(D)J
      intermediary method_15372 Lnet/minecraft/class_3532;method_15372(D)J
      official b Layz;b(D)J
    • abs

      public static float abs(float value)
      Mappings:
      Namespace Name Mixin selector
      named abs Lnet/minecraft/util/math/MathHelper;abs(F)F
      intermediary method_15379 Lnet/minecraft/class_3532;method_15379(F)F
      official e Layz;e(F)F
    • abs

      public static int abs(int value)
      Mappings:
      Namespace Name Mixin selector
      named abs Lnet/minecraft/util/math/MathHelper;abs(I)I
      intermediary method_15382 Lnet/minecraft/class_3532;method_15382(I)I
      official a Layz;a(I)I
    • ceil

      public static int ceil(float value)
      Mappings:
      Namespace Name Mixin selector
      named ceil Lnet/minecraft/util/math/MathHelper;ceil(F)I
      intermediary method_15386 Lnet/minecraft/class_3532;method_15386(F)I
      official f Layz;f(F)I
    • ceil

      public static int ceil(double value)
      Mappings:
      Namespace Name Mixin selector
      named ceil Lnet/minecraft/util/math/MathHelper;ceil(D)I
      intermediary method_15384 Lnet/minecraft/class_3532;method_15384(D)I
      official c Layz;c(D)I
    • clamp

      public static int clamp(int value, int min, int max)
      Mappings:
      Namespace Name Mixin selector
      named clamp Lnet/minecraft/util/math/MathHelper;clamp(III)I
      intermediary method_15340 Lnet/minecraft/class_3532;method_15340(III)I
      official a Layz;a(III)I
    • clamp

      public static long clamp(long value, long min, long max)
      Mappings:
      Namespace Name Mixin selector
      named clamp Lnet/minecraft/util/math/MathHelper;clamp(JJJ)J
      intermediary method_53062 Lnet/minecraft/class_3532;method_53062(JJJ)J
      official a Layz;a(JJJ)J
    • clamp

      public static float clamp(float value, float min, float max)
      Mappings:
      Namespace Name Mixin selector
      named clamp Lnet/minecraft/util/math/MathHelper;clamp(FFF)F
      intermediary method_15363 Lnet/minecraft/class_3532;method_15363(FFF)F
      official a Layz;a(FFF)F
    • clamp

      public static double clamp(double value, double min, double max)
      Mappings:
      Namespace Name Mixin selector
      named clamp Lnet/minecraft/util/math/MathHelper;clamp(DDD)D
      intermediary method_15350 Lnet/minecraft/class_3532;method_15350(DDD)D
      official a Layz;a(DDD)D
    • clampedLerp

      public static double clampedLerp(double start, double end, double delta)
      Mappings:
      Namespace Name Mixin selector
      named clampedLerp Lnet/minecraft/util/math/MathHelper;clampedLerp(DDD)D
      intermediary method_15390 Lnet/minecraft/class_3532;method_15390(DDD)D
      official b Layz;b(DDD)D
    • clampedLerp

      public static float clampedLerp(float start, float end, float delta)
      Mappings:
      Namespace Name Mixin selector
      named clampedLerp Lnet/minecraft/util/math/MathHelper;clampedLerp(FFF)F
      intermediary method_37166 Lnet/minecraft/class_3532;method_37166(FFF)F
      official b Layz;b(FFF)F
    • absMax

      public static double absMax(double a, double b)
      Mappings:
      Namespace Name Mixin selector
      named absMax Lnet/minecraft/util/math/MathHelper;absMax(DD)D
      intermediary method_15391 Lnet/minecraft/class_3532;method_15391(DD)D
      official a Layz;a(DD)D
    • floorDiv

      public static int floorDiv(int dividend, int divisor)
      Mappings:
      Namespace Name Mixin selector
      named floorDiv Lnet/minecraft/util/math/MathHelper;floorDiv(II)I
      intermediary method_48116 Lnet/minecraft/class_3532;method_48116(II)I
      official a Layz;a(II)I
    • nextInt

      public static int nextInt(Random random, int min, int max)
      Returns a random, uniformly distributed integer value in [min, max]. If the range is empty (i.e. max < min), it returns min.
      Parameters:
      min - the minimum value, inclusive
      max - the maximum value, inclusive
      Returns:
      a random, uniformly distributed integer value in [min, max]
      Mappings:
      Namespace Name Mixin selector
      named nextInt Lnet/minecraft/util/math/MathHelper;nextInt(Lnet/minecraft/util/math/random/Random;II)I
      intermediary method_15395 Lnet/minecraft/class_3532;method_15395(Lnet/minecraft/class_5819;II)I
      official a Layz;a(Lazh;II)I
    • nextFloat

      public static float nextFloat(Random random, float min, float max)
      Mappings:
      Namespace Name Mixin selector
      named nextFloat Lnet/minecraft/util/math/MathHelper;nextFloat(Lnet/minecraft/util/math/random/Random;FF)F
      intermediary method_15344 Lnet/minecraft/class_3532;method_15344(Lnet/minecraft/class_5819;FF)F
      official a Layz;a(Lazh;FF)F
    • nextDouble

      public static double nextDouble(Random random, double min, double max)
      Mappings:
      Namespace Name Mixin selector
      named nextDouble Lnet/minecraft/util/math/MathHelper;nextDouble(Lnet/minecraft/util/math/random/Random;DD)D
      intermediary method_15366 Lnet/minecraft/class_3532;method_15366(Lnet/minecraft/class_5819;DD)D
      official a Layz;a(Lazh;DD)D
    • approximatelyEquals

      public static boolean approximatelyEquals(float a, float b)
      Mappings:
      Namespace Name Mixin selector
      named approximatelyEquals Lnet/minecraft/util/math/MathHelper;approximatelyEquals(FF)Z
      intermediary method_15347 Lnet/minecraft/class_3532;method_15347(FF)Z
      official a Layz;a(FF)Z
    • approximatelyEquals

      public static boolean approximatelyEquals(double a, double b)
      Mappings:
      Namespace Name Mixin selector
      named approximatelyEquals Lnet/minecraft/util/math/MathHelper;approximatelyEquals(DD)Z
      intermediary method_20390 Lnet/minecraft/class_3532;method_20390(DD)Z
      official b Layz;b(DD)Z
    • floorMod

      public static int floorMod(int dividend, int divisor)
      Mappings:
      Namespace Name Mixin selector
      named floorMod Lnet/minecraft/util/math/MathHelper;floorMod(II)I
      intermediary method_15387 Lnet/minecraft/class_3532;method_15387(II)I
      official b Layz;b(II)I
    • floorMod

      public static float floorMod(float dividend, float divisor)
      Mappings:
      Namespace Name Mixin selector
      named floorMod Lnet/minecraft/util/math/MathHelper;floorMod(FF)F
      intermediary method_15341 Lnet/minecraft/class_3532;method_15341(FF)F
      official b Layz;b(FF)F
    • floorMod

      public static double floorMod(double dividend, double divisor)
      Mappings:
      Namespace Name Mixin selector
      named floorMod Lnet/minecraft/util/math/MathHelper;floorMod(DD)D
      intermediary method_15367 Lnet/minecraft/class_3532;method_15367(DD)D
      official c Layz;c(DD)D
    • isMultipleOf

      public static boolean isMultipleOf(int a, int b)
      Mappings:
      Namespace Name Mixin selector
      named isMultipleOf Lnet/minecraft/util/math/MathHelper;isMultipleOf(II)Z
      intermediary method_48117 Lnet/minecraft/class_3532;method_48117(II)Z
      official c Layz;c(II)Z
    • wrapDegrees

      public static int wrapDegrees(int degrees)
      Wraps an angle in degrees to the interval [-180, 180).
      Mappings:
      Namespace Name Mixin selector
      named wrapDegrees Lnet/minecraft/util/math/MathHelper;wrapDegrees(I)I
      intermediary method_15392 Lnet/minecraft/class_3532;method_15392(I)I
      official b Layz;b(I)I
    • wrapDegrees

      public static float wrapDegrees(float degrees)
      Wraps an angle in degrees to the interval [-180, 180).
      Mappings:
      Namespace Name Mixin selector
      named wrapDegrees Lnet/minecraft/util/math/MathHelper;wrapDegrees(F)F
      intermediary method_15393 Lnet/minecraft/class_3532;method_15393(F)F
      official g Layz;g(F)F
    • wrapDegrees

      public static double wrapDegrees(double degrees)
      Wraps an angle in degrees to the interval [-180, 180).
      Mappings:
      Namespace Name Mixin selector
      named wrapDegrees Lnet/minecraft/util/math/MathHelper;wrapDegrees(D)D
      intermediary method_15338 Lnet/minecraft/class_3532;method_15338(D)D
      official d Layz;d(D)D
    • subtractAngles

      public static float subtractAngles(float start, float end)
      Mappings:
      Namespace Name Mixin selector
      named subtractAngles Lnet/minecraft/util/math/MathHelper;subtractAngles(FF)F
      intermediary method_15381 Lnet/minecraft/class_3532;method_15381(FF)F
      official c Layz;c(FF)F
    • angleBetween

      public static float angleBetween(float first, float second)
      Mappings:
      Namespace Name Mixin selector
      named angleBetween Lnet/minecraft/util/math/MathHelper;angleBetween(FF)F
      intermediary method_15356 Lnet/minecraft/class_3532;method_15356(FF)F
      official d Layz;d(FF)F
    • clampAngle

      public static float clampAngle(float value, float mean, float delta)
      Clamps value, as an angle, between mean - delta and mean + delta degrees.
      Parameters:
      value - the value to clamp
      mean - the mean value of the clamp angle range
      delta - the maximum difference allowed from the mean, must not be negative
      Returns:
      the clamped value
      Mappings:
      Namespace Name Mixin selector
      named clampAngle Lnet/minecraft/util/math/MathHelper;clampAngle(FFF)F
      intermediary method_20306 Lnet/minecraft/class_3532;method_20306(FFF)F
      official c Layz;c(FFF)F
    • stepTowards

      public static float stepTowards(float from, float to, float step)
      Steps from from towards to, changing the value by at most step.
      Mappings:
      Namespace Name Mixin selector
      named stepTowards Lnet/minecraft/util/math/MathHelper;stepTowards(FFF)F
      intermediary method_15348 Lnet/minecraft/class_3532;method_15348(FFF)F
      official d Layz;d(FFF)F
    • stepUnwrappedAngleTowards

      public static float stepUnwrappedAngleTowards(float from, float to, float step)
      Steps from from degrees towards to degrees, changing the value by at most step degrees.
      Mappings:
      Namespace Name Mixin selector
      named stepUnwrappedAngleTowards Lnet/minecraft/util/math/MathHelper;stepUnwrappedAngleTowards(FFF)F
      intermediary method_15388 Lnet/minecraft/class_3532;method_15388(FFF)F
      official e Layz;e(FFF)F
    • parseInt

      public static int parseInt(String string, int fallback)
      Mappings:
      Namespace Name Mixin selector
      named parseInt Lnet/minecraft/util/math/MathHelper;parseInt(Ljava/lang/String;I)I
      intermediary method_15343 Lnet/minecraft/class_3532;method_15343(Ljava/lang/String;I)I
      official a Layz;a(Ljava/lang/String;I)I
    • smallestEncompassingPowerOfTwo

      public static int smallestEncompassingPowerOfTwo(int value)
      Mappings:
      Namespace Name Mixin selector
      named smallestEncompassingPowerOfTwo Lnet/minecraft/util/math/MathHelper;smallestEncompassingPowerOfTwo(I)I
      intermediary method_15339 Lnet/minecraft/class_3532;method_15339(I)I
      official c Layz;c(I)I
    • isPowerOfTwo

      public static boolean isPowerOfTwo(int value)
      Mappings:
      Namespace Name Mixin selector
      named isPowerOfTwo Lnet/minecraft/util/math/MathHelper;isPowerOfTwo(I)Z
      intermediary method_15352 Lnet/minecraft/class_3532;method_15352(I)Z
      official d Layz;d(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
      named ceilLog2 Lnet/minecraft/util/math/MathHelper;ceilLog2(I)I
      intermediary method_15342 Lnet/minecraft/class_3532;method_15342(I)I
      official e Layz;e(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
      named floorLog2 Lnet/minecraft/util/math/MathHelper;floorLog2(I)I
      intermediary method_15351 Lnet/minecraft/class_3532;method_15351(I)I
      official f Layz;f(I)I
    • packRgb

      public static int packRgb(float r, float g, float b)
      Mappings:
      Namespace Name Mixin selector
      named packRgb Lnet/minecraft/util/math/MathHelper;packRgb(FFF)I
      intermediary method_15353 Lnet/minecraft/class_3532;method_15353(FFF)I
      official f Layz;f(FFF)I
    • fractionalPart

      public static float fractionalPart(float value)
      Mappings:
      Namespace Name Mixin selector
      named fractionalPart Lnet/minecraft/util/math/MathHelper;fractionalPart(F)F
      intermediary method_22450 Lnet/minecraft/class_3532;method_22450(F)F
      official h Layz;h(F)F
    • fractionalPart

      public static double fractionalPart(double value)
      Mappings:
      Namespace Name Mixin selector
      named fractionalPart Lnet/minecraft/util/math/MathHelper;fractionalPart(D)D
      intermediary method_15385 Lnet/minecraft/class_3532;method_15385(D)D
      official e Layz;e(D)D
    • hashCode

      @Deprecated public static long hashCode(Vec3i vec)
      Deprecated.
      Mappings:
      Namespace Name Mixin selector
      named hashCode Lnet/minecraft/util/math/MathHelper;hashCode(Lnet/minecraft/util/math/Vec3i;)J
      intermediary method_15389 Lnet/minecraft/class_3532;method_15389(Lnet/minecraft/class_2382;)J
      official a Layz;a(Lkd;)J
    • hashCode

      @Deprecated public static long hashCode(int x, int y, int z)
      Deprecated.
      Mappings:
      Namespace Name Mixin selector
      named hashCode Lnet/minecraft/util/math/MathHelper;hashCode(III)J
      intermediary method_15371 Lnet/minecraft/class_3532;method_15371(III)J
      official b Layz;b(III)J
    • randomUuid

      public static UUID randomUuid(Random random)
      Mappings:
      Namespace Name Mixin selector
      named randomUuid Lnet/minecraft/util/math/MathHelper;randomUuid(Lnet/minecraft/util/math/random/Random;)Ljava/util/UUID;
      intermediary method_15378 Lnet/minecraft/class_3532;method_15378(Lnet/minecraft/class_5819;)Ljava/util/UUID;
      official a Layz;a(Lazh;)Ljava/util/UUID;
    • randomUuid

      public static UUID randomUuid()
      Mappings:
      Namespace Name Mixin selector
      named randomUuid Lnet/minecraft/util/math/MathHelper;randomUuid()Ljava/util/UUID;
      intermediary method_15394 Lnet/minecraft/class_3532;method_15394()Ljava/util/UUID;
      official a Layz;a()Ljava/util/UUID;
    • getLerpProgress

      public static double getLerpProgress(double value, double start, double end)
      Gets the fraction of the way that value is between start and end. This is the delta value needed to lerp between start and end to get value. In other words, getLerpProgress(lerp(delta, start, end), start, end) == delta.
      Parameters:
      value - the result of the lerp function
      start - the value interpolated from
      end - the value interpolated to
      Mappings:
      Namespace Name Mixin selector
      named getLerpProgress Lnet/minecraft/util/math/MathHelper;getLerpProgress(DDD)D
      intermediary method_15370 Lnet/minecraft/class_3532;method_15370(DDD)D
      official c Layz;c(DDD)D
    • getLerpProgress

      public static float getLerpProgress(float value, float start, float end)
      Mappings:
      Namespace Name Mixin selector
      named getLerpProgress Lnet/minecraft/util/math/MathHelper;getLerpProgress(FFF)F
      intermediary method_37960 Lnet/minecraft/class_3532;method_37960(FFF)F
      official g Layz;g(FFF)F
    • method_34945

      public static boolean method_34945(Vec3d origin, Vec3d direction, Box box)
      Mappings:
      Namespace Name Mixin selector
      named method_34945 Lnet/minecraft/util/math/MathHelper;method_34945(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Box;)Z
      intermediary method_34945 Lnet/minecraft/class_3532;method_34945(Lnet/minecraft/class_243;Lnet/minecraft/class_243;Lnet/minecraft/class_238;)Z
      official a Layz;a(Levs;Levs;Levn;)Z
    • atan2

      public static double atan2(double y, double x)
      Returns an approximation of Math.atan2(y, x).
      Returns:
      an approximation of Math.atan2(y, x)
      Implementation Note:
      This implementation transforms the arguments such that they lie in the first quadrant. If y > x, then x and y are swapped to minimize the error of the initial approximation. x and y are normalized, and an initial approximation of the result and the sine of the deviation from the true value are obtained using the ARCSINE_TABLE and COSINE_OF_ARCSINE_TABLE lookup tables. The error itself is approximated using the third-order Maclaurin series polynomial for arcsin. Finally, the implementation undoes any transformations that were performed initially.
      Mappings:
      Namespace Name Mixin selector
      named atan2 Lnet/minecraft/util/math/MathHelper;atan2(DD)D
      intermediary method_15349 Lnet/minecraft/class_3532;method_15349(DD)D
      official d Layz;d(DD)D
    • inverseSqrt

      public static float inverseSqrt(float x)
      Mappings:
      Namespace Name Mixin selector
      named inverseSqrt Lnet/minecraft/util/math/MathHelper;inverseSqrt(F)F
      intermediary method_48119 Lnet/minecraft/class_3532;method_48119(F)F
      official i Layz;i(F)F
    • inverseSqrt

      public static double inverseSqrt(double x)
      Mappings:
      Namespace Name Mixin selector
      named inverseSqrt Lnet/minecraft/util/math/MathHelper;inverseSqrt(D)D
      intermediary method_48118 Lnet/minecraft/class_3532;method_48118(D)D
      official f Layz;f(D)D
    • fastInverseSqrt

      @Deprecated public static double fastInverseSqrt(double x)
      Deprecated.
      Returns an approximation of 1 / Math.sqrt(x).
      Returns:
      an approximation of 1 / Math.sqrt(x)
      Mappings:
      Namespace Name Mixin selector
      named fastInverseSqrt Lnet/minecraft/util/math/MathHelper;fastInverseSqrt(D)D
      intermediary method_15345 Lnet/minecraft/class_3532;method_15345(D)D
      official g Layz;g(D)D
    • fastInverseCbrt

      public static float fastInverseCbrt(float x)
      Returns an approximation of 1 / Math.cbrt(x).
      Returns:
      an approximation of 1 / Math.cbrt(x)
      Mappings:
      Namespace Name Mixin selector
      named fastInverseCbrt Lnet/minecraft/util/math/MathHelper;fastInverseCbrt(F)F
      intermediary method_23278 Lnet/minecraft/class_3532;method_23278(F)F
      official j Layz;j(F)F
    • hsvToRgb

      public static int hsvToRgb(float hue, float saturation, float value)
      Mappings:
      Namespace Name Mixin selector
      named hsvToRgb Lnet/minecraft/util/math/MathHelper;hsvToRgb(FFF)I
      intermediary method_15369 Lnet/minecraft/class_3532;method_15369(FFF)I
      official h Layz;h(FFF)I
    • idealHash

      public static int idealHash(int value)
      Mappings:
      Namespace Name Mixin selector
      named idealHash Lnet/minecraft/util/math/MathHelper;idealHash(I)I
      intermediary method_15354 Lnet/minecraft/class_3532;method_15354(I)I
      official g Layz;g(I)I
    • binarySearch

      public static int binarySearch(int min, int max, IntPredicate predicate)
      Finds the minimum value in [min, max) that satisfies the monotonic predicate.

      The predicate must be monotonic, i.e. if for any a, predicate.test(a) is true, then for all b > a, predicate.test(b) must also be true.

      Examples:

      • binarySearch(3, 7, x -> true) returns 3.
      • binarySearch(3, 7, x -> x >= 5) returns 5.
      • binarySearch(3, 7, x -> false) returns 7.
      Parameters:
      min - the minimum value (inclusive) to be tested
      max - the maximum value (exclusive) to be tested
      predicate - the predicate that returns true for 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
      named binarySearch Lnet/minecraft/util/math/MathHelper;binarySearch(IILjava/util/function/IntPredicate;)I
      intermediary method_15360 Lnet/minecraft/class_3532;method_15360(IILjava/util/function/IntPredicate;)I
      official a Layz;a(IILjava/util/function/IntPredicate;)I
    • lerp

      public static int lerp(float delta, int start, int end)
      Mappings:
      Namespace Name Mixin selector
      named lerp Lnet/minecraft/util/math/MathHelper;lerp(FII)I
      intermediary method_48781 Lnet/minecraft/class_3532;method_48781(FII)I
      official a Layz;a(FII)I
    • lerpPositive

      public static int lerpPositive(float delta, int start, int end)
      Returns linear interpolation of delta between start and end, except that for any positive delta the value is positive.

      Like lerp(float, int, int), lerpPositive(0, 0, 10) returns 0. However, if the delta is 0.01f, the lerp method would return 0 since 0.01 * 10 floored is 0. This method returns 1 in this situation.

      Returns:
      linear interpolation of delta between start and end, except that for any positive delta the value is positive
      See Also:
      API Note:
      This is used to calculate redstone comparator output and boss bar percentage.
      Mappings:
      Namespace Name Mixin selector
      named lerpPositive Lnet/minecraft/util/math/MathHelper;lerpPositive(FII)I
      intermediary method_53063 Lnet/minecraft/class_3532;method_53063(FII)I
      official b Layz;b(FII)I
    • lerp

      public static float lerp(float delta, float start, float end)
      Mappings:
      Namespace Name Mixin selector
      named lerp Lnet/minecraft/util/math/MathHelper;lerp(FFF)F
      intermediary method_16439 Lnet/minecraft/class_3532;method_16439(FFF)F
      official i Layz;i(FFF)F
    • lerp

      public static double lerp(double delta, double start, double end)
      Mappings:
      Namespace Name Mixin selector
      named lerp Lnet/minecraft/util/math/MathHelper;lerp(DDD)D
      intermediary method_16436 Lnet/minecraft/class_3532;method_16436(DDD)D
      official d Layz;d(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 square
      deltaY - the y-coordinate on the unit square
      x0y0 - the output if deltaX is 0 and deltaY is 0
      x1y0 - the output if deltaX is 1 and deltaY is 0
      x0y1 - the output if deltaX is 0 and deltaY is 1
      x1y1 - the output if deltaX is 1 and deltaY is 1
      Mappings:
      Namespace Name Mixin selector
      named lerp2 Lnet/minecraft/util/math/MathHelper;lerp2(DDDDDD)D
      intermediary method_16437 Lnet/minecraft/class_3532;method_16437(DDDDDD)D
      official a Layz;a(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 cube
      deltaY - the y-coordinate on the unit cube
      deltaZ - the z-coordinate on the unit cube
      x0y0z0 - the output if deltaX is 0, deltaY is 0 and deltaZ is 0
      x1y0z0 - the output if deltaX is 1, deltaY is 0 and deltaZ is 0
      x0y1z0 - the output if deltaX is 0, deltaY is 1 and deltaZ is 0
      x1y1z0 - the output if deltaX is 1, deltaY is 1 and deltaZ is 0
      x0y0z1 - the output if deltaX is 0, deltaY is 0 and deltaZ is 1
      x1y0z1 - the output if deltaX is 1, deltaY is 0 and deltaZ is 1
      x0y1z1 - the output if deltaX is 0, deltaY is 1 and deltaZ is 1
      x1y1z1 - the output if deltaX is 1, deltaY is 1 and deltaZ is 1
      Mappings:
      Namespace Name Mixin selector
      named lerp3 Lnet/minecraft/util/math/MathHelper;lerp3(DDDDDDDDDDD)D
      intermediary method_16438 Lnet/minecraft/class_3532;method_16438(DDDDDDDDDDD)D
      official a Layz;a(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 arguments p0, p1, p2, p3 and p1, p2, p3, p4, the resulting curve will have a continuous first derivative at p2, where the two input curves connect. For higher-dimensional curves, the interpolation on the curve is done component-wise: for inputs delta, (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 interpolation
      p0 - the previous data point to assist in curve-smoothing
      p1 - the output if delta is 0
      p2 - the output if delta is 1
      p3 - the next data point to assist in curve-smoothing
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named catmullRom Lnet/minecraft/util/math/MathHelper;catmullRom(FFFFF)F
      intermediary method_41303 Lnet/minecraft/class_3532;method_41303(FFFFF)F
      official a Layz;a(FFFFF)F
    • perlinFade

      public static double perlinFade(double value)
      Mappings:
      Namespace Name Mixin selector
      named perlinFade Lnet/minecraft/util/math/MathHelper;perlinFade(D)D
      intermediary method_16435 Lnet/minecraft/class_3532;method_16435(D)D
      official h Layz;h(D)D
    • perlinFadeDerivative

      public static double perlinFadeDerivative(double value)
      Mappings:
      Namespace Name Mixin selector
      named perlinFadeDerivative Lnet/minecraft/util/math/MathHelper;perlinFadeDerivative(D)D
      intermediary method_34956 Lnet/minecraft/class_3532;method_34956(D)D
      official i Layz;i(D)D
    • sign

      public static int sign(double value)
      Mappings:
      Namespace Name Mixin selector
      named sign Lnet/minecraft/util/math/MathHelper;sign(D)I
      intermediary method_17822 Lnet/minecraft/class_3532;method_17822(D)I
      official j Layz;j(D)I
    • lerpAngleDegrees

      public static float lerpAngleDegrees(float delta, float start, float end)
      Mappings:
      Namespace Name Mixin selector
      named lerpAngleDegrees Lnet/minecraft/util/math/MathHelper;lerpAngleDegrees(FFF)F
      intermediary method_17821 Lnet/minecraft/class_3532;method_17821(FFF)F
      official j Layz;j(FFF)F
    • lerpAngleDegrees

      public static double lerpAngleDegrees(double delta, double start, double end)
      Mappings:
      Namespace Name Mixin selector
      named lerpAngleDegrees Lnet/minecraft/util/math/MathHelper;lerpAngleDegrees(DDD)D
      intermediary method_52468 Lnet/minecraft/class_3532;method_52468(DDD)D
      official e Layz;e(DDD)D
    • wrap

      public static float wrap(float value, float maxDeviation)
      Mappings:
      Namespace Name Mixin selector
      named wrap Lnet/minecraft/util/math/MathHelper;wrap(FF)F
      intermediary method_24504 Lnet/minecraft/class_3532;method_24504(FF)F
      official e Layz;e(FF)F
    • square

      public static float square(float n)
      Mappings:
      Namespace Name Mixin selector
      named square Lnet/minecraft/util/math/MathHelper;square(F)F
      intermediary method_27285 Lnet/minecraft/class_3532;method_27285(F)F
      official k Layz;k(F)F
    • square

      public static double square(double n)
      Mappings:
      Namespace Name Mixin selector
      named square Lnet/minecraft/util/math/MathHelper;square(D)D
      intermediary method_33723 Lnet/minecraft/class_3532;method_33723(D)D
      official k Layz;k(D)D
    • square

      public static int square(int n)
      Mappings:
      Namespace Name Mixin selector
      named square Lnet/minecraft/util/math/MathHelper;square(I)I
      intermediary method_34954 Lnet/minecraft/class_3532;method_34954(I)I
      official h Layz;h(I)I
    • square

      public static long square(long n)
      Mappings:
      Namespace Name Mixin selector
      named square Lnet/minecraft/util/math/MathHelper;square(J)J
      intermediary method_38652 Lnet/minecraft/class_3532;method_38652(J)J
      official a Layz;a(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 value
      oldStart - the starting value of the original range
      oldEnd - the end value of the original range
      newStart - the starting value of the new range
      newEnd - the end value of the new range
      Returns:
      the mapped value, clamped between newStart and newEnd
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named clampedMap Lnet/minecraft/util/math/MathHelper;clampedMap(DDDDD)D
      intermediary method_32854 Lnet/minecraft/class_3532;method_32854(DDDDD)D
      official a Layz;a(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 value
      oldStart - the starting value of the original range
      oldEnd - the end value of the original range
      newStart - the starting value of the new range
      newEnd - the end value of the new range
      Returns:
      the mapped value, clamped between newStart and newEnd
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named clampedMap Lnet/minecraft/util/math/MathHelper;clampedMap(FFFFF)F
      intermediary method_37958 Lnet/minecraft/class_3532;method_37958(FFFFF)F
      official b Layz;b(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 to getLerpProgress(result, newStart, newEnd) (accounting for floating point errors).

      Parameters:
      value - the input value
      oldStart - the starting value of the original range
      oldEnd - the end value of the original range
      newStart - the starting value of the new range
      newEnd - the end value of the new range
      Returns:
      the mapped value
      Mappings:
      Namespace Name Mixin selector
      named map Lnet/minecraft/util/math/MathHelper;map(DDDDD)D
      intermediary method_33722 Lnet/minecraft/class_3532;method_33722(DDDDD)D
      official b Layz;b(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 to getLerpProgress(result, newStart, newEnd) (accounting for floating point errors).

      Parameters:
      value - the input value
      oldStart - the starting value of the original range
      oldEnd - the end value of the original range
      newStart - the starting value of the new range
      newEnd - the end value of the new range
      Returns:
      the mapped value
      Mappings:
      Namespace Name Mixin selector
      named map Lnet/minecraft/util/math/MathHelper;map(FFFFF)F
      intermediary method_37959 Lnet/minecraft/class_3532;method_37959(FFFFF)F
      official c Layz;c(FFFFF)F
    • method_34957

      public static double method_34957(double double2)
      Mappings:
      Namespace Name Mixin selector
      named method_34957 Lnet/minecraft/util/math/MathHelper;method_34957(D)D
      intermediary method_34957 Lnet/minecraft/class_3532;method_34957(D)D
      official l Layz;l(D)D
    • roundUpToMultiple

      public static int roundUpToMultiple(int value, int divisor)
      Returns a value farther than or as far as value from zero that is a multiple of divisor.
      Mappings:
      Namespace Name Mixin selector
      named roundUpToMultiple Lnet/minecraft/util/math/MathHelper;roundUpToMultiple(II)I
      intermediary method_28139 Lnet/minecraft/class_3532;method_28139(II)I
      official d Layz;d(II)I
    • ceilDiv

      public static int ceilDiv(int a, int b)
      Mappings:
      Namespace Name Mixin selector
      named ceilDiv Lnet/minecraft/util/math/MathHelper;ceilDiv(II)I
      intermediary method_38788 Lnet/minecraft/class_3532;method_38788(II)I
      official e Layz;e(II)I
    • nextBetween

      public static int nextBetween(Random random, int min, int max)
      Returns a random, uniformly distributed integer value in [min, max].
      Parameters:
      min - the minimum value, inclusive
      max - 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
      named nextBetween Lnet/minecraft/util/math/MathHelper;nextBetween(Lnet/minecraft/util/math/random/Random;II)I
      intermediary method_32751 Lnet/minecraft/class_3532;method_32751(Lnet/minecraft/class_5819;II)I
      official b Layz;b(Lazh;II)I
    • nextBetween

      public static float nextBetween(Random random, float min, float max)
      Mappings:
      Namespace Name Mixin selector
      named nextBetween Lnet/minecraft/util/math/MathHelper;nextBetween(Lnet/minecraft/util/math/random/Random;FF)F
      intermediary method_32750 Lnet/minecraft/class_3532;method_32750(Lnet/minecraft/class_5819;FF)F
      official b Layz;b(Lazh;FF)F
    • nextGaussian

      public static float nextGaussian(Random random, float mean, float deviation)
      Mappings:
      Namespace Name Mixin selector
      named nextGaussian Lnet/minecraft/util/math/MathHelper;nextGaussian(Lnet/minecraft/util/math/random/Random;FF)F
      intermediary method_32855 Lnet/minecraft/class_3532;method_32855(Lnet/minecraft/class_5819;FF)F
      official c Layz;c(Lazh;FF)F
    • squaredHypot

      public static double squaredHypot(double a, double b)
      Mappings:
      Namespace Name Mixin selector
      named squaredHypot Lnet/minecraft/util/math/MathHelper;squaredHypot(DD)D
      intermediary method_41189 Lnet/minecraft/class_3532;method_41189(DD)D
      official e Layz;e(DD)D
    • hypot

      public static double hypot(double a, double b)
      Mappings:
      Namespace Name Mixin selector
      named hypot Lnet/minecraft/util/math/MathHelper;hypot(DD)D
      intermediary method_39241 Lnet/minecraft/class_3532;method_39241(DD)D
      official f Layz;f(DD)D
    • squaredMagnitude

      public static double squaredMagnitude(double a, double b, double c)
      Mappings:
      Namespace Name Mixin selector
      named squaredMagnitude Lnet/minecraft/util/math/MathHelper;squaredMagnitude(DDD)D
      intermediary method_41190 Lnet/minecraft/class_3532;method_41190(DDD)D
      official f Layz;f(DDD)D
    • magnitude

      public static double magnitude(double a, double b, double c)
      Mappings:
      Namespace Name Mixin selector
      named magnitude Lnet/minecraft/util/math/MathHelper;magnitude(DDD)D
      intermediary method_33825 Lnet/minecraft/class_3532;method_33825(DDD)D
      official g Layz;g(DDD)D
    • roundDownToMultiple

      public static int roundDownToMultiple(double a, int b)
      Returns a rounded down to the nearest multiple of b.
      Returns:
      a rounded down to the nearest multiple of b
      Mappings:
      Namespace Name Mixin selector
      named roundDownToMultiple Lnet/minecraft/util/math/MathHelper;roundDownToMultiple(DI)I
      intermediary method_38961 Lnet/minecraft/class_3532;method_38961(DI)I
      official a Layz;a(DI)I
    • stream

      public static IntStream stream(int seed, int lowerBound, int upperBound)
      Mappings:
      Namespace Name Mixin selector
      named stream Lnet/minecraft/util/math/MathHelper;stream(III)Ljava/util/stream/IntStream;
      intermediary method_42120 Lnet/minecraft/class_3532;method_42120(III)Ljava/util/stream/IntStream;
      official c Layz;c(III)Ljava/util/stream/IntStream;
    • stream

      public static IntStream stream(int seed, int lowerBound, int upperBound, int steps)
      Mappings:
      Namespace Name Mixin selector
      named stream Lnet/minecraft/util/math/MathHelper;stream(IIII)Ljava/util/stream/IntStream;
      intermediary method_42117 Lnet/minecraft/class_3532;method_42117(IIII)Ljava/util/stream/IntStream;
      official a Layz;a(IIII)Ljava/util/stream/IntStream;
    • rotateAround

      public static Quaternionf rotateAround(Vector3f axis, Quaternionf rotation, Quaternionf result)
      Mappings:
      Namespace Name Mixin selector
      named rotateAround Lnet/minecraft/util/math/MathHelper;rotateAround(Lorg/joml/Vector3f;Lorg/joml/Quaternionf;Lorg/joml/Quaternionf;)Lorg/joml/Quaternionf;
      intermediary method_53948 Lnet/minecraft/class_3532;method_53948(Lorg/joml/Vector3f;Lorg/joml/Quaternionf;Lorg/joml/Quaternionf;)Lorg/joml/Quaternionf;
      official a Layz;a(Lorg/joml/Vector3f;Lorg/joml/Quaternionf;Lorg/joml/Quaternionf;)Lorg/joml/Quaternionf;
    • multiplyFraction

      public static int multiplyFraction(Fraction fraction, int multiplier)
      Mappings:
      Namespace Name Mixin selector
      named multiplyFraction Lnet/minecraft/util/math/MathHelper;multiplyFraction(Lorg/apache/commons/lang3/math/Fraction;I)I
      intermediary method_59515 Lnet/minecraft/class_3532;method_59515(Lorg/apache/commons/lang3/math/Fraction;I)I
      official a Layz;a(Lorg/apache/commons/lang3/math/Fraction;I)I