diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2026-01-13 10:51:30 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-13 10:51:30 -0600 |
| commit | d5fa5e32b37754b3b5c136e58821e48cd3b7c2ff (patch) | |
| tree | ea04702f96ad170fb1d90e5ed2dc875ae8166495 /azalea/src/swarm | |
| parent | efb36d5fc0fe56a98f5795c53dfa109887cd5aae (diff) | |
| download | azalea-drasl-d5fa5e32b37754b3b5c136e58821e48cd3b7c2ff.tar.xz | |
Rename Instance to World (#304)
Diffstat (limited to 'azalea/src/swarm')
| -rw-r--r-- | azalea/src/swarm/builder.rs | 6 | ||||
| -rw-r--r-- | azalea/src/swarm/chat.rs | 12 | ||||
| -rw-r--r-- | azalea/src/swarm/events.rs | 4 | ||||
| -rw-r--r-- | azalea/src/swarm/mod.rs | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/azalea/src/swarm/builder.rs b/azalea/src/swarm/builder.rs index 14c9c290..560be3d8 100644 --- a/azalea/src/swarm/builder.rs +++ b/azalea/src/swarm/builder.rs @@ -10,7 +10,7 @@ use std::{ use azalea_client::{DefaultPlugins, account::Account, start_ecs_runner}; use azalea_protocol::address::{ResolvableAddr, ResolvedAddr}; -use azalea_world::InstanceContainer; +use azalea_world::Worlds; use bevy_app::{App, AppExit, Plugins, SubApp}; use bevy_ecs::{component::Component, resource::Resource}; use futures::future::join_all; @@ -431,7 +431,7 @@ where addr }; - let instance_container = Arc::new(RwLock::new(InstanceContainer::default())); + let worlds = Arc::new(RwLock::new(Worlds::default())); // we can't modify the swarm plugins after this let (bots_tx, mut bots_rx) = mpsc::unbounded_channel(); @@ -451,7 +451,7 @@ where ecs: ecs_lock.clone(), address: Arc::new(RwLock::new(address)), - instance_container, + worlds, bots_tx, diff --git a/azalea/src/swarm/chat.rs b/azalea/src/swarm/chat.rs index 0bad69c1..c5e3eba3 100644 --- a/azalea/src/swarm/chat.rs +++ b/azalea/src/swarm/chat.rs @@ -2,12 +2,12 @@ // How the chat event works (to avoid firing the event multiple times): // --- -// There's a shared queue of all the chat messages -// Each bot contains an index of the farthest message we've seen -// When a bot receives a chat messages, it looks into the queue to find the -// earliest instance of the message content that's after the bot's chat index. -// If it finds it, then its personal index is simply updated. Otherwise, fire -// the event and add to the queue. +// There's a shared queue of all the chat messages. Each bot contains an index +// of the farthest message that it has seen. When a bot receives a chat +// message, it looks into the shared queue to find the earliest instance of the +// message content, that's after the bot's current chat index. If it finds it, +// then its personal index is simply updated. Otherwise, it fires the event and +// adds to the shared queue. // // To make sure the queue doesn't grow too large, we keep a `chat_min_index` // in Swarm that's set to the smallest index of all the bots, and we remove all diff --git a/azalea/src/swarm/events.rs b/azalea/src/swarm/events.rs index ee5859ca..83817c86 100644 --- a/azalea/src/swarm/events.rs +++ b/azalea/src/swarm/events.rs @@ -1,4 +1,4 @@ -use azalea_client::local_player::InstanceHolder; +use azalea_client::local_player::WorldHolder; use azalea_core::entity_id::MinecraftEntityId; use bevy_app::{App, Plugin, Update}; use bevy_ecs::prelude::*; @@ -21,7 +21,7 @@ pub struct SwarmReadyEvent; struct IsSwarmReady(bool); fn check_ready( - query: Query<Option<&MinecraftEntityId>, With<InstanceHolder>>, + query: Query<Option<&MinecraftEntityId>, With<WorldHolder>>, mut is_swarm_ready: ResMut<IsSwarmReady>, mut ready_events: MessageWriter<SwarmReadyEvent>, ) { diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index b1061346..4ecb0726 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -15,7 +15,7 @@ use std::sync::{ use azalea_client::{account::Account, chat::ChatPacket, join::ConnectOpts}; use azalea_entity::LocalEntity; use azalea_protocol::address::ResolvedAddr; -use azalea_world::InstanceContainer; +use azalea_world::Worlds; use bevy_app::{PluginGroup, PluginGroupBuilder}; use bevy_ecs::prelude::*; pub use builder::SwarmBuilder; @@ -47,7 +47,7 @@ pub struct Swarm { // the address is public and mutable so plugins can change it pub address: Arc<RwLock<ResolvedAddr>>, - pub instance_container: Arc<RwLock<InstanceContainer>>, + pub worlds: Arc<RwLock<Worlds>>, /// This is used internally to make the client handler function work. pub(crate) bots_tx: mpsc::UnboundedSender<(Option<crate::Event>, Client)>, |
