Package net.minecraft.util
Class MathHelper
- java.lang.Object
-
- net.minecraft.util.MathHelper
-
public class MathHelper extends java.lang.Object
+ This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!" Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team EaglercraftX 1.8 patch files are (c) 2022-2023 LAX1DUDE. All Rights Reserved. WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR. NOT FOR COMMERCIAL OR MALICIOUS USE (please read the 'LICENSE' file this repo's root directory for more info)
-
-
Field Summary
Fields Modifier and Type Field Description static float
SQRT_2
-
Constructor Summary
Constructors Constructor Description MathHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static float
abs(float value)
static int
abs_int(int value)
+ Returns the unsigned value of an int.static double
abs_max(double parDouble1, double parDouble2)
+ Maximum of the absolute value of two numbers.static double
average(long[] values)
static int
bucketInt(int parInt1, int parInt2)
+ Buckets an integer with specifed bucket sizes.static int
calculateLogBaseTwo(int value)
+ Efficiently calculates the floor of the base-2 log of an integer value.static int
ceiling_double_int(double value)
static int
ceiling_float_int(float value)
static double
clamp_double(double num, double min, double max)
static float
clamp_float(float num, float min, float max)
+ Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and third parametersstatic int
clamp_int(int num, int min, int max)
+ Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and third parameters.static float
cos(float value)
+ cos looked up in the sin table with the appropriate offsetstatic double
denormalizeClamp(double parDouble1, double parDouble2, double parDouble3)
static boolean
epsilonEquals(float parFloat1, float parFloat2)
static int
floor_double(double value)
+ Returns the greatest integer less than or equal to the double argumentstatic long
floor_double_long(double value)
+ Long version of floor_doublestatic int
floor_float(float value)
+ Returns the greatest integer less than or equal to the float argumentstatic int
func_154353_e(double value)
static int
func_154354_b(int parInt1, int parInt2)
static int
func_180181_b(int parInt1, int parInt2, int parInt3)
static int
func_180183_b(float parFloat1, float parFloat2, float parFloat3)
static int
func_180188_d(int parInt1, int parInt2)
static double
func_181159_b(double parDouble1, double parDouble2)
static double
func_181160_c(double parDouble1, double parDouble2, double parDouble3)
static double
func_181161_i(double parDouble1)
static double
func_181162_h(double parDouble1)
static int
func_181758_c(float parFloat1, float parFloat2, float parFloat3)
static long
getCoordinateRandom(int x, int y, int z)
static long
getPositionRandom(Vec3i pos)
static double
getRandomDoubleInRange(EaglercraftRandom parRandom, double parDouble1, double parDouble2)
static int
getRandomIntegerInRange(EaglercraftRandom parRandom, int parInt1, int parInt2)
static EaglercraftUUID
getRandomUuid(EaglercraftRandom rand)
static int
normalizeAngle(int parInt1, int parInt2)
static double
parseDoubleWithDefault(java.lang.String parString1, double parDouble1)
+ parses the string as double or returns the second parameter if it fails.static double
parseDoubleWithDefaultAndMax(java.lang.String parString1, double parDouble1, double parDouble2)
static int
parseIntWithDefault(java.lang.String parString1, int parInt1)
+ parses the string as integer or returns the second parameter if it failsstatic int
parseIntWithDefaultAndMax(java.lang.String parString1, int parInt1, int parInt2)
+ parses the string as integer or returns the second parameter if it fails.static float
randomFloatClamp(EaglercraftRandom parRandom, float parFloat1, float parFloat2)
static int
roundUpToPowerOfTwo(int value)
+ Returns the input value rounded up to the next highest power of two.static float
sin(float parFloat1)
+ sin looked up in a tablestatic float
sqrt_double(double value)
static float
sqrt_float(float value)
static int
truncateDoubleToInt(double value)
+ returns par0 cast as an int, and no greater than Integer.MAX_VALUE-1024static double
wrapAngleTo180_double(double value)
+ the angle is reduced to an angle between -180 and +180 by mod, and a 360 checkstatic float
wrapAngleTo180_float(float value)
+ the angle is reduced to an angle between -180 and +180 by mod, and a 360 check
-
-
-
Method Detail
-
sin
public static float sin(float parFloat1)
+ sin looked up in a table
-
cos
public static float cos(float value)
+ cos looked up in the sin table with the appropriate offset
-
sqrt_float
public static float sqrt_float(float value)
-
sqrt_double
public static float sqrt_double(double value)
-
floor_float
public static int floor_float(float value)
+ Returns the greatest integer less than or equal to the float argument
-
truncateDoubleToInt
public static int truncateDoubleToInt(double value)
+ returns par0 cast as an int, and no greater than Integer.MAX_VALUE-1024
-
floor_double
public static int floor_double(double value)
+ Returns the greatest integer less than or equal to the double argument
-
floor_double_long
public static long floor_double_long(double value)
+ Long version of floor_double
-
func_154353_e
public static int func_154353_e(double value)
-
abs
public static float abs(float value)
-
abs_int
public static int abs_int(int value)
+ Returns the unsigned value of an int.
-
ceiling_float_int
public static int ceiling_float_int(float value)
-
ceiling_double_int
public static int ceiling_double_int(double value)
-
clamp_int
public static int clamp_int(int num, int min, int max)
+ Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and third parameters.
-
clamp_float
public static float clamp_float(float num, float min, float max)
+ Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and third parameters
-
clamp_double
public static double clamp_double(double num, double min, double max)
-
denormalizeClamp
public static double denormalizeClamp(double parDouble1, double parDouble2, double parDouble3)
-
abs_max
public static double abs_max(double parDouble1, double parDouble2)
+ Maximum of the absolute value of two numbers.
-
bucketInt
public static int bucketInt(int parInt1, int parInt2)
+ Buckets an integer with specifed bucket sizes. Args: i, bucketSize
-
getRandomIntegerInRange
public static int getRandomIntegerInRange(EaglercraftRandom parRandom, int parInt1, int parInt2)
-
randomFloatClamp
public static float randomFloatClamp(EaglercraftRandom parRandom, float parFloat1, float parFloat2)
-
getRandomDoubleInRange
public static double getRandomDoubleInRange(EaglercraftRandom parRandom, double parDouble1, double parDouble2)
-
average
public static double average(long[] values)
-
epsilonEquals
public static boolean epsilonEquals(float parFloat1, float parFloat2)
-
normalizeAngle
public static int normalizeAngle(int parInt1, int parInt2)
-
wrapAngleTo180_float
public static float wrapAngleTo180_float(float value)
+ the angle is reduced to an angle between -180 and +180 by mod, and a 360 check
-
wrapAngleTo180_double
public static double wrapAngleTo180_double(double value)
+ the angle is reduced to an angle between -180 and +180 by mod, and a 360 check
-
parseIntWithDefault
public static int parseIntWithDefault(java.lang.String parString1, int parInt1)
+ parses the string as integer or returns the second parameter if it fails
-
parseIntWithDefaultAndMax
public static int parseIntWithDefaultAndMax(java.lang.String parString1, int parInt1, int parInt2)
+ parses the string as integer or returns the second parameter if it fails. this value is capped to par2
-
parseDoubleWithDefault
public static double parseDoubleWithDefault(java.lang.String parString1, double parDouble1)
+ parses the string as double or returns the second parameter if it fails.
-
parseDoubleWithDefaultAndMax
public static double parseDoubleWithDefaultAndMax(java.lang.String parString1, double parDouble1, double parDouble2)
-
roundUpToPowerOfTwo
public static int roundUpToPowerOfTwo(int value)
+ Returns the input value rounded up to the next highest power of two.
-
calculateLogBaseTwo
public static int calculateLogBaseTwo(int value)
+ Efficiently calculates the floor of the base-2 log of an integer value. This is effectively the index of the highest bit that is set. For example, if the number in binary is 0...100101, this will return 5.
-
func_154354_b
public static int func_154354_b(int parInt1, int parInt2)
-
func_180183_b
public static int func_180183_b(float parFloat1, float parFloat2, float parFloat3)
-
func_180181_b
public static int func_180181_b(int parInt1, int parInt2, int parInt3)
-
func_180188_d
public static int func_180188_d(int parInt1, int parInt2)
-
func_181162_h
public static double func_181162_h(double parDouble1)
-
getPositionRandom
public static long getPositionRandom(Vec3i pos)
-
getCoordinateRandom
public static long getCoordinateRandom(int x, int y, int z)
-
getRandomUuid
public static EaglercraftUUID getRandomUuid(EaglercraftRandom rand)
-
func_181160_c
public static double func_181160_c(double parDouble1, double parDouble2, double parDouble3)
-
func_181159_b
public static double func_181159_b(double parDouble1, double parDouble2)
-
func_181161_i
public static double func_181161_i(double parDouble1)
-
func_181758_c
public static int func_181758_c(float parFloat1, float parFloat2, float parFloat3)
-
-