Skip to main content

GroundStateProvider

Trait GroundStateProvider 

pub trait GroundStateProvider:
    Send
    + Sync
    + 'static {
    // Required method
    fn state_at(
        &self,
        level: &mut dyn GroundLevel,
        pos: [i32; 3],
    ) -> Option<BlockStateId>;
}
Expand description

A mod’s ground provider: NeoForge’s AlterGroundEvent.StateProvider. Implemented once, kept by the game, deterministic and stateless.

Required Methods§

fn state_at( &self, level: &mut dyn GroundLevel, pos: [i32; 3], ) -> Option<BlockStateId>

StateProvider.getState: the state to place at pos, or None to try the next position down the column, as the decorator’s own provider answers where it finds no ground it replaces. Draw only from level.random(), so the same seed gives the same ground.

Trait Implementations§

§

impl Wire for Box<dyn GroundStateProvider>

§

const MIN: usize = 8

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the writer.
§

fn put_owned(self, out: &mut Writer)

Consumes owned data when a resource’s ownership must cross the boundary.
§

fn take( input: &mut Reader<'_>, ) -> Result<Box<dyn GroundStateProvider>, WireError>

Decodes one value, leaving any following bytes for the caller.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§