Skip to content

JavaBlocks 5.46.0 ​

final class · pocketmine\world\generator\vanilla\feature\block\JavaBlocks · source

Java Edition block states (ids, properties, tags and the physical properties the features use), and their mapping to PocketMine block states through GeyserMC's Java -> Bedrock mappings.

Java state ids are the ones of the Java registry (blocks report), so they are stable for a given Minecraft version and can be used as plain ints everywhere in the feature engine.

One instance per data directory and thread (see get()): the worker threads each build their own.

Constants ​

FLUID_LAVA ​

php
public const FLUID_LAVA = 2

FLUID_NONE ​

php
public const FLUID_NONE = 0

FLUID_WATER ​

php
public const FLUID_WATER = 1

Properties ​

$air ​

php
public readonly int $air

$airBlock ​

php
public readonly int $airBlock

$blockOf ​

php
public array $blockOf

Block index per state id.

$caveAir ​

php
public readonly int $caveAir

$caveAirBlock ​

php
public readonly int $caveAirBlock

$defaultState ​

php
public array $defaultState

$firstState ​

php
public array $firstState

$lava ​

php
public readonly int $lava

$lavaBlock ​

php
public readonly int $lavaBlock

$names ​

php
public array $names

Block name (with namespace) per block index.

$voidAir ​

php
public readonly int $voidAir

$voidAirBlock ​

php
public readonly int $voidAirBlock

$water ​

php
public readonly int $water

$waterBlock ​

php
public readonly int $waterBlock

Methods ​

blockIndex() ​

php
public function blockIndex(string $name) : int

blockName() ​

php
public function blockName(int $state) : string

blockSet() ​

php
public function blockSet(mixed $json) : array

Resolves a block holder set: a tag ("#minecraft:x"), one block id or a list of block ids.

collisionBoxes() ​

php
public function collisionBoxes(int $state) : array

Boxes of the collision shape (minX, minY, minZ, maxX, maxY, maxZ in block units).

collisionMaxY() ​

php
public function collisionMaxY(int $state) : float

Top of the collision shape (0 without collision).

dataStateId() ​

php
public static function dataStateId(self $blocks, array $json, string $key) : int

defaultOf() ​

php
public function defaultOf(string $name) : int

describe() ​

php
public function describe(int $state) : string

Debug name of a state, e.g. "minecraft:oak_log[axis=y]".

fluid() ​

php
public function fluid(int $state) : int

Fluid of the state: FLUID_NONE, FLUID_WATER or FLUID_LAVA in the low bits, with bit 4 set for source fluids.

fluidInTag() ​

php
public function fluidInTag(int $state, string $tag) : bool

Whether the fluid of the state is in a fluid tag ("minecraft:water", "minecraft:lava").

fluidIsSource() ​

php
public function fluidIsSource(int $state) : bool

fromPm() ​

php
public function fromPm(int $pmState, bool $wet = false) : int

Java state for a PocketMine state id (and whether the liquid layer has water). Several Java states can map to the same Bedrock state (e.g. leaf distances, waterlogging): the Java default state of the block is preferred.

get() ​

php
public static function get(string $dataDir) : self

getBool() ​

php
public function getBool(int $state, string $property) : bool

getDataDir() ​

php
public function getDataDir() : string

getInt() ​

php
public function getInt(int $state, string $property) : int

getProperty() ​

php
public function getProperty(int $state, string $property) : ?string

Returns the value of a property, or null if the block does not have it.

hasBlock() ​

php
public function hasBlock(string $name) : bool

hasCollision() ​

php
public function hasCollision(int $state) : bool

hasProperty() ​

php
public function hasProperty(int $state, string $property) : bool

hasTag() ​

php
public function hasTag(string $name) : bool

is() ​

php
public function is(int $state, int $block) : bool

isAir() ​

php
public function isAir(int $state) : bool

isFaceSturdy() ​

php
public function isFaceSturdy(int $state, int $face) : bool

Whether the collision shape covers the whole face (approximation of Java's sturdy face check with the support shape, exact for full blocks).

isFullCube() ​

php
public function isFullCube(int $state) : bool

Full cube collision (used as "solid render" / full block checks).

isLava() ​

php
public function isLava(int $state) : bool

isSolid() ​

php
public function isSolid(int $state) : bool

Java's legacy "solid" flag (BlockStateBase.isSolid()): forced for some blocks, otherwise derived from the collision shape (average box size >= 0.7291666666666666 or full height).

isTagged() ​

php
public function isTagged(int $state, string $tag) : bool

isWater() ​

php
public function isWater(int $state) : bool

namespaced() ​

php
public static function namespaced(string $name) : string

parseState() ​

php
public function parseState(string $string) : int

Parses "minecraft:name[prop=value,...]".

pmAirState() ​

php
public function pmAirState() : int

pmNeedsWater() ​

php
public function pmNeedsWater(int $state) : bool

Whether the Bedrock block of this Java state keeps water in the liquid layer (waterlogged blocks, seagrass, kelp...).

pmWaterState() ​

php
public function pmWaterState() : int

propertyNames() ​

php
public function propertyNames(int $state) : array

propertyValues() ​

php
public function propertyValues(int $state, string $property) : array

stateCount() ​

php
public function stateCount() : int

stateFromJson() ​

php
public function stateFromJson(mixed $json) : int

Reads a block state in the worldgen JSON format: {"Name": ..., "Properties": {...}} (older) or {"id": ..., "properties": {...}} / plain "minecraft:name" (26.x).

stripNamespace() ​

php
public static function stripNamespace(string $id) : string

tag() ​

php
public function tag(string $name) : array

Returns the set of block indexes in a tag (name with or without "#" and namespace).

toPm() ​

php
public function toPm(int $state) : int

PocketMine state id for a Java state. Blocks PocketMine does not know become air.

toPmBlock() ​

php
public function toPmBlock(int $state) : \pocketmine\block\Block

with() ​

php
public function with(int $state, string $property, string $value) : int

Returns the state with a property changed (unchanged if the block does not have the property or the value).

withBool() ​

php
public function withBool(int $state, string $property, bool $value) : int

withInt() ​

php
public function withInt(int $state, string $property, int $value) : int

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