Skip to main content

LevelAccessor

Trait LevelAccessor 

Source
pub trait LevelAccessor: ScheduledTickAccess {
    // Required method
    fn set_block_state(
        &self,
        pos: BlockPos,
        state: BlockStateId,
        flags: UpdateFlags,
    ) -> bool;

    // Provided methods
    fn play_block_sound(
        &self,
        sound: SoundEventRef,
        pos: BlockPos,
        volume: f32,
        pitch: f32,
        exclude: Option<i32>,
    ) { ... }
    fn game_event(
        &self,
        event: GameEventRef,
        pos: BlockPos,
        context: &GameEventContext<'_>,
    ) { ... }
}
Expand description

Mutable level access needed by vanilla LevelAccessor block hooks.

Required Methods§

Source

fn set_block_state( &self, pos: BlockPos, state: BlockStateId, flags: UpdateFlags, ) -> bool

Sets a block state with vanilla update flags.

Provided Methods§

Source

fn play_block_sound( &self, sound: SoundEventRef, pos: BlockPos, volume: f32, pitch: f32, exclude: Option<i32>, )

Plays a block sound when this level surface supports runtime side effects.

Source

fn game_event( &self, event: GameEventRef, pos: BlockPos, context: &GameEventContext<'_>, )

Dispatches a game event when this level surface supports runtime listeners.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl LevelAccessor for Arc<World>

Source§

fn set_block_state( &self, pos: BlockPos, state: BlockStateId, flags: UpdateFlags, ) -> bool

Source§

fn play_block_sound( &self, sound: SoundEventRef, pos: BlockPos, volume: f32, pitch: f32, exclude: Option<i32>, )

Source§

fn game_event( &self, event: GameEventRef, pos: BlockPos, context: &GameEventContext<'_>, )

Implementors§