JavaBlocks 5.46.0
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
public const FLUID_LAVA = 2FLUID_NONE
public const FLUID_NONE = 0FLUID_WATER
public const FLUID_WATER = 1Properties
$air
public readonly int $air$airBlock
public readonly int $airBlock$blockOf
public array $blockOfBlock index per state id.
$caveAir
public readonly int $caveAir$caveAirBlock
public readonly int $caveAirBlock$defaultState
public array $defaultState$firstState
public array $firstState$lava
public readonly int $lava$lavaBlock
public readonly int $lavaBlock$names
public array $namesBlock name (with namespace) per block index.
$voidAir
public readonly int $voidAir$voidAirBlock
public readonly int $voidAirBlock$water
public readonly int $water$waterBlock
public readonly int $waterBlockMethods
blockIndex()
public function blockIndex(string $name) : intblockName()
public function blockName(int $state) : stringblockSet()
public function blockSet(mixed $json) : arrayResolves a block holder set: a tag ("#minecraft:x"), one block id or a list of block ids.
collisionBoxes()
public function collisionBoxes(int $state) : arrayBoxes of the collision shape (minX, minY, minZ, maxX, maxY, maxZ in block units).
collisionMaxY()
public function collisionMaxY(int $state) : floatTop of the collision shape (0 without collision).
dataStateId()
public static function dataStateId(self $blocks, array $json, string $key) : intdefaultOf()
public function defaultOf(string $name) : intdescribe()
public function describe(int $state) : stringDebug name of a state, e.g. "minecraft:oak_log[axis=y]".
fluid()
public function fluid(int $state) : intFluid of the state: FLUID_NONE, FLUID_WATER or FLUID_LAVA in the low bits, with bit 4 set for source fluids.
fluidInTag()
public function fluidInTag(int $state, string $tag) : boolWhether the fluid of the state is in a fluid tag ("minecraft:water", "minecraft:lava").
fluidIsSource()
public function fluidIsSource(int $state) : boolfromPm()
public function fromPm(int $pmState, bool $wet = false) : intJava 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()
public static function get(string $dataDir) : selfgetBool()
public function getBool(int $state, string $property) : boolgetDataDir()
public function getDataDir() : stringgetInt()
public function getInt(int $state, string $property) : intgetProperty()
public function getProperty(int $state, string $property) : ?stringReturns the value of a property, or null if the block does not have it.
hasBlock()
public function hasBlock(string $name) : boolhasCollision()
public function hasCollision(int $state) : boolhasProperty()
public function hasProperty(int $state, string $property) : boolhasTag()
public function hasTag(string $name) : boolis()
public function is(int $state, int $block) : boolisAir()
public function isAir(int $state) : boolisFaceSturdy()
public function isFaceSturdy(int $state, int $face) : boolWhether the collision shape covers the whole face (approximation of Java's sturdy face check with the support shape, exact for full blocks).
isFullCube()
public function isFullCube(int $state) : boolFull cube collision (used as "solid render" / full block checks).
isLava()
public function isLava(int $state) : boolisSolid()
public function isSolid(int $state) : boolJava'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()
public function isTagged(int $state, string $tag) : boolisWater()
public function isWater(int $state) : boolnamespaced()
public static function namespaced(string $name) : stringparseState()
public function parseState(string $string) : intParses "minecraft:name[prop=value,...]".
pmAirState()
public function pmAirState() : intpmNeedsWater()
public function pmNeedsWater(int $state) : boolWhether the Bedrock block of this Java state keeps water in the liquid layer (waterlogged blocks, seagrass, kelp...).
pmWaterState()
public function pmWaterState() : intpropertyNames()
public function propertyNames(int $state) : arraypropertyValues()
public function propertyValues(int $state, string $property) : arraystateCount()
public function stateCount() : intstateFromJson()
public function stateFromJson(mixed $json) : intReads a block state in the worldgen JSON format: {"Name": ..., "Properties": {...}} (older) or {"id": ..., "properties": {...}} / plain "minecraft:name" (26.x).
stripNamespace()
public static function stripNamespace(string $id) : stringtag()
public function tag(string $name) : arrayReturns the set of block indexes in a tag (name with or without "#" and namespace).
toPm()
public function toPm(int $state) : intPocketMine state id for a Java state. Blocks PocketMine does not know become air.
toPmBlock()
public function toPmBlock(int $state) : \pocketmine\block\Blockwith()
public function with(int $state, string $property, string $value) : intReturns the state with a property changed (unchanged if the block does not have the property or the value).
withBool()
public function withBool(int $state, string $property, bool $value) : intwithInt()
public function withInt(int $state, string $property, int $value) : int