Skip to content

CarverMath 5.46.0 ​

final class · pocketmine\world\generator\vanilla\carver\CarverMath · source

Single precision and lookup-table math used by the carvers, with the results of Minecraft's Mth: sin/cos come from a 65536-entry float table indexed by a double scaled angle, and every float operation of the Java code is rounded to float32 with f() (PHP only has doubles; a double result of one +, -, * or / of two float32 values rounds to the same float32 value as the float operation).

Constants ​

HALF_PI ​

php
public const HALF_PI = 1.5707963705062866

PI ​

php
public const PI = 3.1415927410125732

TWO_PI ​

php
public const TWO_PI = 6.2831854820251465

Methods ​

cos() ​

php
public static function cos(float $value) : float

Mth.cos(double)

f() ​

php
public static function f(float $x) : float

Rounds to the nearest float32 (Veltkamp splitting, like FloatMath::fround()).

floor() ​

php
public static function floor(float $value) : int

Mth.floor(double)

sin() ​

php
public static function sin(float $value) : float

Mth.sin(double)

sinTable() ​

php
public static function sinTable() : array

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.