pub trait LevelReader {
Show 17 methods
// Required methods
fn get_block_state(&self, pos: BlockPos) -> BlockStateId;
fn raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8;
fn min_y(&self) -> i32;
fn height(&self) -> i32;
fn sea_level(&self) -> i32;
// Provided methods
fn get_block_entity(&self, pos: BlockPos) -> Option<SharedBlockEntity> { ... }
fn is_face_sturdy(
&self,
state: BlockStateId,
pos: BlockPos,
direction: Direction,
) -> bool { ... }
fn is_face_sturdy_for(
&self,
state: BlockStateId,
pos: BlockPos,
direction: Direction,
support_type: SupportType,
) -> bool { ... }
fn sky_darkening(&self) -> u8 { ... }
fn can_see_sky(&self, pos: BlockPos) -> bool { ... }
fn ambient_light(&self) -> f32 { ... }
fn height_at(&self, _heightmap_type: HeightmapType, _x: i32, _z: i32) -> i32 { ... }
fn max_y_exclusive(&self) -> i32 { ... }
fn is_outside_build_height(&self, y: i32) -> bool { ... }
fn max_local_raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8 { ... }
fn light_level_dependent_magic_value(&self, pos: BlockPos) -> f32 { ... }
fn pathfinding_cost_from_light_levels(&self, pos: BlockPos) -> f32 { ... }
}Expand description
Read-only level access needed by block behavior and worldgen predicates.
Required Methods§
Sourcefn get_block_state(&self, pos: BlockPos) -> BlockStateId
fn get_block_state(&self, pos: BlockPos) -> BlockStateId
Gets the block state at a position.
Sourcefn raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8
fn raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8
Returns vanilla raw brightness at a position after sky darkening.
Provided Methods§
Sourcefn get_block_entity(&self, pos: BlockPos) -> Option<SharedBlockEntity>
fn get_block_entity(&self, pos: BlockPos) -> Option<SharedBlockEntity>
Gets the block entity at a position when this level surface supports it
Sourcefn is_face_sturdy(
&self,
state: BlockStateId,
pos: BlockPos,
direction: Direction,
) -> bool
fn is_face_sturdy( &self, state: BlockStateId, pos: BlockPos, direction: Direction, ) -> bool
Mirrors vanilla BlockState.isFaceSturdy with full-face support.
Sourcefn is_face_sturdy_for(
&self,
state: BlockStateId,
pos: BlockPos,
direction: Direction,
support_type: SupportType,
) -> bool
fn is_face_sturdy_for( &self, state: BlockStateId, pos: BlockPos, direction: Direction, support_type: SupportType, ) -> bool
Mirrors vanilla BlockState.isFaceSturdy for a specific support type.
Lightweight and worldgen views default to extracted support shapes. Live views override this to dispatch through block behavior for dynamic world-dependent shapes.
Sourcefn sky_darkening(&self) -> u8
fn sky_darkening(&self) -> u8
Sky darkening (15 - SKY_LIGHT_LEVEL). Worldgen defaults to zero;
live worlds use the environment attribute.
Sourcefn can_see_sky(&self, pos: BlockPos) -> bool
fn can_see_sky(&self, pos: BlockPos) -> bool
Whether sky light is full. Lightweight views approximate from raw brightness; live worlds read the sky-light layer directly.
Sourcefn ambient_light(&self) -> f32
fn ambient_light(&self) -> f32
Returns this dimension’s vanilla ambient light factor.
Sourcefn height_at(&self, _heightmap_type: HeightmapType, _x: i32, _z: i32) -> i32
fn height_at(&self, _heightmap_type: HeightmapType, _x: i32, _z: i32) -> i32
Returns the vanilla heightmap value at a column.
Sourcefn max_y_exclusive(&self) -> i32
fn max_y_exclusive(&self) -> i32
Returns the exclusive maximum build height.
Sourcefn is_outside_build_height(&self, y: i32) -> bool
fn is_outside_build_height(&self, y: i32) -> bool
Checks if a Y coordinate is outside build height.
Sourcefn max_local_raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8
fn max_local_raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8
Returns raw brightness at a position, treating positions outside the world’s horizontal bounds as fully lit.
Sourcefn light_level_dependent_magic_value(&self, pos: BlockPos) -> f32
fn light_level_dependent_magic_value(&self, pos: BlockPos) -> f32
Converts brightness after current sky darkening to the curved light value.
Sourcefn pathfinding_cost_from_light_levels(&self, pos: BlockPos) -> f32
fn pathfinding_cost_from_light_levels(&self, pos: BlockPos) -> f32
Returns the light-based cost modifier used by mob pathfinding, derived from the light-curved brightness at a position.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".