Pumpkin/pumpkin-protocol/src/java/client/play/level_event.rs
Alexander Medvedev 7eccda00ff fix: bedrock movement
also added a bunch of docs, and fixed bedrock air bubbles constantly shown, and also fix bedrock block states
2026-01-24 22:05:50 +01:00

38 lines
1.3 KiB
Rust

use pumpkin_data::packet::clientbound::PLAY_LEVEL_EVENT;
use pumpkin_macros::packet;
use pumpkin_util::math::position::BlockPos;
use serde::{Deserialize, Serialize};
/// Triggers a specific sound or particle effect at a world location.
///
/// This packet handles a wide variety of "world-level" events, such as
/// block breaking particles, firework explosions, or ambient sounds
/// like doors opening and portals humming.
#[derive(Serialize, Deserialize)]
#[packet(PLAY_LEVEL_EVENT)]
pub struct CLevelEvent {
/// The ID of the event to trigger.
/// Event IDs are generally divided into Sound Events (1000s) and
/// Particle/Visual Events (2000s).
pub event: i32,
/// The world coordinates where the event occurs.
pub location: BlockPos,
/// Event-specific data (e.g., the block ID for break particles
/// or the direction of a smoke puff).
pub data: i32,
/// If true, the sound is played at a constant volume regardless of
/// the player's distance from the `location`.
pub disable_relative_volume: bool,
}
impl CLevelEvent {
pub fn new(event: i32, location: BlockPos, data: i32, disable_relative_volume: bool) -> Self {
Self {
event,
location,
data,
disable_relative_volume,
}
}
}