Skip to main content

BlockAndTintGetter

Trait BlockAndTintGetter 

pub trait BlockAndTintGetter {
    // Required methods
    fn block_state(&self, pos: [i32; 3]) -> BlockState;
    fn fluid_state(&self, pos: [i32; 3]) -> Option<FluidState>;
    fn brightness(&self, layer: LightLayer, pos: [i32; 3]) -> i32;
    fn raw_brightness(&self, pos: [i32; 3], sky_darken: i32) -> i32;
    fn can_see_sky(&self, pos: [i32; 3]) -> bool;
    fn shade(&self, face: Direction) -> f32;
    fn block_tint(&self, pos: [i32; 3], resolver: ColorResolver) -> u32;
    fn min_y(&self) -> i32;
    fn height(&self) -> i32;
}
Expand description

What a tint source reads of the world around the block it colours: vanilla’s BlockAndTintGetter, over the region a section is meshed from (RenderSectionRegion: the section’s chunk and its eight neighbours). A position outside that region reads as air, no fluid and the light of an unloaded chunk. Block entities are not part of the region.

Required Methods§

fn block_state(&self, pos: [i32; 3]) -> BlockState

BlockGetter.getBlockState: the state at pos.

fn fluid_state(&self, pos: [i32; 3]) -> Option<FluidState>

BlockGetter.getFluidState: the fluid at pos, the empty fluid where there is none. None outside the region, as LevelHost::fluid_state reads an unloaded position.

fn brightness(&self, layer: LightLayer, pos: [i32; 3]) -> i32

BlockAndLightGetter.getBrightness: the stored light of one layer at pos, 0 to 15.

fn raw_brightness(&self, pos: [i32; 3], sky_darken: i32) -> i32

BlockAndLightGetter.getRawBrightness(pos, darkening): the brighter of the block light and the sky light less sky_darken.

fn can_see_sky(&self, pos: [i32; 3]) -> bool

BlockAndLightGetter.canSeeSky: the sky light at pos is full.

fn shade(&self, face: Direction) -> f32

cardinalLighting().byFace(face): how much a face toward face is shaded, 0 to 1 (the Nether’s flat lighting in the Nether).

fn block_tint(&self, pos: [i32; 3], resolver: ColorResolver) -> u32

getBlockTint(pos, resolver): the resolver’s colour at pos blended over the biome blend radius, as opaque ARGB. A mod’s resolver blends as vanilla’s do.

fn min_y(&self) -> i32

LevelHeightAccessor.getMinY: the lowest block Y.

fn height(&self) -> i32

LevelHeightAccessor.getHeight: the build height.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§