Files
Pumpkin/crates/pumpkin-protocol/src/bedrock/server/interact.rs
Demetrius Kanios 24ae9faa4f chore(bedrock): Update most of the packets to mirror the official docs (#3044)
* chore(bedrock): Update most of the packets to mirror the official docs
more closely.

* Fix typo

* Fix CCreativeContent

* Undo unrelated `registry.rs` change

* Update WIT to merged PR

---------

Signed-off-by: Demetrius Kanios <demetrius@kanios.net>
2026-08-25 09:06:23 -07:00

40 lines
890 B
Rust

// Last verified for v2169
use std::io::{Error, Read};
use pumpkin_macros::packet;
use pumpkin_util::math::vector3::Vector3;
use crate::{codec::var_ulong::VarULong, serial::PacketRead};
#[derive(Debug, PacketRead)]
#[packet(33)]
pub struct SInteract {
pub action: Action,
pub target_runtime_id: VarULong,
pub position: Option<Vector3<f32>>,
}
#[derive(Debug)]
#[repr(u8)]
pub enum Action {
Invalid = 0,
StopRiding = 3,
InteractUpdate = 4,
NpcOpen = 5,
OpenInventory = 6,
}
impl PacketRead for Action {
fn read<R: Read>(reader: &mut R) -> Result<Self, Error> {
match u8::read(reader)? {
0 => Ok(Self::Invalid),
3 => Ok(Self::StopRiding),
4 => Ok(Self::InteractUpdate),
5 => Ok(Self::NpcOpen),
6 => Ok(Self::OpenInventory),
_ => Err(Error::other("")),
}
}
}