mirror of
https://github.com/mat-1/azalea.git
synced 2024-09-20 07:02:31 +00:00
fix errors and warnings
This commit is contained in:
parent
4ee4687053
commit
1b602d0be7
4 changed files with 130 additions and 115 deletions
|
@ -11,13 +11,13 @@ use azalea_protocol::{
|
||||||
serverbound_accept_teleportation_packet::ServerboundAcceptTeleportationPacket,
|
serverbound_accept_teleportation_packet::ServerboundAcceptTeleportationPacket,
|
||||||
serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
|
serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
|
||||||
serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
|
serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
|
||||||
serverbound_move_player_packet_pos_rot::ServerboundMovePlayerPacketPosRot, GamePacket,
|
serverbound_move_player_packet_pos_rot::ServerboundMovePlayerPacketPosRot,
|
||||||
|
ClientboundGamePacket,
|
||||||
},
|
},
|
||||||
handshake::client_intention_packet::ClientIntentionPacket,
|
handshake::client_intention_packet::ClientIntentionPacket,
|
||||||
login::{
|
login::{
|
||||||
serverbound_hello_packet::ServerboundHelloPacket,
|
serverbound_hello_packet::ServerboundHelloPacket,
|
||||||
serverbound_key_packet::{NonceOrSaltSignature, ServerboundKeyPacket},
|
serverbound_key_packet::{NonceOrSaltSignature, ServerboundKeyPacket},
|
||||||
LoginPacket,
|
|
||||||
},
|
},
|
||||||
ConnectionProtocol, PROTOCOL_VERSION,
|
ConnectionProtocol, PROTOCOL_VERSION,
|
||||||
},
|
},
|
||||||
|
@ -203,12 +203,12 @@ impl Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle(
|
async fn handle(
|
||||||
packet: &GamePacket,
|
packet: &ClientboundGamePacket,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
tx: &UnboundedSender<Event>,
|
tx: &UnboundedSender<Event>,
|
||||||
) -> Result<(), HandleError> {
|
) -> Result<(), HandleError> {
|
||||||
match packet {
|
match packet {
|
||||||
GamePacket::ClientboundLoginPacket(p) => {
|
ClientboundGamePacket::ClientboundLoginPacket(p) => {
|
||||||
println!("Got login packet {:?}", p);
|
println!("Got login packet {:?}", p);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -307,40 +307,40 @@ impl Client {
|
||||||
|
|
||||||
tx.send(Event::Login).unwrap();
|
tx.send(Event::Login).unwrap();
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundUpdateViewDistancePacket(p) => {
|
ClientboundGamePacket::ClientboundUpdateViewDistancePacket(p) => {
|
||||||
println!("Got view distance packet {:?}", p);
|
println!("Got view distance packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundCustomPayloadPacket(p) => {
|
ClientboundGamePacket::ClientboundCustomPayloadPacket(p) => {
|
||||||
println!("Got custom payload packet {:?}", p);
|
println!("Got custom payload packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundChangeDifficultyPacket(p) => {
|
ClientboundGamePacket::ClientboundChangeDifficultyPacket(p) => {
|
||||||
println!("Got difficulty packet {:?}", p);
|
println!("Got difficulty packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundDeclareCommandsPacket(_p) => {
|
ClientboundGamePacket::ClientboundDeclareCommandsPacket(_p) => {
|
||||||
println!("Got declare commands packet");
|
println!("Got declare commands packet");
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundPlayerAbilitiesPacket(p) => {
|
ClientboundGamePacket::ClientboundPlayerAbilitiesPacket(p) => {
|
||||||
println!("Got player abilities packet {:?}", p);
|
println!("Got player abilities packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSetCarriedItemPacket(p) => {
|
ClientboundGamePacket::ClientboundSetCarriedItemPacket(p) => {
|
||||||
println!("Got set carried item packet {:?}", p);
|
println!("Got set carried item packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundUpdateTagsPacket(_p) => {
|
ClientboundGamePacket::ClientboundUpdateTagsPacket(_p) => {
|
||||||
println!("Got update tags packet");
|
println!("Got update tags packet");
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundDisconnectPacket(p) => {
|
ClientboundGamePacket::ClientboundDisconnectPacket(p) => {
|
||||||
println!("Got disconnect packet {:?}", p);
|
println!("Got disconnect packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundUpdateRecipesPacket(_p) => {
|
ClientboundGamePacket::ClientboundUpdateRecipesPacket(_p) => {
|
||||||
println!("Got update recipes packet");
|
println!("Got update recipes packet");
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundEntityEventPacket(_p) => {
|
ClientboundGamePacket::ClientboundEntityEventPacket(_p) => {
|
||||||
// println!("Got entity event packet {:?}", p);
|
// println!("Got entity event packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundRecipePacket(_p) => {
|
ClientboundGamePacket::ClientboundRecipePacket(_p) => {
|
||||||
println!("Got recipe packet");
|
println!("Got recipe packet");
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundPlayerPositionPacket(p) => {
|
ClientboundGamePacket::ClientboundPlayerPositionPacket(p) => {
|
||||||
// TODO: reply with teleport confirm
|
// TODO: reply with teleport confirm
|
||||||
println!("Got player position packet {:?}", p);
|
println!("Got player position packet {:?}", p);
|
||||||
|
|
||||||
|
@ -432,10 +432,10 @@ impl Client {
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundPlayerInfoPacket(p) => {
|
ClientboundGamePacket::ClientboundPlayerInfoPacket(p) => {
|
||||||
println!("Got player info packet {:?}", p);
|
println!("Got player info packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSetChunkCacheCenterPacket(p) => {
|
ClientboundGamePacket::ClientboundSetChunkCacheCenterPacket(p) => {
|
||||||
println!("Got chunk cache center packet {:?}", p);
|
println!("Got chunk cache center packet {:?}", p);
|
||||||
client
|
client
|
||||||
.dimension
|
.dimension
|
||||||
|
@ -444,7 +444,7 @@ impl Client {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.update_view_center(&ChunkPos::new(p.x, p.z));
|
.update_view_center(&ChunkPos::new(p.x, p.z));
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundLevelChunkWithLightPacket(p) => {
|
ClientboundGamePacket::ClientboundLevelChunkWithLightPacket(p) => {
|
||||||
println!("Got chunk with light packet {} {}", p.x, p.z);
|
println!("Got chunk with light packet {} {}", p.x, p.z);
|
||||||
let pos = ChunkPos::new(p.x, p.z);
|
let pos = ChunkPos::new(p.x, p.z);
|
||||||
// let chunk = Chunk::read_with_world_height(&mut p.chunk_data);
|
// let chunk = Chunk::read_with_world_height(&mut p.chunk_data);
|
||||||
|
@ -457,10 +457,10 @@ impl Client {
|
||||||
.replace_with_packet_data(&pos, &mut p.chunk_data.data.as_slice())
|
.replace_with_packet_data(&pos, &mut p.chunk_data.data.as_slice())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundLightUpdatePacket(p) => {
|
ClientboundGamePacket::ClientboundLightUpdatePacket(p) => {
|
||||||
println!("Got light update packet {:?}", p);
|
println!("Got light update packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundAddEntityPacket(p) => {
|
ClientboundGamePacket::ClientboundAddEntityPacket(p) => {
|
||||||
println!("Got add entity packet {:?}", p);
|
println!("Got add entity packet {:?}", p);
|
||||||
let entity = Entity::from(p);
|
let entity = Entity::from(p);
|
||||||
client
|
client
|
||||||
|
@ -470,19 +470,19 @@ impl Client {
|
||||||
.expect("Dimension doesn't exist! We should've gotten a login packet by now.")
|
.expect("Dimension doesn't exist! We should've gotten a login packet by now.")
|
||||||
.add_entity(entity);
|
.add_entity(entity);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSetEntityDataPacket(_p) => {
|
ClientboundGamePacket::ClientboundSetEntityDataPacket(_p) => {
|
||||||
// println!("Got set entity data packet {:?}", p);
|
// println!("Got set entity data packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundUpdateAttributesPacket(_p) => {
|
ClientboundGamePacket::ClientboundUpdateAttributesPacket(_p) => {
|
||||||
// println!("Got update attributes packet {:?}", p);
|
// println!("Got update attributes packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundEntityVelocityPacket(_p) => {
|
ClientboundGamePacket::ClientboundEntityVelocityPacket(_p) => {
|
||||||
// println!("Got entity velocity packet {:?}", p);
|
// println!("Got entity velocity packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSetEntityLinkPacket(p) => {
|
ClientboundGamePacket::ClientboundSetEntityLinkPacket(p) => {
|
||||||
println!("Got set entity link packet {:?}", p);
|
println!("Got set entity link packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundAddPlayerPacket(p) => {
|
ClientboundGamePacket::ClientboundAddPlayerPacket(p) => {
|
||||||
println!("Got add player packet {:?}", p);
|
println!("Got add player packet {:?}", p);
|
||||||
let entity = Entity::from(p);
|
let entity = Entity::from(p);
|
||||||
client
|
client
|
||||||
|
@ -492,25 +492,25 @@ impl Client {
|
||||||
.expect("Dimension doesn't exist! We should've gotten a login packet by now.")
|
.expect("Dimension doesn't exist! We should've gotten a login packet by now.")
|
||||||
.add_entity(entity);
|
.add_entity(entity);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundInitializeBorderPacket(p) => {
|
ClientboundGamePacket::ClientboundInitializeBorderPacket(p) => {
|
||||||
println!("Got initialize border packet {:?}", p);
|
println!("Got initialize border packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSetTimePacket(p) => {
|
ClientboundGamePacket::ClientboundSetTimePacket(p) => {
|
||||||
println!("Got set time packet {:?}", p);
|
println!("Got set time packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSetDefaultSpawnPositionPacket(p) => {
|
ClientboundGamePacket::ClientboundSetDefaultSpawnPositionPacket(p) => {
|
||||||
println!("Got set default spawn position packet {:?}", p);
|
println!("Got set default spawn position packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundContainerSetContentPacket(p) => {
|
ClientboundGamePacket::ClientboundContainerSetContentPacket(p) => {
|
||||||
println!("Got container set content packet {:?}", p);
|
println!("Got container set content packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSetHealthPacket(p) => {
|
ClientboundGamePacket::ClientboundSetHealthPacket(p) => {
|
||||||
println!("Got set health packet {:?}", p);
|
println!("Got set health packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSetExperiencePacket(p) => {
|
ClientboundGamePacket::ClientboundSetExperiencePacket(p) => {
|
||||||
println!("Got set experience packet {:?}", p);
|
println!("Got set experience packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundTeleportEntityPacket(p) => {
|
ClientboundGamePacket::ClientboundTeleportEntityPacket(p) => {
|
||||||
let mut dimension_lock = client.dimension.lock()?;
|
let mut dimension_lock = client.dimension.lock()?;
|
||||||
let dimension = dimension_lock.as_mut().unwrap();
|
let dimension = dimension_lock.as_mut().unwrap();
|
||||||
|
|
||||||
|
@ -523,28 +523,28 @@ impl Client {
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundUpdateAdvancementsPacket(p) => {
|
ClientboundGamePacket::ClientboundUpdateAdvancementsPacket(p) => {
|
||||||
println!("Got update advancements packet {:?}", p);
|
println!("Got update advancements packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundRotateHeadPacket(_p) => {
|
ClientboundGamePacket::ClientboundRotateHeadPacket(_p) => {
|
||||||
// println!("Got rotate head packet {:?}", p);
|
// println!("Got rotate head packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundMoveEntityPosPacket(p) => {
|
ClientboundGamePacket::ClientboundMoveEntityPosPacket(p) => {
|
||||||
let mut dimension_lock = client.dimension.lock()?;
|
let mut dimension_lock = client.dimension.lock()?;
|
||||||
let dimension = dimension_lock.as_mut().unwrap();
|
let dimension = dimension_lock.as_mut().unwrap();
|
||||||
|
|
||||||
dimension.move_entity_with_delta(p.entity_id, &p.delta)?;
|
dimension.move_entity_with_delta(p.entity_id, &p.delta)?;
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundMoveEntityPosrotPacket(p) => {
|
ClientboundGamePacket::ClientboundMoveEntityPosrotPacket(p) => {
|
||||||
let mut dimension_lock = client.dimension.lock()?;
|
let mut dimension_lock = client.dimension.lock()?;
|
||||||
let dimension = dimension_lock.as_mut().unwrap();
|
let dimension = dimension_lock.as_mut().unwrap();
|
||||||
|
|
||||||
dimension.move_entity_with_delta(p.entity_id, &p.delta)?;
|
dimension.move_entity_with_delta(p.entity_id, &p.delta)?;
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundMoveEntityRotPacket(p) => {
|
ClientboundGamePacket::ClientboundMoveEntityRotPacket(p) => {
|
||||||
println!("Got move entity rot packet {:?}", p);
|
println!("Got move entity rot packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundKeepAlivePacket(p) => {
|
ClientboundGamePacket::ClientboundKeepAlivePacket(p) => {
|
||||||
println!("Got keep alive packet {:?}", p);
|
println!("Got keep alive packet {:?}", p);
|
||||||
client
|
client
|
||||||
.conn
|
.conn
|
||||||
|
@ -553,48 +553,48 @@ impl Client {
|
||||||
.write(ServerboundKeepAlivePacket { id: p.id }.get())
|
.write(ServerboundKeepAlivePacket { id: p.id }.get())
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundRemoveEntitiesPacket(p) => {
|
ClientboundGamePacket::ClientboundRemoveEntitiesPacket(p) => {
|
||||||
println!("Got remove entities packet {:?}", p);
|
println!("Got remove entities packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundPlayerChatPacket(p) => {
|
ClientboundGamePacket::ClientboundPlayerChatPacket(p) => {
|
||||||
println!("Got player chat packet {:?}", p);
|
println!("Got player chat packet {:?}", p);
|
||||||
tx.send(Event::Chat(ChatPacket::Player(Box::new(p.clone()))))
|
tx.send(Event::Chat(ChatPacket::Player(Box::new(p.clone()))))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSystemChatPacket(p) => {
|
ClientboundGamePacket::ClientboundSystemChatPacket(p) => {
|
||||||
println!("Got system chat packet {:?}", p);
|
println!("Got system chat packet {:?}", p);
|
||||||
tx.send(Event::Chat(ChatPacket::System(p.clone()))).unwrap();
|
tx.send(Event::Chat(ChatPacket::System(p.clone()))).unwrap();
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSoundPacket(p) => {
|
ClientboundGamePacket::ClientboundSoundPacket(p) => {
|
||||||
println!("Got sound packet {:?}", p);
|
println!("Got sound packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundLevelEventPacket(p) => {
|
ClientboundGamePacket::ClientboundLevelEventPacket(p) => {
|
||||||
println!("Got level event packet {:?}", p);
|
println!("Got level event packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundBlockUpdatePacket(p) => {
|
ClientboundGamePacket::ClientboundBlockUpdatePacket(p) => {
|
||||||
println!("Got block update packet {:?}", p);
|
println!("Got block update packet {:?}", p);
|
||||||
// TODO: update world
|
// TODO: update world
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundAnimatePacket(p) => {
|
ClientboundGamePacket::ClientboundAnimatePacket(p) => {
|
||||||
println!("Got animate packet {:?}", p);
|
println!("Got animate packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSectionBlocksUpdatePacket(p) => {
|
ClientboundGamePacket::ClientboundSectionBlocksUpdatePacket(p) => {
|
||||||
println!("Got section blocks update packet {:?}", p);
|
println!("Got section blocks update packet {:?}", p);
|
||||||
// TODO: update world
|
// TODO: update world
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundGameEventPacket(p) => {
|
ClientboundGamePacket::ClientboundGameEventPacket(p) => {
|
||||||
println!("Got game event packet {:?}", p);
|
println!("Got game event packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundLevelParticlesPacket(p) => {
|
ClientboundGamePacket::ClientboundLevelParticlesPacket(p) => {
|
||||||
println!("Got level particles packet {:?}", p);
|
println!("Got level particles packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundServerDataPacket(p) => {
|
ClientboundGamePacket::ClientboundServerDataPacket(p) => {
|
||||||
println!("Got server data packet {:?}", p);
|
println!("Got server data packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundSetEquipmentPacket(p) => {
|
ClientboundGamePacket::ClientboundSetEquipmentPacket(p) => {
|
||||||
println!("Got set equipment packet {:?}", p);
|
println!("Got set equipment packet {:?}", p);
|
||||||
}
|
}
|
||||||
GamePacket::ClientboundUpdateMobEffectPacket(p) => {
|
ClientboundGamePacket::ClientboundUpdateMobEffectPacket(p) => {
|
||||||
println!("Got update mob effect packet {:?}", p);
|
println!("Got update mob effect packet {:?}", p);
|
||||||
}
|
}
|
||||||
_ => panic!("Unexpected packet {:?}", packet),
|
_ => panic!("Unexpected packet {:?}", packet),
|
||||||
|
|
|
@ -235,6 +235,23 @@ 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.")
|
||||||
|
});
|
||||||
|
serverbound_write_match_contents.extend(quote! {
|
||||||
|
_ => panic!("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.")
|
||||||
|
});
|
||||||
|
clientbound_write_match_contents.extend(quote! {
|
||||||
|
_ => panic!("This enum is empty and can't exist.")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let mut contents = quote! {
|
let mut contents = quote! {
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum #serverbound_state_name
|
pub enum #serverbound_state_name
|
||||||
|
@ -252,19 +269,18 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
contents.extend(quote!{
|
contents.extend(quote! {
|
||||||
|
#[allow(unreachable_code)]
|
||||||
impl crate::packets::ProtocolPacket for #serverbound_state_name {
|
impl crate::packets::ProtocolPacket for #serverbound_state_name {
|
||||||
fn id(&self) -> u32 {
|
fn id(&self) -> u32 {
|
||||||
match self {
|
match self {
|
||||||
#serverbound_id_match_contents
|
#serverbound_id_match_contents
|
||||||
_ => panic!("Impossible state, this packet shouldn't exist.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> {
|
fn write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> {
|
||||||
match self {
|
match self {
|
||||||
#serverbound_write_match_contents
|
#serverbound_write_match_contents
|
||||||
_ => panic!("Impossible state, this packet shouldn't exist.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,19 +300,18 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
contents.extend(quote!{
|
contents.extend(quote! {
|
||||||
|
#[allow(unreachable_code)]
|
||||||
impl crate::packets::ProtocolPacket for #clientbound_state_name {
|
impl crate::packets::ProtocolPacket for #clientbound_state_name {
|
||||||
fn id(&self) -> u32 {
|
fn id(&self) -> u32 {
|
||||||
match self {
|
match self {
|
||||||
#clientbound_id_match_contents
|
#clientbound_id_match_contents
|
||||||
_ => panic!("Impossible state, this packet shouldn't exist.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> {
|
fn write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> {
|
||||||
match self {
|
match self {
|
||||||
#clientbound_write_match_contents
|
#clientbound_write_match_contents
|
||||||
_ => panic!("Impossible state, this packet shouldn't exist.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use crate::packets::ConnectionProtocol;
|
use crate::packets::ConnectionProtocol;
|
||||||
use azalea_buf::McBuf;
|
use azalea_buf::McBuf;
|
||||||
use packet_macros::ClientboundHandshakePacket;
|
use packet_macros::ServerboundHandshakePacket;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug, McBuf, ClientboundHandshakePacket)]
|
#[derive(Hash, Clone, Debug, McBuf, ServerboundHandshakePacket)]
|
||||||
pub struct ClientIntentionPacket {
|
pub struct ClientIntentionPacket {
|
||||||
#[var]
|
#[var]
|
||||||
pub protocol_version: u32,
|
pub protocol_version: u32,
|
||||||
|
|
|
@ -4,8 +4,8 @@ use packet_macros::declare_state_packets;
|
||||||
|
|
||||||
declare_state_packets!(
|
declare_state_packets!(
|
||||||
HandshakePacket,
|
HandshakePacket,
|
||||||
Serverbound => {},
|
Serverbound => {
|
||||||
Clientbound => {
|
|
||||||
0x00: client_intention_packet::ClientIntentionPacket,
|
0x00: client_intention_packet::ClientIntentionPacket,
|
||||||
}
|
},
|
||||||
|
Clientbound => {}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue