Skip to content

Commit

Permalink
update codegen and use resourcelocation names for packets
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-1 committed Nov 27, 2024
1 parent 170ffb0 commit f8cd7ed
Show file tree
Hide file tree
Showing 45 changed files with 651 additions and 632 deletions.
2 changes: 1 addition & 1 deletion azalea-block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{
io::{Cursor, Write},
};

use azalea_buf::{BufReadError, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite};
use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
pub use behavior::BlockBehavior;
pub use generated::{blocks, properties};
pub use range::BlockStates;
Expand Down
4 changes: 1 addition & 3 deletions azalea-brigadier/src/suggestion/suggestions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use std::io::{Cursor, Write};
use std::{collections::HashSet, hash::Hash};

#[cfg(feature = "azalea-buf")]
use azalea_buf::{
BufReadError, AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite,
};
use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
#[cfg(feature = "azalea-buf")]
use azalea_chat::FormattedText;

Expand Down
4 changes: 2 additions & 2 deletions azalea-buf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ mod write;

pub use azalea_buf_macros::*;
pub use definitions::*;
pub use read::{BufReadError, AzaleaRead, AzaleaReadVar};
pub use read::{AzaleaRead, AzaleaReadVar, BufReadError};
pub use serializable_uuid::*;
pub use write::{AzaleaWriteVar, AzaleaWrite};
pub use write::{AzaleaWrite, AzaleaWriteVar};

// const DEFAULT_NBT_QUOTA: u32 = 2097152;
const MAX_STRING_LENGTH: u16 = 32767;
Expand Down
4 changes: 1 addition & 3 deletions azalea-buf/src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ impl<K: AzaleaRead + Send + Eq + Hash, V: AzaleaRead + Send> AzaleaRead for Hash
}
}

impl<K: AzaleaRead + Send + Eq + Hash, V: AzaleaReadVar + Send> AzaleaReadVar
for HashMap<K, V>
{
impl<K: AzaleaRead + Send + Eq + Hash, V: AzaleaReadVar + Send> AzaleaReadVar for HashMap<K, V> {
fn azalea_read_var(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let length = i32::azalea_read_var(buf)? as usize;
let mut contents = HashMap::with_capacity(usize::min(length, 65536));
Expand Down
2 changes: 1 addition & 1 deletion azalea-chat/src/component.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fmt::Display;

#[cfg(feature = "azalea-buf")]
use azalea_buf::{BufReadError, AzaleaRead, AzaleaWrite};
use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};
use once_cell::sync::Lazy;
use serde::{de, Deserialize, Deserializer, Serialize};
#[cfg(feature = "simdnbt")]
Expand Down
6 changes: 3 additions & 3 deletions azalea-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ use azalea_entity::{
};
use azalea_physics::PhysicsPlugin;
use azalea_protocol::{
common::ClientInformation,
common::client_information::ClientInformation,
connect::{Connection, ConnectionError, Proxy},
packets::{
config::{ClientboundConfigPacket, ServerboundConfigPacket},
game::ServerboundGamePacket,
handshake::{
s_client_intention::ServerboundClientIntention, ClientboundHandshakePacket,
s_intention::ServerboundIntention, ClientboundHandshakePacket,
ServerboundHandshakePacket,
},
login::{
Expand Down Expand Up @@ -349,7 +349,7 @@ impl Client {
JoinError,
> {
// handshake
conn.write(ServerboundClientIntention {
conn.write(ServerboundIntention {
protocol_version: PROTOCOL_VERSION,
hostname: address.host.clone(),
port: address.port,
Expand Down
2 changes: 1 addition & 1 deletion azalea-client/src/configuration.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use azalea_buf::AzaleaWrite;
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol::{
common::ClientInformation,
common::client_information::ClientInformation,
packets::config::{
s_client_information::ServerboundClientInformation,
s_custom_payload::ServerboundCustomPayload,
Expand Down
2 changes: 1 addition & 1 deletion azalea-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub mod respawn;
pub mod task_pool;

pub use account::{Account, AccountOpts};
pub use azalea_protocol::common::ClientInformation;
pub use azalea_protocol::common::client_information::ClientInformation;
pub use client::{
start_ecs_runner, Client, DefaultPlugins, JoinError, JoinedClientBundle, StartClientOpts,
TickBroadcast,
Expand Down
2 changes: 2 additions & 0 deletions azalea-client/src/packet_handling/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ pub fn process_packet_events(ecs: &mut World) {
})
.unwrap();
}
ClientboundConfigPacket::ServerLinks(_) => {}
ClientboundConfigPacket::CustomReportDetails(_) => {}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions azalea-client/src/packet_handling/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ pub fn process_packet_events(ecs: &mut World) {
ClientboundGamePacket::TabList(_) => {}
ClientboundGamePacket::TagQuery(_) => {}
ClientboundGamePacket::TakeItemEntity(_) => {}
ClientboundGamePacket::Bundle(_) => {}
ClientboundGamePacket::BundleDelimiter(_) => {}
ClientboundGamePacket::DamageEvent(_) => {}
ClientboundGamePacket::HurtAnimation(_) => {}

Expand All @@ -1471,7 +1471,7 @@ pub fn process_packet_events(ecs: &mut World) {
ClientboundGamePacket::PongResponse(_) => {}
ClientboundGamePacket::StoreCookie(_) => {}
ClientboundGamePacket::Transfer(_) => {}
ClientboundGamePacket::MoveMinecart(_) => {}
ClientboundGamePacket::MoveMinecartAlongTrack(_) => {}
ClientboundGamePacket::SetHeldSlot(_) => {}
ClientboundGamePacket::SetPlayerInventory(_) => {}
ClientboundGamePacket::ProjectilePower(_) => {}
Expand Down
4 changes: 2 additions & 2 deletions azalea-client/src/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use azalea_protocol::{
connect::{Connection, ConnectionError, Proxy},
packets::{
handshake::{
s_client_intention::ServerboundClientIntention, ClientboundHandshakePacket,
s_intention::ServerboundIntention, ClientboundHandshakePacket,
ServerboundHandshakePacket,
},
status::{
Expand Down Expand Up @@ -74,7 +74,7 @@ pub async fn ping_server_with_connection(
mut conn: Connection<ClientboundHandshakePacket, ServerboundHandshakePacket>,
) -> Result<ClientboundStatusResponse, PingError> {
// send the client intention packet and switch to the status state
conn.write(ServerboundClientIntention {
conn.write(ServerboundIntention {
protocol_version: PROTOCOL_VERSION,
hostname: address.host.clone(),
port: address.port,
Expand Down
2 changes: 1 addition & 1 deletion azalea-core/src/bitset.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::io::{Cursor, Write};

use azalea_buf::{BufReadError, AzBuf, AzaleaRead, AzaleaWrite};
use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError};

/// Represents Java's BitSet, a list of bits.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, AzBuf)]
Expand Down
2 changes: 1 addition & 1 deletion azalea-core/src/difficulty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
io::{Cursor, Write},
};

use azalea_buf::{BufReadError, AzaleaRead, AzaleaWrite};
use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};

#[derive(Hash, Clone, Copy, Debug, PartialEq, Eq)]
pub enum Difficulty {
Expand Down
2 changes: 1 addition & 1 deletion azalea-core/src/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{
str::FromStr,
};

use azalea_buf::{BufReadError, AzBuf, AzaleaRead, AzaleaWrite};
use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

Expand Down
9 changes: 6 additions & 3 deletions azalea-physics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,8 @@ mod tests {
azalea_block::blocks::StoneSlab {
kind: azalea_block::properties::Type::Top,
waterlogged: false,
},
}
.into(),
);
assert!(
block_state.is_some(),
Expand Down Expand Up @@ -704,7 +705,8 @@ mod tests {
west: azalea_block::properties::WallWest::Low,
up: false,
waterlogged: false,
},
}
.into(),
);
assert!(
block_state.is_some(),
Expand Down Expand Up @@ -765,7 +767,8 @@ mod tests {
west: azalea_block::properties::WallWest::Low,
up: false,
waterlogged: false,
},
}
.into(),
);
assert!(
block_state.is_some(),
Expand Down
Loading

0 comments on commit f8cd7ed

Please sign in to comment.