pub struct MemoryWorld<S> { /* private fields */ }Expand description
A small in-memory world: explicitly loaded chunk columns, everything else unloaded.
Meant for tests, benches and offline planning. Blocks are stored per column in a dense array
of raw values (u16), so lookups are a hash of the column plus an index.
Implementations§
Source§impl<S: Copy> MemoryWorld<S>
impl<S: Copy> MemoryWorld<S>
Sourcepub fn new(decode: fn(u16) -> S) -> Self
pub fn new(decode: fn(u16) -> S) -> Self
An empty world where nothing is loaded. decode turns a stored raw value into a state
(for 1.8: BlockState::from_raw_vanilla); raw 0 must decode to air.
Sourcepub fn load_chunks(&mut self, cx0: i32, cz0: i32, cx1: i32, cz1: i32)
pub fn load_chunks(&mut self, cx0: i32, cz0: i32, cx1: i32, cz1: i32)
Marks the inclusive chunk rectangle [cx0, cz0] ..= [cx1, cz1] as loaded (air until
blocks are set).
Trait Implementations§
Source§impl<S: Copy> BlockView for MemoryWorld<S>
impl<S: Copy> BlockView for MemoryWorld<S>
Source§type State = S
type State = S
Block state type of the protocol version (
ghast_data::v1_8::BlockState for 1.8).Source§fn block(&self, x: i32, y: i32, z: i32) -> S
fn block(&self, x: i32, y: i32, z: i32) -> S
The block state at a valid position (air when the column is not loaded).
Source§fn is_chunk_loaded(&self, chunk_x: i32, chunk_z: i32) -> bool
fn is_chunk_loaded(&self, chunk_x: i32, chunk_z: i32) -> bool
true when the chunk column (chunk_x, chunk_z) has been received from the server.Source§fn world_border(&self) -> WorldBorder
fn world_border(&self) -> WorldBorder
The current world border (default: vanilla’s initial border, centre 0, 0, size 6e7).
Source§impl<S: Clone> Clone for MemoryWorld<S>
impl<S: Clone> Clone for MemoryWorld<S>
Auto Trait Implementations§
impl<S> Forget for MemoryWorld<S>
impl<S> Freeze for MemoryWorld<S>
impl<S> Move for MemoryWorld<S>
impl<S> RefUnwindSafe for MemoryWorld<S>
impl<S> Send for MemoryWorld<S>
impl<S> Sync for MemoryWorld<S>
impl<S> Unpin for MemoryWorld<S>
impl<S> UnsafeUnpin for MemoryWorld<S>where
*const u8 is !null: UnsafeUnpin,
PhantomData<((i32, i32), Box<[u16]>)>: UnsafeUnpin,
PhantomData<[i32; 4]>: UnsafeUnpin,
impl<S> UnwindSafe for MemoryWorld<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more