Package net.frozenblock.lib.math.api
Class AdvancedMath
java.lang.Object
net.frozenblock.lib.math.api.AdvancedMath
Adds more math operations.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcombinations(int n, int r) static doublecutCos(double value, double offset, boolean inverse) static intfactorial(int n) static intgreatestCommonDivisor(int a, int b) Calculates the greatest common divisor (GCD) of two numbers using the Euclidean algorithm.static net.minecraft.core.BlockPosoffset(net.minecraft.core.BlockPos pos, net.minecraft.core.Direction dir) static net.minecraft.core.BlockPosoffset(net.minecraft.core.BlockPos pos, net.minecraft.core.Direction dir, int a) static intpermutations(int n, int r) static net.minecraft.util.RandomSourcerandom()static net.minecraft.core.DirectionrandomDir(net.minecraft.core.Direction.Axis axis) static doublestatic floatrange(float min, float max, float number) static net.minecraft.world.phys.Vec3rotateAboutXZ(net.minecraft.world.phys.Vec3 original, double distanceFrom, double angle) static double[]solveQuadraticEquation(double a, double b, double c) Solves a quadratic equation of the form ax^2 + bx + c = 0.static booleansquareBetween(int x, int z, int between1, int between2) static intwaterLevelReduce(int value) static intwaterToHollowedProperty(int value)
-
Method Details
-
random
public static net.minecraft.util.RandomSource random() -
range
public static float range(float min, float max, float number) -
randomPosNeg
public static double randomPosNeg() -
squareBetween
public static boolean squareBetween(int x, int z, int between1, int between2) -
offset
public static net.minecraft.core.BlockPos offset(net.minecraft.core.BlockPos pos, net.minecraft.core.Direction dir, int a) -
offset
public static net.minecraft.core.BlockPos offset(net.minecraft.core.BlockPos pos, net.minecraft.core.Direction dir) -
waterToHollowedProperty
public static int waterToHollowedProperty(int value) -
waterLevelReduce
public static int waterLevelReduce(int value) -
cutCos
public static double cutCos(double value, double offset, boolean inverse) -
factorial
public static int factorial(int n) -
permutations
public static int permutations(int n, int r) -
combinations
public static int combinations(int n, int r) -
solveQuadraticEquation
public static double[] solveQuadraticEquation(double a, double b, double c) Solves a quadratic equation of the form ax^2 + bx + c = 0.- Parameters:
a- the coefficient of x^2 (must be non-zero)b- the coefficient of xc- the constant term- Returns:
- an array containing the real roots of the equation, or null if no real roots exist
- Throws:
IllegalArgumentException- if a is zero
-
greatestCommonDivisor
public static int greatestCommonDivisor(int a, int b) Calculates the greatest common divisor (GCD) of two numbers using the Euclidean algorithm.- Parameters:
a- the first numberb- the second number- Returns:
- the GCD of a and b
-
randomDir
public static net.minecraft.core.Direction randomDir(net.minecraft.core.Direction.Axis axis) - Parameters:
axis- The axis that should be used to determine a random direction.- Returns:
- A random Direction on a specific Direction.Axis.
-
rotateAboutXZ
public static net.minecraft.world.phys.Vec3 rotateAboutXZ(net.minecraft.world.phys.Vec3 original, double distanceFrom, double angle)
-