pub enum Collision {
Air,
Thin(u8),
PartialFloor(u8),
FullCube,
TallBarrier,
FenceGate,
Fluid,
Climbable,
}Expand description
What a block state does to a body. The classification every walk in this workspace reads; see the module header for the table it stands for.
Deliberately an enum rather than a pair of booleans: the six classes are not the four corners of two independent questions, and naming them is what lets a caller that needs more than passability — a gate is openable, a fluid drowns — ask for the distinction instead of re-deriving it from a block name.
Variants§
Air
One of the three air blocks: nothing here at all.
Thin(u8)
An empty or sub-auto-step collision box — a torch, a carpet, a candle, a
pressure plate, a tuft of grass. Carries the measured top face, which is
under THIN_HEIGHT_16 by construction and is not a floor level.
PartialFloor(u8)
A floor whose walkable top face is below the cell top: a bottom slab, a
deep snow drift, a dirt_path. Carries that height in sixteenths.
FullCube
A full 1×1×1 cube — the conservative default for everything unrecognised.
TallBarrier
A fence or a wall: 1.5 blocks tall on a 1-block cell, so a body neither passes through it nor reaches its top.
FenceGate
A fence gate: a body opens it with the adventure-legal right-click and walks through. Never a floor.
Fluid
Water or lava filling the cell: a body swims, and stands on nothing.
Climbable
A block a body climbs (climbable, every member of
#minecraft:climbable but scaffolding): a ladder’s 3/16 panel against its
support, or a vine’s empty box. A body centred in the cell is clear of
it, and stands on nothing there — what holds a body in this cell is the
climb, and the climb is the nav model’s to judge, with the hold its
support gives it (spec-0099).
Implementations§
Source§impl Collision
impl Collision
Sourcepub fn passes_body(self) -> bool
pub fn passes_body(self) -> bool
Can a body’s own volume occupy this cell?
Sourcepub fn supports_body(self) -> bool
pub fn supports_body(self) -> bool
Can a body stand on this cell? Not the complement of
Collision::passes_body, and that is the whole reason it is a separate
question — a torch is neither, and lava is neither from the other side.
Sourcepub fn floor_top_16(self) -> Option<u8>
pub fn floor_top_16(self) -> Option<u8>
The walkable top face of this block, in sixteenths above its own cell
floor, for a class that supports a body. None for every class that does
not, so a caller cannot silently read a height off a torch.