1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

fix random warnings

This commit is contained in:
mat 2022-01-02 17:42:41 -06:00
parent 45871fc01e
commit 394f996df2
8 changed files with 6 additions and 21 deletions

View file

@ -70,13 +70,6 @@ pub async fn join_server(address: &ServerAddress) -> Result<(), String> {
GamePacket::ClientboundCustomPayloadPacket(p) => {
println!("Got custom payload packet {:?}", p);
}
// GamePacket::ClientboundKeepAlivePacket(p) => {
// println!("Got keep alive packet {:?}", p.keep_alive_id);
// }
// GamePacket::ClientboundChatMessagePacket(p) => {
// println!("Got chat message packet {:?}", p.message);
// }
_ => panic!("unhandled packet"),
},
Err(e) => {
println!("Error: {:?}", e);

View file

@ -1,5 +1,3 @@
use azalea_chat;
#[derive(Hash, Clone, Debug)]
pub enum GameType {
SURVIVAL,

View file

@ -24,7 +24,7 @@ fn as_packet_derive(
// do a different buf.write_* for each field depending on the type
// if it's a string, use buf.write_string
match field_type {
syn::Type::Path(syn::TypePath { path, .. }) => {
syn::Type::Path(_) => {
if f.attrs.iter().any(|attr| attr.path.is_ident("varint")) {
quote! {
crate::mc_buf::McBufVarintWritable::varint_write_into(&self.#field_name, buf)?;
@ -52,7 +52,7 @@ fn as_packet_derive(
// do a different buf.write_* for each field depending on the type
// if it's a string, use buf.write_string
match field_type {
syn::Type::Path(syn::TypePath { path, .. }) => {
syn::Type::Path(_) => {
if f.attrs.iter().any(|a| a.path.is_ident("varint")) {
quote! {
let #field_name = crate::mc_buf::McBufVarintReadable::varint_read_into(buf).await?;

View file

@ -265,14 +265,14 @@ impl McBufWritable for GameType {
// Option<GameType>
impl McBufWritable for Option<GameType> {
fn write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
buf.write_byte(GameType::to_optional_id(&self) as u8)
buf.write_byte(GameType::to_optional_id(self) as u8)
}
}
// Vec<ResourceLocation>
impl McBufWritable for Vec<ResourceLocation> {
fn write_into(&self, buf: &mut Vec<u8>) -> Result<(), std::io::Error> {
buf.write_list(&self, |buf, resource_location| {
buf.write_list(self, |buf, resource_location| {
buf.write_resource_location(resource_location)
})
}

View file

@ -1,4 +1,3 @@
use crate::mc_buf::{Readable, Writable};
use azalea_core::resource_location::ResourceLocation;
use packet_macros::GamePacket;

View file

@ -1,8 +1,4 @@
use crate::{
mc_buf::{Readable, Writable},
packets::ConnectionProtocol,
};
use num_traits::FromPrimitive;
use crate::packets::ConnectionProtocol;
use packet_macros::HandshakePacket;
use std::hash::Hash;

View file

@ -1,4 +1,3 @@
use crate::mc_buf::{Readable, Writable};
use azalea_core::resource_location::ResourceLocation;
use packet_macros::LoginPacket;
use std::hash::Hash;

View file

@ -17,7 +17,7 @@ fn packet_encoder<P: ProtocolPacket + std::fmt::Debug>(packet: &P) -> Result<Vec
let mut buf = Vec::new();
buf.write_varint(packet.id() as i32)
.map_err(|e| e.to_string())?;
packet.write(&mut buf);
packet.write(&mut buf).map_err(|e| e.to_string())?;
if buf.len() > MAXIMUM_UNCOMPRESSED_LENGTH as usize {
return Err(format!(
"Packet too big (is {} bytes, should be less than {}): {:?}",