pub trait LevelReader {
Show 14 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;
// 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 can_see_sky(&self, pos: BlockPos) -> bool { ... }
fn ambient_light(&self) -> f32 { ... }
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 can_see_sky(&self, pos: BlockPos) -> bool
fn can_see_sky(&self, pos: BlockPos) -> bool
Returns vanilla BlockAndLightGetter.canSeeSky.
Sourcefn ambient_light(&self) -> f32
fn ambient_light(&self) -> f32
Returns this dimension’s vanilla ambient light factor.
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 vanilla LevelReader.getMaxLocalRawBrightness.
Sourcefn light_level_dependent_magic_value(&self, pos: BlockPos) -> f32
fn light_level_dependent_magic_value(&self, pos: BlockPos) -> f32
Returns vanilla LevelReader.getLightLevelDependentMagicValue.
Sourcefn pathfinding_cost_from_light_levels(&self, pos: BlockPos) -> f32
fn pathfinding_cost_from_light_levels(&self, pos: BlockPos) -> f32
Returns vanilla LevelReader.getPathfindingCostFromLightLevels.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".