diff options
| author | mat <git@matdoes.dev> | 2025-09-28 13:10:04 -0545 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-09-28 13:10:04 -0545 |
| commit | 2c8b7c5c2c9297273abfba8f7743f1bc25f166b1 (patch) | |
| tree | 3d3aded400100c136287fa59293ce26c61644d00 /azalea-client/tests | |
| parent | e2ed19c1ed92f0dccc881d835d9ac6e0f7f834c0 (diff) | |
| download | azalea-drasl-2c8b7c5c2c9297273abfba8f7743f1bc25f166b1.tar.xz | |
upgrade bevy to 0.17.0-rc.2
Diffstat (limited to 'azalea-client/tests')
| -rw-r--r-- | azalea-client/tests/correct_movement.rs | 2 | ||||
| -rw-r--r-- | azalea-client/tests/correct_sneak_movement.rs | 2 | ||||
| -rw-r--r-- | azalea-client/tests/correct_sprint_sneak_movement.rs | 2 | ||||
| -rw-r--r-- | azalea-client/tests/mine_block_rollback.rs | 2 | ||||
| -rw-r--r-- | azalea-client/tests/mine_block_timing.rs | 2 | ||||
| -rw-r--r-- | azalea-client/tests/mine_block_without_rollback.rs | 2 | ||||
| -rw-r--r-- | azalea-client/tests/packet_order.rs | 2 | ||||
| -rw-r--r-- | azalea-client/tests/packet_order_set_carried_item.rs | 4 | ||||
| -rw-r--r-- | azalea-client/tests/receive_start_config_packet.rs | 15 | ||||
| -rw-r--r-- | azalea-client/tests/reply_to_ping_with_pong.rs | 14 |
10 files changed, 18 insertions, 29 deletions
diff --git a/azalea-client/tests/correct_movement.rs b/azalea-client/tests/correct_movement.rs index 52682bbb..5aaea9a3 100644 --- a/azalea-client/tests/correct_movement.rs +++ b/azalea-client/tests/correct_movement.rs @@ -49,7 +49,7 @@ fn test_correct_movement() { simulation.tick(); // walk for a tick - simulation.send_event(StartWalkEvent { + simulation.write_message(StartWalkEvent { entity: simulation.entity, direction: WalkDirection::Forward, }); diff --git a/azalea-client/tests/correct_sneak_movement.rs b/azalea-client/tests/correct_sneak_movement.rs index c486ac0a..0e06633a 100644 --- a/azalea-client/tests/correct_sneak_movement.rs +++ b/azalea-client/tests/correct_sneak_movement.rs @@ -62,7 +62,7 @@ fn test_correct_sneak_movement() { sent_packets.expect_empty(); simulation.tick(); - simulation.send_event(StartWalkEvent { + simulation.write_message(StartWalkEvent { entity: simulation.entity, direction: WalkDirection::Forward, }); diff --git a/azalea-client/tests/correct_sprint_sneak_movement.rs b/azalea-client/tests/correct_sprint_sneak_movement.rs index 10ff29ad..c76bc158 100644 --- a/azalea-client/tests/correct_sprint_sneak_movement.rs +++ b/azalea-client/tests/correct_sprint_sneak_movement.rs @@ -50,7 +50,7 @@ fn test_correct_sprint_sneak_movement() { sent_packets.clear(); // start sprinting - simulation.send_event(StartSprintEvent { + simulation.write_message(StartSprintEvent { entity: simulation.entity, direction: SprintDirection::Forward, }); diff --git a/azalea-client/tests/mine_block_rollback.rs b/azalea-client/tests/mine_block_rollback.rs index edbd1741..67a66169 100644 --- a/azalea-client/tests/mine_block_rollback.rs +++ b/azalea-client/tests/mine_block_rollback.rs @@ -27,7 +27,7 @@ fn test_mine_block_rollback() { assert_eq!(simulation.get_block_state(pos), Some(Block::Tnt.into())); println!("set serverside tnt"); - simulation.send_event(StartMiningBlockEvent { + simulation.write_message(StartMiningBlockEvent { entity: simulation.entity, position: pos, }); diff --git a/azalea-client/tests/mine_block_timing.rs b/azalea-client/tests/mine_block_timing.rs index 920f3a84..1cbd2f61 100644 --- a/azalea-client/tests/mine_block_timing.rs +++ b/azalea-client/tests/mine_block_timing.rs @@ -54,7 +54,7 @@ fn test_mine_block_timing() { simulation.tick(); simulation.tick(); - simulation.send_event(StartMiningBlockEvent { + simulation.write_message(StartMiningBlockEvent { entity: simulation.entity, position: pos, }); diff --git a/azalea-client/tests/mine_block_without_rollback.rs b/azalea-client/tests/mine_block_without_rollback.rs index cf6b5a5c..16a371e5 100644 --- a/azalea-client/tests/mine_block_without_rollback.rs +++ b/azalea-client/tests/mine_block_without_rollback.rs @@ -26,7 +26,7 @@ fn test_mine_block_without_rollback() { simulation.tick(); assert_eq!(simulation.get_block_state(pos), Some(Block::Tnt.into())); - simulation.send_event(StartMiningBlockEvent { + simulation.write_message(StartMiningBlockEvent { entity: simulation.entity, position: pos, }); diff --git a/azalea-client/tests/packet_order.rs b/azalea-client/tests/packet_order.rs index 1fd01934..90496292 100644 --- a/azalea-client/tests/packet_order.rs +++ b/azalea-client/tests/packet_order.rs @@ -109,7 +109,7 @@ fn test_packet_order() { sent_packets.expect_empty(); // now sprint for a tick - simulation.send_event(StartSprintEvent { + simulation.write_message(StartSprintEvent { entity: simulation.entity, direction: SprintDirection::Forward, }); diff --git a/azalea-client/tests/packet_order_set_carried_item.rs b/azalea-client/tests/packet_order_set_carried_item.rs index 18a75fc5..0506ad8e 100644 --- a/azalea-client/tests/packet_order_set_carried_item.rs +++ b/azalea-client/tests/packet_order_set_carried_item.rs @@ -55,11 +55,11 @@ fn test_packet_order_set_carried_item() { simulation.tick(); simulation.tick(); - simulation.send_event(SetSelectedHotbarSlotEvent { + simulation.write_message(SetSelectedHotbarSlotEvent { entity: simulation.entity, slot: 1, }); - simulation.send_event(StartMiningBlockEvent { + simulation.write_message(StartMiningBlockEvent { entity: simulation.entity, position: pos, }); diff --git a/azalea-client/tests/receive_start_config_packet.rs b/azalea-client/tests/receive_start_config_packet.rs index fb847769..bb948488 100644 --- a/azalea-client/tests/receive_start_config_packet.rs +++ b/azalea-client/tests/receive_start_config_packet.rs @@ -1,31 +1,20 @@ -use azalea_client::{InConfigState, packet::game::SendPacketEvent, test_utils::prelude::*}; +use azalea_client::{InConfigState, test_utils::prelude::*}; use azalea_protocol::packets::{ConnectionProtocol, game::ClientboundStartConfiguration}; use azalea_world::InstanceName; -use bevy_ecs::event::Events; #[test] fn test_receive_start_config_packet() { init_tracing(); let mut simulation = Simulation::new(ConnectionProtocol::Game); + simulation.receive_packet(default_login_packet()); simulation.tick(); assert!(simulation.has_component::<InstanceName>()); simulation.tick(); - // we shouldn't be using the `SendPacketEvent` event directly, we should be - // using the trigger instead - simulation.with_resource_mut::<Events<SendPacketEvent>>(|send_packet_events| { - assert_eq!(send_packet_events.len(), 0); - }); - simulation.receive_packet(ClientboundStartConfiguration); simulation.tick(); assert!(simulation.has_component::<InConfigState>()); - - // check again just in case - simulation.with_resource_mut::<Events<SendPacketEvent>>(|send_packet_events| { - assert_eq!(send_packet_events.len(), 0); - }); } diff --git a/azalea-client/tests/reply_to_ping_with_pong.rs b/azalea-client/tests/reply_to_ping_with_pong.rs index ac09336c..eac68e25 100644 --- a/azalea-client/tests/reply_to_ping_with_pong.rs +++ b/azalea-client/tests/reply_to_ping_with_pong.rs @@ -12,7 +12,7 @@ use azalea_protocol::packets::{ }, game::{self, ServerboundGamePacket}, }; -use bevy_ecs::observer::Trigger; +use bevy_ecs::observer::On; use parking_lot::Mutex; use simdnbt::owned::{NbtCompound, NbtTag}; @@ -26,9 +26,9 @@ fn reply_to_ping_with_pong() { let reply_count_clone = reply_count.clone(); simulation .app - .add_observer(move |trigger: Trigger<SendConfigPacketEvent>| { - if trigger.sent_by == simulation.entity - && let ServerboundConfigPacket::Pong(packet) = &trigger.packet + .add_observer(move |send_config_packet: On<SendConfigPacketEvent>| { + if send_config_packet.sent_by == simulation.entity + && let ServerboundConfigPacket::Pong(packet) = &send_config_packet.packet { assert_eq!(packet.id, 321); *reply_count_clone.lock() += 1; @@ -61,9 +61,9 @@ fn reply_to_ping_with_pong() { let reply_count_clone = reply_count.clone(); simulation .app - .add_observer(move |trigger: Trigger<SendPacketEvent>| { - if trigger.sent_by == simulation.entity - && let ServerboundGamePacket::Pong(packet) = &trigger.packet + .add_observer(move |send_game_packet: On<SendPacketEvent>| { + if send_game_packet.sent_by == simulation.entity + && let ServerboundGamePacket::Pong(packet) = &send_game_packet.packet { assert_eq!(packet.id, 123); *reply_count_clone.lock() += 1; |
