From 88606d9ce9e13fcdd4ab5ce26e52630dee614c1e Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 21 Mar 2026 08:05:27 +0330 Subject: Extensible ChunkStorage Co-authored-by: sdwhw <191973436+sdwhw@users.noreply.github.com> --- azalea/examples/testbot/commands/debug.rs | 33 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'azalea/examples') diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index cd487abb..62baef1d 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -1,6 +1,6 @@ //! Commands for debugging and getting the current state of the bot. -use std::{env, fs::File, io::Write, thread, time::Duration}; +use std::{any::Any, env, fs::File, io::Write, thread, time::Duration}; use azalea::{ BlockPos, @@ -16,7 +16,7 @@ use azalea::{ use azalea_core::hit_result::HitResult; use azalea_entity::{EntityKindComponent, metadata}; use azalea_inventory::{Menu, components::MaxStackSize}; -use azalea_world::Worlds; +use azalea_world::{Worlds, chunk::storage::WeakChunkStorage}; use bevy_app::AppExit; use bevy_ecs::{message::Messages, query::With, world::EntityRef}; use parking_lot::Mutex; @@ -349,19 +349,22 @@ pub fn register(commands: &mut CommandDispatcher>) { .unwrap(); if let Some(world) = world.upgrade() { let world = world.read(); - let strong_chunks = world - .chunks - .map - .iter() - .filter(|(_, v)| v.strong_count() > 0) - .count(); - writeln!( - report, - "- Chunks: {} strongly referenced, {} in map", - strong_chunks, - world.chunks.map.len() - ) - .unwrap(); + let chunks = &world.chunks; + let chunks = (chunks as &dyn Any).downcast_ref::(); + if let Some(chunks) = chunks { + let strong_chunks = chunks + .map + .iter() + .filter(|(_, v)| v.strong_count() > 0) + .count(); + writeln!( + report, + "- Chunks: {} strongly referenced, {} in map", + strong_chunks, + chunks.map.len() + ) + .unwrap(); + } writeln!( report, "- Entities: {}", -- cgit v1.2.3