Basic handling of Set creative mod slot packet
This commit is contained in:
1 parent
9a10ea4ed9
commit
7b9b35e437
4 files changed
+27
-5
No files matched your search
@@ -29,7 +29,7 @@ use pumpkin_protocol::{
|
||||
play::{
|
||||
SChatCommand, SChatMessage, SClientInformationPlay, SConfirmTeleport, SInteract,
|
||||
SPlayerAction, SPlayerCommand, SPlayerPosition, SPlayerPositionRotation,
|
||||
SPlayerRotation, SSetHeldItem, SSwingArm, SUseItemOn,
|
||||
SPlayerRotation, SSetCreativeSlot, SSetHeldItem, SSwingArm, SUseItemOn,
|
||||
},
|
||||
status::{SPingRequest, SStatusRequest},
|
||||
},
|
||||
@@ -304,6 +304,9 @@ impl Client {
|
||||
SSetHeldItem::PACKET_ID => {
|
||||
self.handle_set_held_item(server, SSetHeldItem::read(bytebuf).unwrap())
|
||||
}
|
||||
SSetCreativeSlot::PACKET_ID => {
|
||||
self.handle_set_creative_slot(server, SSetCreativeSlot::read(bytebuf).unwrap())
|
||||
}
|
||||
_ => log::error!("Failed to handle player packet id {}", packet.id.0),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ use pumpkin_protocol::{
|
||||
client::play::{
|
||||
Animation, CBlockUpdate, CEntityAnimation, CEntityVelocity, CHeadRot, CHurtAnimation,
|
||||
CSystemChatMessge, CUpdateEntityPos, CUpdateEntityPosRot, CUpdateEntityRot,
|
||||
}, position::WorldPosition, server::play::{
|
||||
},
|
||||
position::WorldPosition,
|
||||
server::play::{
|
||||
Action, SChatCommand, SChatMessage, SClientInformationPlay, SConfirmTeleport, SInteract,
|
||||
SPlayerAction, SPlayerCommand, SPlayerPosition, SPlayerPositionRotation, SPlayerRotation,
|
||||
SSetHeldItem, SSwingArm, SUseItemOn,
|
||||
}
|
||||
SSetCreativeSlot, SSetHeldItem, SSwingArm, SUseItemOn,
|
||||
},
|
||||
};
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_world::block::BlockFace;
|
||||
@@ -316,7 +318,7 @@ impl Client {
|
||||
pub fn handle_player_action(&mut self, _server: &mut Server, player_action: SPlayerAction) {}
|
||||
|
||||
pub fn handle_use_item_on(&mut self, server: &mut Server, use_item_on: SUseItemOn) {
|
||||
let mut location = use_item_on.location;
|
||||
let location = use_item_on.location;
|
||||
let face = BlockFace::from_i32(use_item_on.face.0).unwrap();
|
||||
let location = WorldPosition(location.0 + face.to_offset());
|
||||
server.broadcast_packet(self, &CBlockUpdate::new(location, 11.into()));
|
||||
@@ -330,4 +332,9 @@ impl Client {
|
||||
let player = self.player.as_mut().unwrap();
|
||||
player.inventory.set_selected(slot);
|
||||
}
|
||||
|
||||
pub fn handle_set_creative_slot(&mut self, _server: &mut Server, packet: SSetCreativeSlot) {
|
||||
// TODO: handle this
|
||||
dbg!(&packet);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user