Skip to content

API reference Obsidian.API.World.Generator.RandomSources

Mth class

The subset of vanilla's Mth needed for bit-exact world generation and entity rotation. Argument order matches vanilla (the interpolation factor comes first).

public static class Mth

In Obsidian.API.

Methods

ClampedLerp(double, double, double)

public static double ClampedLerp(double delta, double start, double end);

Lerp with delta clamped to [0, 1].

Cos(double)

public static float Cos(double value);

Vanilla's table-based cosine (65536 steps per turn), used by carvers.

Floor(double)

public static int Floor(double value);

Vanilla floor. Matches (int)Math.Floor in range; out-of-range values wrap like Java.

FloorDiv(int, int)

public static int FloorDiv(int value, int divisor);

Java's Math.floorDiv: division rounding towards negative infinity.

FloorMod(int, int)

public static int FloorMod(int value, int divisor);

Java's Math.floorMod: the remainder with the divisor's sign.

GetSeed(int, int, int)

public static long GetSeed(int x, int y, int z);

Vanilla per-position seed hash (Mth.getSeed), used by positional random factories.

public static double Lerp(double delta, double start, double end);public static double Lerp2(double deltaX, double deltaY, double x0y0, double x1y0, double x0y1, double x1y1);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);

LFloor(double)

public static long LFloor(double value);

Vanilla 64-bit floor.

Sin(double)

public static float Sin(double value);

Vanilla's table-based sine (65536 steps per turn), used by carvers.

Smoothstep(double)

public static double Smoothstep(double t);

Quintic smoothstep 6t^5 - 15t^4 + 10t^3 used by Perlin noise.

public static double SmoothstepDerivative(double t);public static double Square(double value);

WrapDegrees(float)

public static float WrapDegrees(float degrees);

Vanilla's wrapDegrees: degrees wrapped into [-180, 180), through the same float remainder, so a wrapped rotation is bit for bit vanilla's.

On this page