PathBlockTypes 5.46.0
final class · pocketmine\entity\ai\navigation\PathBlockTypes · source
Classifies block states for mob navigation and line of sight, reading block state IDs straight from chunks (no Block objects on the hot path). The classification of each state ID is computed once and cached.
Constants
CLIMBABLE
public const CLIMBABLE = 128Ladders and vines.
CLOSED_DOOR
public const CLOSED_DOOR = 256Closed door: only passable for mobs which open doors (see PathFinder::setCanOpenDoors()).
DANGER
public const DANGER = 8Hurts mobs standing in or on it (fire, lava, cactus, magma, berry bush...).
FLOOR
public const FLOOR = 2Mobs can stand on top of it (collision top between 0.5 and 1).
LOW
public const LOW = 4Low collision (slab, carpet, snow layer): mobs stand on it from inside its cell.
OPAQUE
public const OPAQUE = 64Blocks line of sight.
OPENABLE_DOOR
public const OPENABLE_DOOR = 512Door mobs can open (not iron doors).
PASSABLE
public const PASSABLE = 1No collision: entities can be inside it.
TALL
public const TALL = 32Collision taller than a block (fences, walls, closed fence gates): can't be stepped or jumped over.
WATER
public const WATER = 16Methods
at()
public static function at(\pocketmine\world\World $world, int $x, int $y, int $z) : intReturns the flags of the block at the given position. Unloaded chunks are solid; above the world is air.
classify()
public static function classify(\pocketmine\block\Block $block) : intinChunk()
public static function inChunk(\pocketmine\world\World $world, ?\pocketmine\world\format\Chunk $chunk, int $x, int $y, int $z) : intSame as PathBlockTypes::at() with a chunk the caller already looked up (null = unloaded).
isStandable()
public static function isStandable(\pocketmine\world\World $world, int $x, int $y, int $z, int $headBlocks, bool $allowWater = true) : boolReturns whether a mob needing $headBlocks free blocks above its feet can stand with its feet in this block (same rules as the path finder, without its per-search cache).
ofState()
public static function ofState(\pocketmine\world\World $world, int $stateId, int $x, int $y, int $z) : intFlags of the given block state at the given position (the position is only used to build the block the first time this state is seen). For callers which already read the state ID.
