From f80b0ff22a64b3e09454b365df6f461e0849408b Mon Sep 17 00:00:00 2001 From: Joey Sacchini Date: Fri, 9 Oct 2020 19:18:59 -0400 Subject: interact packet from client has a hand field when action is Interact --- src/v1_15_2.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/v1_15_2.rs') diff --git a/src/v1_15_2.rs b/src/v1_15_2.rs index e56bca1..03b3ac4 100644 --- a/src/v1_15_2.rs +++ b/src/v1_15_2.rs @@ -2453,7 +2453,7 @@ __protocol_body_def_helper!(InteractAtSpec { #[derive(Clone, PartialEq, Debug)] pub enum InteractKind { - Interact, + Interact(Hand), Attack, InteractAt(InteractAtSpec), } @@ -2462,7 +2462,7 @@ impl InteractKind { pub fn id(&self) -> VarInt { use InteractKind::*; match self { - Interact => 0x00, + Interact(_) => 0x00, Attack => 0x01, InteractAt(_) => 0x02, } @@ -2478,6 +2478,7 @@ impl Serialize for InteractKind { use InteractKind::*; match self { InteractAt(body) => to.serialize_other(body), + Interact(hand) => to.serialize_other(hand), _ => Ok(()), } } @@ -2489,7 +2490,7 @@ impl Deserialize for InteractKind { use InteractKind::*; match id.0 { - 0x00 => Deserialized::ok(Interact, data), + 0x00 => Ok(Hand::mc_deserialize(data)?.map(move |hand| Interact(hand))), 0x01 => Deserialized::ok(Attack, data), 0x02 => Ok(InteractAtSpec::mc_deserialize(data)?.map(move |body| InteractAt(body))), other => Err(DeserializeErr::CannotUnderstandValue(format!( @@ -2503,7 +2504,7 @@ impl Deserialize for InteractKind { #[cfg(test)] impl TestRandom for InteractKind { fn test_gen_random() -> Self { - InteractKind::Attack + InteractKind::Interact(Hand::test_gen_random()) } } -- cgit