mirror of
https://github.com/italicsjenga/valence.git
synced 2024-12-23 22:41:30 +11:00
Add inventory packets (#57)
Adds the inventory packets so we can use them with `packet_inspector`.
This commit is contained in:
parent
c73df2c09a
commit
7cd3b6cd2d
|
@ -740,8 +740,8 @@ impl<C: Config> Client<C> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
C2sPlayPacket::RequestCommandCompletion(_) => {}
|
C2sPlayPacket::RequestCommandCompletion(_) => {}
|
||||||
C2sPlayPacket::ButtonClick(_) => {}
|
C2sPlayPacket::ClickContainerButton(_) => {}
|
||||||
C2sPlayPacket::ClickSlot(_) => {}
|
C2sPlayPacket::ClickContainer(_) => {}
|
||||||
C2sPlayPacket::CloseHandledScreen(_) => {}
|
C2sPlayPacket::CloseHandledScreen(_) => {}
|
||||||
C2sPlayPacket::CustomPayload(_) => {}
|
C2sPlayPacket::CustomPayload(_) => {}
|
||||||
C2sPlayPacket::BookUpdate(_) => {}
|
C2sPlayPacket::BookUpdate(_) => {}
|
||||||
|
|
|
@ -12,6 +12,7 @@ pub use byte_angle::ByteAngle;
|
||||||
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
pub use slot::Slot;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
pub use var_int::VarInt;
|
pub use var_int::VarInt;
|
||||||
pub use var_long::VarLong;
|
pub use var_long::VarLong;
|
||||||
|
@ -23,7 +24,7 @@ use crate::nbt;
|
||||||
mod byte_angle;
|
mod byte_angle;
|
||||||
pub mod codec;
|
pub mod codec;
|
||||||
pub mod packets;
|
pub mod packets;
|
||||||
pub mod slot;
|
mod slot;
|
||||||
mod var_int;
|
mod var_int;
|
||||||
mod var_long;
|
mod var_long;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ use crate::block_pos::BlockPos;
|
||||||
use crate::ident::Ident;
|
use crate::ident::Ident;
|
||||||
use crate::nbt::Compound;
|
use crate::nbt::Compound;
|
||||||
use crate::protocol::{
|
use crate::protocol::{
|
||||||
BoundedArray, BoundedInt, BoundedString, ByteAngle, Decode, Encode, NbtBridge, RawBytes,
|
BoundedArray, BoundedInt, BoundedString, ByteAngle, Decode, Encode, NbtBridge, RawBytes, Slot,
|
||||||
VarInt, VarLong,
|
VarInt, VarLong,
|
||||||
};
|
};
|
||||||
use crate::text::Text;
|
use crate::text::Text;
|
||||||
|
|
|
@ -98,8 +98,7 @@ pub mod login {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod play {
|
pub mod play {
|
||||||
use super::super::*;
|
use super::*;
|
||||||
use crate::protocol::slot::Slot;
|
|
||||||
|
|
||||||
def_struct! {
|
def_struct! {
|
||||||
TeleportConfirm {
|
TeleportConfirm {
|
||||||
|
@ -243,15 +242,31 @@ pub mod play {
|
||||||
}
|
}
|
||||||
|
|
||||||
def_struct! {
|
def_struct! {
|
||||||
ButtonClick {
|
ClickContainerButton {
|
||||||
window_id: i8,
|
window_id: i8,
|
||||||
button_id: i8,
|
button_id: i8,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def_struct! {
|
def_struct! {
|
||||||
ClickSlot {
|
ClickContainer {
|
||||||
// TODO
|
window_id: u8,
|
||||||
|
state_id: VarInt,
|
||||||
|
slot_idx: i16,
|
||||||
|
button: i8,
|
||||||
|
mode: ClickContainerMode,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def_enum! {
|
||||||
|
ClickContainerMode: VarInt {
|
||||||
|
Click = 0,
|
||||||
|
ShiftClick = 1,
|
||||||
|
Hotbar = 2,
|
||||||
|
CreativeMiddleClick = 3,
|
||||||
|
DropKey = 4,
|
||||||
|
Drag = 5,
|
||||||
|
DoubleClick = 6,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,8 +723,8 @@ pub mod play {
|
||||||
ClientStatus = 7,
|
ClientStatus = 7,
|
||||||
ClientSettings = 8,
|
ClientSettings = 8,
|
||||||
RequestCommandCompletion = 9,
|
RequestCommandCompletion = 9,
|
||||||
ButtonClick = 10,
|
ClickContainerButton = 10,
|
||||||
ClickSlot = 11,
|
ClickContainer = 11,
|
||||||
CloseHandledScreen = 12,
|
CloseHandledScreen = 12,
|
||||||
CustomPayload = 13,
|
CustomPayload = 13,
|
||||||
BookUpdate = 14,
|
BookUpdate = 14,
|
||||||
|
|
|
@ -227,6 +227,39 @@ pub mod play {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def_struct! {
|
||||||
|
SetContainerContent {
|
||||||
|
window_id: u8,
|
||||||
|
state_id: VarInt,
|
||||||
|
slots: Vec<Slot>,
|
||||||
|
carried_item: Slot,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def_struct! {
|
||||||
|
SetContainerProperty {
|
||||||
|
window_id: u8,
|
||||||
|
property: i16,
|
||||||
|
value: i16,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def_struct! {
|
||||||
|
SetContainerSlot {
|
||||||
|
window_id: i8,
|
||||||
|
state_id: VarInt,
|
||||||
|
slot_idx: i16,
|
||||||
|
slot_data: Slot,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def_struct! {
|
||||||
|
SetCooldown {
|
||||||
|
item_id: VarInt,
|
||||||
|
cooldown_ticks: VarInt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def_enum! {
|
def_enum! {
|
||||||
SoundCategory: VarInt {
|
SoundCategory: VarInt {
|
||||||
Master = 0,
|
Master = 0,
|
||||||
|
@ -567,6 +600,14 @@ pub mod play {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def_struct! {
|
||||||
|
OpenScreen {
|
||||||
|
window_id: VarInt,
|
||||||
|
window_type: VarInt,
|
||||||
|
window_title: Text,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def_struct! {
|
def_struct! {
|
||||||
ChatMessage {
|
ChatMessage {
|
||||||
// TODO: more 1.19 stuff.
|
// TODO: more 1.19 stuff.
|
||||||
|
@ -834,6 +875,10 @@ pub mod play {
|
||||||
BlockUpdate = 9,
|
BlockUpdate = 9,
|
||||||
BossBar = 10,
|
BossBar = 10,
|
||||||
ClearTitles = 13,
|
ClearTitles = 13,
|
||||||
|
SetContainerContent = 17,
|
||||||
|
SetContainerProperty = 18,
|
||||||
|
SetContainerSlot = 19,
|
||||||
|
SetCooldown = 20,
|
||||||
PlaySoundId = 23,
|
PlaySoundId = 23,
|
||||||
Disconnect = 25,
|
Disconnect = 25,
|
||||||
EntityStatus = 26,
|
EntityStatus = 26,
|
||||||
|
@ -845,6 +890,7 @@ pub mod play {
|
||||||
MoveRelative = 40,
|
MoveRelative = 40,
|
||||||
RotateAndMoveRelative = 41,
|
RotateAndMoveRelative = 41,
|
||||||
Rotate = 42,
|
Rotate = 42,
|
||||||
|
OpenScreen = 45,
|
||||||
ChatMessage = 51,
|
ChatMessage = 51,
|
||||||
UpdatePlayerList = 55,
|
UpdatePlayerList = 55,
|
||||||
PlayerPositionLook = 57,
|
PlayerPositionLook = 57,
|
||||||
|
|
Loading…
Reference in a new issue