aboutsummaryrefslogtreecommitdiff
path: root/azalea
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2025-02-22 21:45:26 -0600
committerGitHub <noreply@github.com>2025-02-22 21:45:26 -0600
commite21e1b97bf9337e9f4747cd1b545b1b3a03e2ce7 (patch)
treeadd6f8bfce40d0c07845d8aa4c9945a0b918444c /azalea
parentf8130c3c92946d2293634ba4e252d6bc93026c3c (diff)
downloadazalea-drasl-e21e1b97bf9337e9f4747cd1b545b1b3a03e2ce7.tar.xz
Refactor azalea-client (#205)
* start organizing packet_handling more by moving packet handlers into their own functions * finish writing all the handler functions for packets * use macro for generating match statement for packet handler functions * fix set_entity_data * update config state to also use handler functions * organize az-client file structure by moving things into plugins directory * fix merge issues
Diffstat (limited to 'azalea')
-rw-r--r--azalea/examples/testbot/commands/debug.rs6
-rw-r--r--azalea/src/accept_resource_packs.rs4
-rw-r--r--azalea/src/auto_respawn.rs2
-rw-r--r--azalea/src/container.rs4
-rw-r--r--azalea/src/pathfinder/simulation.rs6
5 files changed, 11 insertions, 11 deletions
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs
index df98511d..1b3b2d61 100644
--- a/azalea/examples/testbot/commands/debug.rs
+++ b/azalea/examples/testbot/commands/debug.rs
@@ -8,7 +8,7 @@ use azalea::{
chunks::ReceiveChunkEvent,
entity::{LookDirection, Position},
interact::HitResultComponent,
- packet_handling::game,
+ packet::game,
pathfinder::{ExecutingPath, Pathfinder},
world::MinecraftEntityId,
};
@@ -240,8 +240,8 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
}
}
}
- "bevy_ecs::event::collections::Events<azalea_client::packet_handling::game::PacketEvent>" => {
- let events = ecs.resource::<Events<game::PacketEvent>>();
+ "bevy_ecs::event::collections::Events<azalea_client::packet::game::ReceivePacketEvent>" => {
+ let events = ecs.resource::<Events<game::ReceivePacketEvent>>();
writeln!(report, "- Event count: {}", events.len()).unwrap();
}
"bevy_ecs::event::collections::Events<azalea_client::chunks::ReceiveChunkEvent>" => {
diff --git a/azalea/src/accept_resource_packs.rs b/azalea/src/accept_resource_packs.rs
index f62d5ec0..13deef8e 100644
--- a/azalea/src/accept_resource_packs.rs
+++ b/azalea/src/accept_resource_packs.rs
@@ -1,7 +1,7 @@
use azalea_client::chunks::handle_chunk_batch_finished_event;
use azalea_client::inventory::InventorySet;
-use azalea_client::packet_handling::game::SendPacketEvent;
-use azalea_client::packet_handling::{death_event_on_0_health, game::ResourcePackEvent};
+use azalea_client::packet::game::SendPacketEvent;
+use azalea_client::packet::{death_event_on_0_health, game::ResourcePackEvent};
use azalea_client::respawn::perform_respawn;
use azalea_protocol::packets::game::s_resource_pack::{self, ServerboundResourcePack};
use bevy_app::Update;
diff --git a/azalea/src/auto_respawn.rs b/azalea/src/auto_respawn.rs
index 191e6df7..0d878595 100644
--- a/azalea/src/auto_respawn.rs
+++ b/azalea/src/auto_respawn.rs
@@ -1,5 +1,5 @@
use azalea_client::{
- packet_handling::{death_event_on_0_health, game::DeathEvent},
+ packet::{death_event_on_0_health, game::DeathEvent},
respawn::{PerformRespawnEvent, perform_respawn},
};
use bevy_app::Update;
diff --git a/azalea/src/container.rs b/azalea/src/container.rs
index e1a018b0..b5ed74cc 100644
--- a/azalea/src/container.rs
+++ b/azalea/src/container.rs
@@ -1,10 +1,10 @@
use std::fmt::Debug;
use std::fmt::Formatter;
+use azalea_client::packet::game::ReceivePacketEvent;
use azalea_client::{
Client,
inventory::{CloseContainerEvent, ContainerClickEvent, Inventory},
- packet_handling::game::PacketEvent,
};
use azalea_core::position::BlockPos;
use azalea_inventory::{ItemStack, Menu, operations::ClickOperation};
@@ -234,7 +234,7 @@ impl ContainerHandle {
#[derive(Component, Debug)]
pub struct WaitingForInventoryOpen;
-fn handle_menu_opened_event(mut commands: Commands, mut events: EventReader<PacketEvent>) {
+fn handle_menu_opened_event(mut commands: Commands, mut events: EventReader<ReceivePacketEvent>) {
for event in events.read() {
if let ClientboundGamePacket::ContainerSetContent { .. } = event.packet.as_ref() {
commands
diff --git a/azalea/src/pathfinder/simulation.rs b/azalea/src/pathfinder/simulation.rs
index ab0e540a..5a68bf88 100644
--- a/azalea/src/pathfinder/simulation.rs
+++ b/azalea/src/pathfinder/simulation.rs
@@ -2,7 +2,7 @@
use std::sync::Arc;
-use azalea_client::{PhysicsState, inventory::Inventory, packet_handling::game::SendPacketEvent};
+use azalea_client::{PhysicsState, inventory::Inventory, packet::game::SendPacketEvent};
use azalea_core::{position::Vec3, resource_location::ResourceLocation, tick::GameTick};
use azalea_entity::{
Attributes, EntityDimensions, LookDirection, Physics, Position, attributes::AttributeInstance,
@@ -60,13 +60,13 @@ fn create_simulation_instance(chunks: ChunkStorage) -> (App, Arc<RwLock<Instance
app.add_plugins((
azalea_physics::PhysicsPlugin,
azalea_entity::EntityPlugin,
- azalea_client::movement::PlayerMovePlugin,
+ azalea_client::movement::MovementPlugin,
super::PathfinderPlugin,
crate::BotPlugin,
azalea_client::task_pool::TaskPoolPlugin::default(),
// for mining
azalea_client::inventory::InventoryPlugin,
- azalea_client::mining::MinePlugin,
+ azalea_client::mining::MiningPlugin,
azalea_client::interact::InteractPlugin,
))
.insert_resource(InstanceContainer {