Skip to content

Beardifier 5.46.0 ​

final class · pocketmine\world\generator\vanilla\structure\Beardifier · source

vanilla's Beardifier: the density added to the terrain's final density around the pieces of structures with a terrain adaptation (beard_thin, beard_box, bury, encapsulate) and around jigsaw junctions, so that the terrain fills the space under the pieces and clears the space inside them, with smooth slopes. Applied by the terrain fillers (PHP and the native core, which must compute exactly the same values: everything is float32 arithmetic like Java 26.3, rounded with f()).

The rigids and junctions are in vanilla's order for one start (pieces in order); starts are in StructureManager::getStartsAffecting() order (Java iterates a hash map, so the order of starts, which only changes the last bit of sums, cannot be reproduced anyway).

Constants ​

BEARD_BOX ​

php
public const BEARD_BOX = 3

BEARD_THIN ​

php
public const BEARD_THIN = 2

BURY ​

php
public const BURY = 1

ENCAPSULATE ​

php
public const ENCAPSULATE = 4

JUNCTION_SIZE ​

php
public const JUNCTION_SIZE = 3

Junction record size: source x, source ground y, source z.

NONE ​

php
public const NONE = 0

RIGID_SIZE ​

php
public const RIGID_SIZE = 8

Rigid record size: minX, minY, minZ, maxX, maxY, maxZ, adaptation, ground level delta.

Properties ​

$affected ​

php
public readonly array $affected

$junctions ​

php
public readonly array $junctions

$rigids ​

php
public readonly array $rigids

Methods ​

__construct() ​

php
public function __construct(array $rigids, array $junctions, array $affected)

adaptation() ​

php
public static function adaptation(string $name) : int

column() ​

php
public function column(int $x, int $z, int $fromY, int $toY) : array

The density added at each y of a column (Beardifier.sampleValue(), float32 values), for y from $fromY to $toY (inclusive), or [] if the column is outside the affected area. The values start at $fromY clamped to the affected area: returns [first y, list of values].

encode() ​

php
public function encode() : string

Wire form for the native core: u16 rigid count, rigids (8 x i32), u16 junction count, junctions (3 x i32), affected area (6 x i32), all little-endian.

f() ​

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

Rounds to the nearest float32 (Veltkamp splitting, same as the native core's fround()).

fastInvSqrt() ​

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

Mth.fastInvSqrt(double)

forStructuresInChunk() ​

php
public static function forStructuresInChunk(array $starts, int $chunkX, int $chunkZ) : ?self

Beardifier.forStructuresInChunk(): the rigid pieces (all pieces of code-built structures, rigid jigsaw pieces) within 12 blocks of the chunk and the junctions of jigsaw pieces near it, or null if there are none.

kernel() ​

php
public static function kernel() : array

BEARD_KERNEL: (float) Math.pow(e, -(dx² + (dy + 0.5)² + dz²) / 16), index (z * 24 + x) * 24 + y.

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