@@ -123,33 +123,33 @@ impl<V: ProtoVersion> ProtoCodec for PlayerAuthInputPacket<V> {
123123 <V :: NewInteractionModel as ProtoCodec >:: serialize ( & self . new_interaction_model , stream) ?;
124124 if let ClientPlayMode :: Reality = & self . play_mode {
125125 <( f32 , f32 , f32 ) as ProtoCodecLE >:: serialize (
126- self . vr_gaze_direction . as_ref ( ) . unwrap ( ) ,
126+ self . vr_gaze_direction . as_ref ( ) . ok_or ( ProtoCodecError :: ExpectedSome ( "vr_gaze_direction" ) ) ? ,
127127 stream,
128128 ) ?;
129129 }
130130 <u64 as ProtoCodecVAR >:: serialize ( & self . client_tick , stream) ?;
131131 <( f32 , f32 , f32 ) as ProtoCodecLE >:: serialize ( & self . velocity , stream) ?;
132132 if self . input_data & PlayerAuthInputFlags :: PerformItemInteraction as u64 != 0 {
133133 <V :: PackedItemUseLegacyInventoryTransaction as ProtoCodec >:: serialize (
134- self . item_use_transaction . as_ref ( ) . unwrap ( ) ,
134+ self . item_use_transaction . as_ref ( ) . ok_or ( ProtoCodecError :: ExpectedSome ( "item_use_transaction" ) ) ? ,
135135 stream,
136136 ) ?;
137137 }
138138 if self . input_data & PlayerAuthInputFlags :: PerformItemStackRequest as u64 != 0 {
139139 <PerformItemStackRequestData < V > as ProtoCodec >:: serialize (
140- self . item_stack_request . as_ref ( ) . unwrap ( ) ,
140+ self . item_stack_request . as_ref ( ) . ok_or ( ProtoCodecError :: ExpectedSome ( "item_stack_request" ) ) ? ,
141141 stream,
142142 ) ?;
143143 }
144144 if self . input_data & PlayerAuthInputFlags :: PerformBlockActions as u64 != 0 {
145145 <Vec < V :: PlayerBlockActionData > as ProtoCodec >:: serialize (
146- self . player_block_actions . as_ref ( ) . unwrap ( ) ,
146+ self . player_block_actions . as_ref ( ) . ok_or ( ProtoCodecError :: ExpectedSome ( "player_block_actions" ) ) ? ,
147147 stream,
148148 ) ?;
149149 }
150150 if self . input_data & PlayerAuthInputFlags :: IsInClientPredictedVehicle as u64 != 0 {
151151 <ClientPredictedVehicleData < V > as ProtoCodec >:: serialize (
152- self . client_predicted_vehicle . as_ref ( ) . unwrap ( ) ,
152+ self . client_predicted_vehicle . as_ref ( ) . ok_or ( ProtoCodecError :: ExpectedSome ( "client_predicted_vehicle" ) ) ? ,
153153 stream,
154154 ) ?;
155155 }
@@ -239,19 +239,19 @@ impl<V: ProtoVersion> ProtoCodec for PlayerAuthInputPacket<V> {
239239 + ProtoCodecVAR :: size_hint ( & self . client_tick )
240240 + ProtoCodecLE :: size_hint ( & self . velocity )
241241 + match self . input_data & PlayerAuthInputFlags :: PerformItemInteraction as u64 != 0 {
242- true => self . item_use_transaction . size_hint ( ) ,
242+ true => self . item_use_transaction . as_ref ( ) . map_or ( 0 , ProtoCodec :: size_hint ) ,
243243 false => 0 ,
244244 }
245245 + match self . input_data & PlayerAuthInputFlags :: PerformItemStackRequest as u64 != 0 {
246- true => self . item_stack_request . size_hint ( ) ,
246+ true => self . item_stack_request . as_ref ( ) . map_or ( 0 , ProtoCodec :: size_hint ) ,
247247 false => 0 ,
248248 }
249249 + match self . input_data & PlayerAuthInputFlags :: PerformBlockActions as u64 != 0 {
250- true => self . player_block_actions . size_hint ( ) ,
250+ true => self . player_block_actions . as_ref ( ) . map_or ( 0 , ProtoCodec :: size_hint ) ,
251251 false => 0 ,
252252 }
253253 + match self . input_data & PlayerAuthInputFlags :: IsInClientPredictedVehicle as u64 != 0 {
254- true => self . client_predicted_vehicle . size_hint ( ) ,
254+ true => self . client_predicted_vehicle . as_ref ( ) . map_or ( 0 , ProtoCodec :: size_hint ) ,
255255 false => 0 ,
256256 }
257257 + ProtoCodecLE :: size_hint ( & self . analog_move_vector )
0 commit comments