diff --git a/pumpkin/src/client/player_packet.rs b/pumpkin/src/client/player_packet.rs index b242f2b6b..31ac64077 100644 --- a/pumpkin/src/client/player_packet.rs +++ b/pumpkin/src/client/player_packet.rs @@ -10,7 +10,7 @@ use num_traits::FromPrimitive; use pumpkin_core::text::TextComponent; use pumpkin_entity::EntityId; use pumpkin_inventory::WindowType; -use pumpkin_protocol::server::play::{SCloseContainer, SSetPlayerGround}; +use pumpkin_protocol::server::play::{SCloseContainer, SSetPlayerGround, SUseItem}; use pumpkin_protocol::{ client::play::{ Animation, CAcknowledgeBlockChange, CBlockUpdate, CEntityAnimation, CEntityVelocity, @@ -400,6 +400,11 @@ impl Player { } } + pub fn handle_use_item(&mut self, _server: &mut Server, _use_item: SUseItem) { + // TODO: handle packet correctly + log::error!("An item was used(SUseItem), but the packet is not implemented yet"); + } + pub fn handle_set_held_item(&mut self, _server: &mut Server, held: SSetHeldItem) { let slot = held.slot; if !(0..=8).contains(&slot) { diff --git a/pumpkin/src/entity/player.rs b/pumpkin/src/entity/player.rs index aae763d3d..1450fe718 100644 --- a/pumpkin/src/entity/player.rs +++ b/pumpkin/src/entity/player.rs @@ -239,7 +239,7 @@ impl Player { Ok(()) } SUseItem::PACKET_ID => { - log::error!("An item was used(SUseItem), but the packet is not implemented yet"); + self.handle_use_item(server, SUseItem::read(bytebuf)?); Ok(()) } SSetHeldItem::PACKET_ID => {