Skip to main content

WorldView

Trait WorldView 

Source
pub trait WorldView {
    // Required methods
    fn is_column_loaded(&self, chunk_x: i32, chunk_z: i32) -> bool;
    fn raw_block(&self, x: i32, y: i32, z: i32) -> Option<u32>;
    fn loaded_columns(&self) -> usize;
    fn entities(&self) -> Option<&Entities>;
    fn block_query(&self, x: i32, y: i32, z: i32) -> Option<BlockQuery>;

    // Provided method
    fn column(&self, chunk_x: i32, chunk_z: i32) -> Option<&Column> { ... }
}
Expand description

Block access for behaviours, independent of the protocol version.

Required Methods§

Source

fn is_column_loaded(&self, chunk_x: i32, chunk_z: i32) -> bool

Whether the chunk column is loaded (sent by the server and not unloaded).

Source

fn raw_block(&self, x: i32, y: i32, z: i32) -> Option<u32>

The block state at a position as the version’s raw id: the 1.8 id << 4 | meta or the 1.16 global palette id (decode it with ghast-data). None when the column is not loaded — never treat that as air.

Source

fn loaded_columns(&self) -> usize

Number of loaded columns.

Source

fn entities(&self) -> Option<&Entities>

The tracked entities (None unless the behaviour asked for crate::Interests::ENTITIES).

Source

fn block_query(&self, x: i32, y: i32, z: i32) -> Option<BlockQuery>

Dig / place facts of a block (hardness, tool group, ray box); None when the column is not loaded.

Provided Methods§

Source

fn column(&self, chunk_x: i32, chunk_z: i32) -> Option<&Column>

The whole loaded column (sections, light / biomes when kept, see crate::Client::world_config) for bulk reads without a call per block. Block states are the version’s raw ids, as in WorldView::raw_block. None when not loaded.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§