Skip to main content

ChunkAccess

Trait ChunkAccess 

pub trait ChunkAccess {
    // Required methods
    fn metadata(&self) -> &dyn BlockMetadata;
    fn pos(&self) -> ChunkPos;
    fn seed(&self) -> i64;
    fn min_y(&self) -> i32;
    fn height(&self) -> i32;
    fn state(&self, block: BlockKey) -> BlockState;
    fn state_with(
        &self,
        block: BlockKey,
        properties: &[(&str, &str)],
    ) -> BlockState;
    fn set_block(&mut self, pos: [i32; 3], state: BlockState) -> bool;
}
Expand description

The chunk a generator fills: vanilla’s ChunkAccess, as far as terrain needs it. Positions are world blocks.

Required Methods§

fn metadata(&self) -> &dyn BlockMetadata

Immutable block metadata from this worker’s resource snapshot.

fn pos(&self) -> ChunkPos

ChunkAccess.getPos.

fn seed(&self) -> i64

The world’s seed.

fn min_y(&self) -> i32

getMinY: the level’s lowest block Y.

fn height(&self) -> i32

getHeight: the level’s build height, from its dimension type.

fn state(&self, block: BlockKey) -> BlockState

The block’s default state. Resolve before the terrain-writing loop.

fn state_with(&self, block: BlockKey, properties: &[(&str, &str)]) -> BlockState

A block state with partial properties; missing properties keep defaults. Resolve before the terrain-writing loop, never once per placed block.

fn set_block(&mut self, pos: [i32; 3], state: BlockState) -> bool

setBlockState: write state at pos, answering whether it was written. A position outside the chunk or the build height is skipped.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§