From aa886c101b398f52372df6054c00f9387428cac6 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 7 Feb 2023 20:30:47 +0000 Subject: [PATCH] move az_world::entity_info to az_world::entities::info --- azalea-client/src/client.rs | 2 +- azalea-client/src/local_player.rs | 2 +- azalea-client/src/packet_handling.rs | 3 ++- azalea-client/src/player.rs | 2 +- azalea-physics/src/lib.rs | 9 +++++---- azalea-world/src/{entity_info.rs => entity/info.rs} | 9 +++++---- azalea-world/src/entity/mod.rs | 7 +++++++ azalea-world/src/lib.rs | 4 ---- azalea-world/src/world.rs | 7 ++++--- azalea/examples/{matbot.rs => testbot.rs} | 2 +- azalea/src/bot.rs | 5 +---- azalea/src/pathfinder/mod.rs | 2 +- 12 files changed, 29 insertions(+), 25 deletions(-) rename azalea-world/src/{entity_info.rs => entity/info.rs} (98%) rename azalea/examples/{matbot.rs => testbot.rs} (99%) diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index ddeeeef3..87079af4 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -42,7 +42,7 @@ use azalea_protocol::{ }, resolver, ServerAddress, }; -use azalea_world::{entity::WorldName, EntityPlugin, Local, PartialWorld, World, WorldContainer}; +use azalea_world::{entity::{WorldName, EntityPlugin, Local}, PartialWorld, World, WorldContainer}; use log::{debug, error}; use parking_lot::{Mutex, RwLock}; use std::{collections::HashMap, fmt::Debug, io, net::SocketAddr, sync::Arc}; diff --git a/azalea-client/src/local_player.rs b/azalea-client/src/local_player.rs index a6921d76..23a08bd0 100644 --- a/azalea-client/src/local_player.rs +++ b/azalea-client/src/local_player.rs @@ -28,7 +28,7 @@ use crate::{ /// You can also use the [`Local`] marker component for queries if you're only /// checking for a local player and don't need the contents of this component. /// -/// [`Local`]: azalea_world::Local +/// [`Local`]: azalea_world::entity::Local /// [`Client`]: crate::Client #[derive(Component)] pub struct LocalPlayer { diff --git a/azalea-client/src/packet_handling.rs b/azalea-client/src/packet_handling.rs index 42e24462..0e03b37c 100644 --- a/azalea-client/src/packet_handling.rs +++ b/azalea-client/src/packet_handling.rs @@ -28,7 +28,8 @@ use azalea_world::{ set_rotation, Dead, EntityBundle, EntityKind, LastSentPosition, MinecraftEntityId, Physics, PlayerBundle, Position, WorldName, }, - LoadedBy, PartialWorld, RelativeEntityUpdate, WorldContainer, + entity::{LoadedBy, RelativeEntityUpdate}, + PartialWorld, WorldContainer, }; use log::{debug, error, trace, warn}; use parking_lot::Mutex; diff --git a/azalea-client/src/player.rs b/azalea-client/src/player.rs index 00b6b25e..b8ca83bb 100755 --- a/azalea-client/src/player.rs +++ b/azalea-client/src/player.rs @@ -5,7 +5,7 @@ use azalea_ecs::{ event::EventReader, system::{Commands, Res}, }; -use azalea_world::EntityInfos; +use azalea_world::entity::EntityInfos; use uuid::Uuid; use crate::{packet_handling::AddPlayerEvent, GameProfileComponent}; diff --git a/azalea-physics/src/lib.rs b/azalea-physics/src/lib.rs index 96bebd1a..35841d77 100644 --- a/azalea-physics/src/lib.rs +++ b/azalea-physics/src/lib.rs @@ -16,9 +16,10 @@ use azalea_ecs::{ }; use azalea_world::{ entity::{ - metadata::Sprinting, move_relative, Attributes, Jumping, Physics, Position, WorldName, + metadata::Sprinting, move_relative, Attributes, Jumping, Local, Physics, Position, + WorldName, }, - Local, World, WorldContainer, + World, WorldContainer, }; use collision::{move_colliding, MoverType}; @@ -310,8 +311,8 @@ mod tests { use azalea_core::{ChunkPos, ResourceLocation}; use azalea_ecs::{app::App, TickPlugin}; use azalea_world::{ - entity::{EntityBundle, MinecraftEntityId}, - Chunk, EntityPlugin, PartialWorld, + entity::{EntityBundle, EntityPlugin, MinecraftEntityId}, + Chunk, PartialWorld, }; use uuid::Uuid; diff --git a/azalea-world/src/entity_info.rs b/azalea-world/src/entity/info.rs similarity index 98% rename from azalea-world/src/entity_info.rs rename to azalea-world/src/entity/info.rs index 428336f0..bf7e0051 100644 --- a/azalea-world/src/entity_info.rs +++ b/azalea-world/src/entity/info.rs @@ -1,3 +1,6 @@ +//! Implement things relating to entity datas, like an index of uuids to +//! entities. + use crate::{ deduplicate_entities, deduplicate_local_entities, entity::{ @@ -27,6 +30,8 @@ use std::{ }; use uuid::Uuid; +use super::Local; + /// Plugin handling some basic entity functionality. pub struct EntityPlugin; impl Plugin for EntityPlugin { @@ -263,10 +268,6 @@ pub fn add_updates_received( } } -/// A marker component that signifies that this entity is "local" and shouldn't -/// be updated by other clients. -#[derive(Component)] -pub struct Local; /// The [`UpdatesReceived`] component should never be on [`Local`] entities. /// This warns if an entity has both components. diff --git a/azalea-world/src/entity/mod.rs b/azalea-world/src/entity/mod.rs index 60a00bfd..0d0449ac 100644 --- a/azalea-world/src/entity/mod.rs +++ b/azalea-world/src/entity/mod.rs @@ -3,6 +3,7 @@ pub mod attributes; mod data; mod dimensions; +mod info; pub mod metadata; use crate::ChunkStorage; @@ -21,6 +22,7 @@ use azalea_ecs::{ pub use data::*; use derive_more::{Deref, DerefMut}; pub use dimensions::{update_bounding_box, EntityDimensions}; +pub use info::{EntityInfos, EntityPlugin, LoadedBy, PartialEntityInfos, RelativeEntityUpdate}; use std::fmt::Debug; use uuid::Uuid; @@ -314,6 +316,11 @@ pub struct PlayerBundle { pub metadata: metadata::PlayerMetadataBundle, } +/// A marker component that signifies that this entity is "local" and shouldn't +/// be updated by other clients. +#[derive(Component)] +pub struct Local; + // #[cfg(test)] // mod tests { // use super::*; diff --git a/azalea-world/src/lib.rs b/azalea-world/src/lib.rs index 88715f44..f0fd5387 100644 --- a/azalea-world/src/lib.rs +++ b/azalea-world/src/lib.rs @@ -7,7 +7,6 @@ mod bit_storage; mod chunk_storage; mod container; pub mod entity; -mod entity_info; mod palette; mod world; @@ -16,9 +15,6 @@ use std::backtrace::Backtrace; pub use bit_storage::BitStorage; pub use chunk_storage::{Chunk, ChunkStorage, PartialChunkStorage}; pub use container::*; -pub use entity_info::{ - EntityInfos, EntityPlugin, LoadedBy, Local, PartialEntityInfos, RelativeEntityUpdate, -}; use thiserror::Error; pub use world::*; diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs index 5ec2bbac..53a1f377 100644 --- a/azalea-world/src/world.rs +++ b/azalea-world/src/world.rs @@ -1,7 +1,8 @@ use crate::{ - entity::{EntityUuid, MinecraftEntityId, WorldName}, - entity_info::LoadedBy, - ChunkStorage, EntityInfos, Local, PartialChunkStorage, PartialEntityInfos, WorldContainer, + entity::{ + EntityInfos, EntityUuid, LoadedBy, Local, MinecraftEntityId, PartialEntityInfos, WorldName, + }, + ChunkStorage, PartialChunkStorage, WorldContainer, }; use azalea_core::ChunkPos; use azalea_ecs::{ diff --git a/azalea/examples/matbot.rs b/azalea/examples/testbot.rs similarity index 99% rename from azalea/examples/matbot.rs rename to azalea/examples/testbot.rs index 1ddd9197..3fe86fa6 100644 --- a/azalea/examples/matbot.rs +++ b/azalea/examples/testbot.rs @@ -1,4 +1,4 @@ -//! mat's bot for testing new azalea features +//! a bot for testing new azalea features #![feature(type_alias_impl_trait)] diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs index 510449d3..1f3822ac 100644 --- a/azalea/src/bot.rs +++ b/azalea/src/bot.rs @@ -9,10 +9,7 @@ use azalea_ecs::{ system::{Commands, Query}, AppTickExt, }; -use azalea_world::{ - entity::{metadata::Player, set_rotation, Jumping, Physics, Position}, - Local, -}; +use azalea_world::entity::{metadata::Player, set_rotation, Jumping, Local, Physics, Position}; use std::f64::consts::PI; use crate::pathfinder::PathfinderPlugin; diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index 5246290d..1dfb7a9b 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -17,7 +17,7 @@ use azalea_ecs::{ AppTickExt, }; use azalea_world::entity::metadata::Player; -use azalea_world::Local; +use azalea_world::entity::Local; use azalea_world::{ entity::{Physics, Position, WorldName}, WorldContainer,