Skip to main content

LevelReader

Trait LevelReader 

Source
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§

Source

fn get_block_state(&self, pos: BlockPos) -> BlockStateId

Gets the block state at a position.

Source

fn raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8

Returns vanilla raw brightness at a position after sky darkening.

Source

fn min_y(&self) -> i32

Returns the minimum build height.

Source

fn height(&self) -> i32

Returns the build height.

Provided Methods§

Source

fn get_block_entity(&self, pos: BlockPos) -> Option<SharedBlockEntity>

Gets the block entity at a position when this level surface supports it

Source

fn is_face_sturdy( &self, state: BlockStateId, pos: BlockPos, direction: Direction, ) -> bool

Mirrors vanilla BlockState.isFaceSturdy with full-face support.

Source

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.

Source

fn can_see_sky(&self, pos: BlockPos) -> bool

Returns vanilla BlockAndLightGetter.canSeeSky.

Source

fn ambient_light(&self) -> f32

Returns this dimension’s vanilla ambient light factor.

Source

fn max_y_exclusive(&self) -> i32

Returns the exclusive maximum build height.

Source

fn is_outside_build_height(&self, y: i32) -> bool

Checks if a Y coordinate is outside build height.

Source

fn max_local_raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8

Returns vanilla LevelReader.getMaxLocalRawBrightness.

Source

fn light_level_dependent_magic_value(&self, pos: BlockPos) -> f32

Returns vanilla LevelReader.getLightLevelDependentMagicValue.

Source

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".

Implementations on Foreign Types§

Source§

impl LevelReader for Arc<World>

Source§

fn get_block_state(&self, pos: BlockPos) -> BlockStateId

Source§

fn get_block_entity(&self, pos: BlockPos) -> Option<SharedBlockEntity>

Source§

fn is_face_sturdy_for( &self, state: BlockStateId, pos: BlockPos, direction: Direction, support_type: SupportType, ) -> bool

Source§

fn raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8

Source§

fn can_see_sky(&self, pos: BlockPos) -> bool

Source§

fn ambient_light(&self) -> f32

Source§

fn min_y(&self) -> i32

Source§

fn height(&self) -> i32

Implementors§