diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-08-24 22:59:40 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-24 22:59:40 -0500 |
| commit | 11d14c74c53c07231c8ca33b622380df99bf9a59 (patch) | |
| tree | ea1d0c61a6d5f8af550a708ff3b71fbbaed5d122 /azalea-world/src | |
| parent | 57e5a0f0b96a38674bd18ac38d2d07e4f4ca2fd6 (diff) | |
| download | azalea-drasl-11d14c74c53c07231c8ca33b622380df99bf9a59.tar.xz | |
Support properly switching instances (#106)
* start implementing switching dimensions
* fix removeentity in shared worlds
* also store entity ids per local player
* uncomment a trace in pathfinder
* cleanup
---------
Co-authored-by: mat <git@matdoes.dev>
Diffstat (limited to 'azalea-world/src')
| -rwxr-xr-x | azalea-world/src/chunk_storage.rs | 6 | ||||
| -rw-r--r-- | azalea-world/src/container.rs | 3 | ||||
| -rw-r--r-- | azalea-world/src/world.rs | 8 |
3 files changed, 5 insertions, 12 deletions
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs index f0f053fa..133d522b 100755 --- a/azalea-world/src/chunk_storage.rs +++ b/azalea-world/src/chunk_storage.rs @@ -123,11 +123,7 @@ impl PartialChunkStorage { ) -> Result<(), BufReadError> { debug!("Replacing chunk at {:?}", pos); if !self.in_range(pos) { - trace!( - "Ignoring chunk since it's not in the view range: {}, {}", - pos.x, - pos.z - ); + warn!("Ignoring chunk since it's not in the view range: {pos:?}"); return Ok(()); } diff --git a/azalea-world/src/container.rs b/azalea-world/src/container.rs index 895d8d2d..866ac157 100644 --- a/azalea-world/src/container.rs +++ b/azalea-world/src/container.rs @@ -37,7 +37,8 @@ impl InstanceContainer { } } - /// Get a world from the container. + /// Get a world from the container. Returns `None` if none of the clients + /// are in this world. pub fn get(&self, name: &InstanceName) -> Option<Arc<RwLock<Instance>>> { self.worlds.get(name).and_then(|world| world.upgrade()) } diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs index ecd2e653..df462be4 100644 --- a/azalea-world/src/world.rs +++ b/azalea-world/src/world.rs @@ -82,16 +82,12 @@ pub struct Instance { /// An index of all the entities we know are in the chunks of the world pub entities_by_chunk: HashMap<ChunkPos, HashSet<Entity>>, - /// An index of Minecraft entity IDs to Azalea ECS entities. + /// An index of Minecraft entity IDs to Azalea ECS entities. You should + /// avoid using this and instead use `azalea_entity::EntityIdIndex` pub entity_by_id: IntMap<MinecraftEntityId, Entity>, } impl Instance { - /// Get an ECS [`Entity`] from a Minecraft entity ID. - pub fn entity_by_id(&self, entity_id: &MinecraftEntityId) -> Option<Entity> { - self.entity_by_id.get(entity_id).copied() - } - pub fn get_block_state(&self, pos: &BlockPos) -> Option<BlockState> { self.chunks.get_block_state(pos) } |
