Create function for packet handling
This commit is contained in:
2 files changed
+7
-2
No files matched your search
@@ -10,7 +10,7 @@ use num_traits::FromPrimitive;
|
|||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use pumpkin_entity::EntityId;
|
use pumpkin_entity::EntityId;
|
||||||
use pumpkin_inventory::WindowType;
|
use pumpkin_inventory::WindowType;
|
||||||
use pumpkin_protocol::server::play::{SCloseContainer, SSetPlayerGround};
|
use pumpkin_protocol::server::play::{SCloseContainer, SSetPlayerGround, SUseItem};
|
||||||
use pumpkin_protocol::{
|
use pumpkin_protocol::{
|
||||||
client::play::{
|
client::play::{
|
||||||
Animation, CAcknowledgeBlockChange, CBlockUpdate, CEntityAnimation, CEntityVelocity,
|
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) {
|
pub fn handle_set_held_item(&mut self, _server: &mut Server, held: SSetHeldItem) {
|
||||||
let slot = held.slot;
|
let slot = held.slot;
|
||||||
if !(0..=8).contains(&slot) {
|
if !(0..=8).contains(&slot) {
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ impl Player {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
SUseItem::PACKET_ID => {
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
SSetHeldItem::PACKET_ID => {
|
SSetHeldItem::PACKET_ID => {
|
||||||
|
|||||||
Reference in new issue
Block a user