Struct ClientPacket
#[non_exhaustive]pub struct ClientPacket {
pub id: Identifier,
pub custom_payload: Option<ClientPayload>,
}Expand description
The metadata of a server play packet observed by Hooks::client_packet.
Fields beyond the type id are exposed only for custom payloads. This is plain mod API data, not the game’s decoded protocol enum.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: IdentifierThe protocol type, such as minecraft:ping or minecraft:custom_payload.
An id outside the protocol’s packet table is reported as horizon:unknown.
custom_payload: Option<ClientPayload>The channel and bytes of a custom payload; None for other packet types.
Implementations§
§impl ClientPacket
impl ClientPacket
pub fn new(
id: Identifier,
custom_payload: Option<ClientPayload>,
) -> ClientPacket
pub fn new( id: Identifier, custom_payload: Option<ClientPayload>, ) -> ClientPacket
Construct packet metadata with an optional custom payload.
Trait Implementations§
§impl Clone for ClientPacket
impl Clone for ClientPacket
§fn clone(&self) -> ClientPacket
fn clone(&self) -> ClientPacket
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for ClientPacket
impl Debug for ClientPacket
§impl PartialEq for ClientPacket
impl PartialEq for ClientPacket
impl StructuralPartialEq for ClientPacket
Auto Trait Implementations§
impl Freeze for ClientPacket
impl RefUnwindSafe for ClientPacket
impl Send for ClientPacket
impl Sync for ClientPacket
impl Unpin for ClientPacket
impl UnsafeUnpin for ClientPacket
impl UnwindSafe for ClientPacket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more