diff options
| -rw-r--r-- | azalea-protocol/packet-macros/src/lib.rs | 8 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs | 4 | ||||
| -rwxr-xr-x | azalea-protocol/src/read.rs | 5 |
3 files changed, 8 insertions, 9 deletions
diff --git a/azalea-protocol/packet-macros/src/lib.rs b/azalea-protocol/packet-macros/src/lib.rs index f96a85c7..4f47c9a9 100644 --- a/azalea-protocol/packet-macros/src/lib.rs +++ b/azalea-protocol/packet-macros/src/lib.rs @@ -254,18 +254,18 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream { if !has_serverbound_packets { serverbound_id_match_contents.extend(quote! { - _ => panic!("This enum is empty and can't exist.") + _ => unreachable!("This enum is empty and can't exist.") }); serverbound_write_match_contents.extend(quote! { - _ => panic!("This enum is empty and can't exist.") + _ => unreachable!("This enum is empty and can't exist.") }); } if !has_clientbound_packets { clientbound_id_match_contents.extend(quote! { - _ => panic!("This enum is empty and can't exist.") + _ => unreachable!("This enum is empty and can't exist.") }); clientbound_write_match_contents.extend(quote! { - _ => panic!("This enum is empty and can't exist.") + _ => unreachable!("This enum is empty and can't exist.") }); } diff --git a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs index da1485d0..1b10b221 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs @@ -209,7 +209,9 @@ impl McBufReadable for Recipe { } else if recipe_type == ResourceLocation::new("minecraft:smithing").unwrap() { RecipeData::Smithing(SmithingRecipe::read_from(buf)?) } else { - panic!("Unknown recipe type sent by server: {}", recipe_type); + return Err(BufReadError::UnexpectedStringEnumVariant { + id: recipe_type.to_string(), + }); }; let recipe = Recipe { identifier, data }; diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs index 85340f5a..e2f6f0aa 100755 --- a/azalea-protocol/src/read.rs +++ b/azalea-protocol/src/read.rs @@ -172,10 +172,7 @@ where azalea_crypto::decrypt_packet(cipher, buf.filled_mut()); } } - match r { - Ok(()) => Poll::Ready(Ok(())), - Err(e) => panic!("{:?}", e), - } + Poll::Ready(r) } Poll::Pending => Poll::Pending, } |
