Skip to content

LiquidLayer 5.47.0 ​

final class · pocketmine\block\utils\LiquidLayer · source

Water held in the liquid layer of the subchunk (block layer 1), where vanilla Bedrock keeps the water of waterlogged blocks: stairs, slabs, fences, corals, glow lichen and many more (see WaterloggableBlockNames). Worlds made by vanilla and the vanilla generator write water there; the server treats it as a water source in the block.

Everything is answered from block state IDs read straight from the chunk, with a per-state cache, and the liquid layer is only read for states which can hold water, so ordinary blocks cost a single array lookup.

Methods ​

canContainWater() ​

php
public static function canContainWater(int $stateId) : bool

Returns whether the block state can hold water in the liquid layer (waterloggable blocks).

hasLayerWaterAt() ​

php
public static function hasLayerWaterAt(\pocketmine\world\World $world, int $x, int $y, int $z) : bool

Returns whether the block at the given position holds water in the liquid layer: a waterloggable block with water in layer 1. Water blocks themselves and Waterlogged blocks whose state holds water return false.

hasWaterAt() ​

php
public static function hasWaterAt(\pocketmine\world\World $world, int $x, int $y, int $z) : bool

Returns whether there is water at the given position: a water block (source or flowing), a Waterlogged block holding water (kelp, seagrass...) or a waterloggable block with water in the liquid layer.

hasWaterInSubChunk() ​

php
public static function hasWaterInSubChunk(\pocketmine\world\format\SubChunk $subChunk, int $x, int $y, int $z) : bool

Returns whether the block at the given coordinates of the subchunk (relative to it) is water or holds water: see LiquidLayer::hasWaterAt().

holdsWater() ​

php
public static function holdsWater(\pocketmine\block\Block $block) : bool

Returns whether the block (taken from the world) holds a water source of its own: a waterlogged Waterlogged block, or a waterloggable block with water in the liquid layer. Water blocks return false.

isWater() ​

php
public static function isWater(\pocketmine\block\Block $block) : bool

Returns whether the block (taken from the world) is water or holds water: water blocks, Waterlogged blocks holding water and waterloggable blocks with water in the liquid layer.

isWaterInSubChunk() ​

php
public static function isWaterInSubChunk(\pocketmine\world\format\SubChunk $subChunk, int $x, int $y, int $z) : bool

Returns whether the liquid layer of the subchunk holds water at the given coordinates (relative to the subchunk). This doesn't check that the block in the main layer can hold water.

isWaterSourceState() ​

php
public static function isWaterSourceState(int $stateId) : bool

Returns whether the block state is a water source block.

isWaterState() ​

php
public static function isWaterState(int $stateId) : bool

Returns whether the block state is water itself: a water block (source or flowing), or a Waterlogged block whose state holds water (kelp, seagrass...).

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.