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§
Sourcefn set_block_state(
&self,
pos: BlockPos,
state: BlockStateId,
flags: UpdateFlags,
) -> bool
fn set_block_state( &self, pos: BlockPos, state: BlockStateId, flags: UpdateFlags, ) -> bool
Sets a block state with vanilla update flags.
Provided Methods§
Sourcefn play_block_sound(
&self,
sound: SoundEventRef,
pos: BlockPos,
volume: f32,
pitch: f32,
exclude: Option<i32>,
)
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.
Sourcefn game_event(
&self,
event: GameEventRef,
pos: BlockPos,
context: &GameEventContext<'_>,
)
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".