aboutsummaryrefslogtreecommitdiff
path: root/azalea/examples
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-09-28 13:10:04 -0545
committermat <git@matdoes.dev>2025-09-28 13:10:04 -0545
commit2c8b7c5c2c9297273abfba8f7743f1bc25f166b1 (patch)
tree3d3aded400100c136287fa59293ce26c61644d00 /azalea/examples
parente2ed19c1ed92f0dccc881d835d9ac6e0f7f834c0 (diff)
downloadazalea-drasl-2c8b7c5c2c9297273abfba8f7743f1bc25f166b1.tar.xz
upgrade bevy to 0.17.0-rc.2
Diffstat (limited to 'azalea/examples')
-rw-r--r--azalea/examples/nearest_entity.rs4
-rw-r--r--azalea/examples/testbot/commands/debug.rs24
2 files changed, 15 insertions, 13 deletions
diff --git a/azalea/examples/nearest_entity.rs b/azalea/examples/nearest_entity.rs
index 80bb544d..51aa26f6 100644
--- a/azalea/examples/nearest_entity.rs
+++ b/azalea/examples/nearest_entity.rs
@@ -12,7 +12,7 @@ use azalea_entity::{
};
use bevy_app::Plugin;
use bevy_ecs::{
- prelude::{Entity, EventWriter},
+ prelude::{Entity, MessageWriter},
query::With,
system::Query,
};
@@ -39,7 +39,7 @@ fn look_at_everything(
bots: Query<Entity, (With<LocalEntity>, With<Player>)>,
entities: EntityFinder,
entity_positions: Query<(&Position, Option<&EntityDimensions>)>,
- mut look_at_event: EventWriter<LookAtEvent>,
+ mut look_at_event: MessageWriter<LookAtEvent>,
) {
for bot_id in bots.iter() {
let Some(entity) = entities.nearest_to_entity(bot_id, 16.0) else {
diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs
index 3cdf4cf2..b98d737f 100644
--- a/azalea/examples/testbot/commands/debug.rs
+++ b/azalea/examples/testbot/commands/debug.rs
@@ -18,7 +18,7 @@ use azalea_entity::{EntityKindComponent, EntityUuid, metadata};
use azalea_inventory::components::MaxStackSize;
use azalea_world::InstanceContainer;
use bevy_app::AppExit;
-use bevy_ecs::{event::Events, query::With};
+use bevy_ecs::{message::Messages, query::With, world::EntityRef};
use parking_lot::Mutex;
use super::{CommandSource, Ctx};
@@ -246,21 +246,23 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
thread::sleep(Duration::from_secs(1));
// dump the ecs
- let ecs = ecs.lock();
+ let mut ecs = ecs.lock();
let report_path = env::temp_dir().join("azalea-ecs-leak-report.txt");
let mut report = File::create(&report_path).unwrap();
- for entity in ecs.iter_entities() {
+ let mut query = ecs.query::<EntityRef>();
+ for entity in query.iter(& ecs) {
writeln!(report, "Entity: {}", entity.id()).unwrap();
let archetype = entity.archetype();
let component_count = archetype.component_count();
let component_names = archetype
.components()
- .map(|c| ecs.components().get_info(c).unwrap().name())
+ .iter()
+ .map(|c| ecs.components().get_info(*c).unwrap().name().to_string())
.collect::<Vec<_>>();
writeln!(
report,
@@ -274,12 +276,12 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
for (info, _) in ecs.iter_resources() {
- let name = info.name();
+ let name = info.name().to_string();
writeln!(report, "Resource: {name}").unwrap();
// writeln!(report, "- Size: {} bytes",
// info.layout().size()).unwrap();
- match name {
+ match name.as_ref() {
"azalea_world::container::InstanceContainer" => {
let instance_container = ecs.resource::<InstanceContainer>();
@@ -311,12 +313,12 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
}
}
}
- "bevy_ecs::event::collections::Events<azalea_client::packet::game::ReceivePacketEvent>" => {
- let events = ecs.resource::<Events<game::ReceiveGamePacketEvent>>();
+ "bevy_ecs::message::Messages<azalea_client::packet::game::ReceivePacketEvent>" => {
+ let events = ecs.resource::<Messages<game::ReceiveGamePacketEvent>>();
writeln!(report, "- Event count: {}", events.len()).unwrap();
}
- "bevy_ecs::event::collections::Events<azalea_client::chunks::ReceiveChunkEvent>" => {
- let events = ecs.resource::<Events<ReceiveChunkEvent>>();
+ "bevy_ecs::message::Messages<azalea_client::chunks::ReceiveChunkEvent>" => {
+ let events = ecs.resource::<Messages<ReceiveChunkEvent>>();
writeln!(report, "- Event count: {}", events.len()).unwrap();
}
@@ -340,7 +342,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
thread::spawn(move || {
thread::sleep(Duration::from_secs(1));
- source.lock().bot.ecs.lock().send_event(AppExit::Success);
+ source.lock().bot.ecs.lock().write_message(AppExit::Success);
});
1