LiquidLayer 5.47.0
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()
public static function canContainWater(int $stateId) : boolReturns whether the block state can hold water in the liquid layer (waterloggable blocks).
hasLayerWaterAt()
public static function hasLayerWaterAt(\pocketmine\world\World $world, int $x, int $y, int $z) : boolReturns 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()
public static function hasWaterAt(\pocketmine\world\World $world, int $x, int $y, int $z) : boolReturns 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()
public static function hasWaterInSubChunk(\pocketmine\world\format\SubChunk $subChunk, int $x, int $y, int $z) : boolReturns whether the block at the given coordinates of the subchunk (relative to it) is water or holds water: see LiquidLayer::hasWaterAt().
holdsWater()
public static function holdsWater(\pocketmine\block\Block $block) : boolReturns 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()
public static function isWater(\pocketmine\block\Block $block) : boolReturns 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()
public static function isWaterInSubChunk(\pocketmine\world\format\SubChunk $subChunk, int $x, int $y, int $z) : boolReturns 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()
public static function isWaterSourceState(int $stateId) : boolReturns whether the block state is a water source block.
isWaterState()
public static function isWaterState(int $stateId) : boolReturns whether the block state is water itself: a water block (source or flowing), or a Waterlogged block whose state holds water (kelp, seagrass...).
