1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

move az_world::entity_info to az_world::entities::info

This commit is contained in:
Ubuntu 2023-02-07 20:30:47 +00:00
parent d51b2a29b2
commit aa886c101b
12 changed files with 29 additions and 25 deletions

View file

@ -42,7 +42,7 @@ use azalea_protocol::{
}, },
resolver, ServerAddress, 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 log::{debug, error};
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use std::{collections::HashMap, fmt::Debug, io, net::SocketAddr, sync::Arc}; use std::{collections::HashMap, fmt::Debug, io, net::SocketAddr, sync::Arc};

View file

@ -28,7 +28,7 @@ use crate::{
/// You can also use the [`Local`] marker component for queries if you're only /// 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. /// 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 /// [`Client`]: crate::Client
#[derive(Component)] #[derive(Component)]
pub struct LocalPlayer { pub struct LocalPlayer {

View file

@ -28,7 +28,8 @@ use azalea_world::{
set_rotation, Dead, EntityBundle, EntityKind, LastSentPosition, MinecraftEntityId, Physics, set_rotation, Dead, EntityBundle, EntityKind, LastSentPosition, MinecraftEntityId, Physics,
PlayerBundle, Position, WorldName, PlayerBundle, Position, WorldName,
}, },
LoadedBy, PartialWorld, RelativeEntityUpdate, WorldContainer, entity::{LoadedBy, RelativeEntityUpdate},
PartialWorld, WorldContainer,
}; };
use log::{debug, error, trace, warn}; use log::{debug, error, trace, warn};
use parking_lot::Mutex; use parking_lot::Mutex;

View file

@ -5,7 +5,7 @@ use azalea_ecs::{
event::EventReader, event::EventReader,
system::{Commands, Res}, system::{Commands, Res},
}; };
use azalea_world::EntityInfos; use azalea_world::entity::EntityInfos;
use uuid::Uuid; use uuid::Uuid;
use crate::{packet_handling::AddPlayerEvent, GameProfileComponent}; use crate::{packet_handling::AddPlayerEvent, GameProfileComponent};

View file

@ -16,9 +16,10 @@ use azalea_ecs::{
}; };
use azalea_world::{ use azalea_world::{
entity::{ 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}; use collision::{move_colliding, MoverType};
@ -310,8 +311,8 @@ mod tests {
use azalea_core::{ChunkPos, ResourceLocation}; use azalea_core::{ChunkPos, ResourceLocation};
use azalea_ecs::{app::App, TickPlugin}; use azalea_ecs::{app::App, TickPlugin};
use azalea_world::{ use azalea_world::{
entity::{EntityBundle, MinecraftEntityId}, entity::{EntityBundle, EntityPlugin, MinecraftEntityId},
Chunk, EntityPlugin, PartialWorld, Chunk, PartialWorld,
}; };
use uuid::Uuid; use uuid::Uuid;

View file

@ -1,3 +1,6 @@
//! Implement things relating to entity datas, like an index of uuids to
//! entities.
use crate::{ use crate::{
deduplicate_entities, deduplicate_local_entities, deduplicate_entities, deduplicate_local_entities,
entity::{ entity::{
@ -27,6 +30,8 @@ use std::{
}; };
use uuid::Uuid; use uuid::Uuid;
use super::Local;
/// Plugin handling some basic entity functionality. /// Plugin handling some basic entity functionality.
pub struct EntityPlugin; pub struct EntityPlugin;
impl Plugin for 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. /// The [`UpdatesReceived`] component should never be on [`Local`] entities.
/// This warns if an entity has both components. /// This warns if an entity has both components.

View file

@ -3,6 +3,7 @@
pub mod attributes; pub mod attributes;
mod data; mod data;
mod dimensions; mod dimensions;
mod info;
pub mod metadata; pub mod metadata;
use crate::ChunkStorage; use crate::ChunkStorage;
@ -21,6 +22,7 @@ use azalea_ecs::{
pub use data::*; pub use data::*;
use derive_more::{Deref, DerefMut}; use derive_more::{Deref, DerefMut};
pub use dimensions::{update_bounding_box, EntityDimensions}; pub use dimensions::{update_bounding_box, EntityDimensions};
pub use info::{EntityInfos, EntityPlugin, LoadedBy, PartialEntityInfos, RelativeEntityUpdate};
use std::fmt::Debug; use std::fmt::Debug;
use uuid::Uuid; use uuid::Uuid;
@ -314,6 +316,11 @@ pub struct PlayerBundle {
pub metadata: metadata::PlayerMetadataBundle, 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)] // #[cfg(test)]
// mod tests { // mod tests {
// use super::*; // use super::*;

View file

@ -7,7 +7,6 @@ mod bit_storage;
mod chunk_storage; mod chunk_storage;
mod container; mod container;
pub mod entity; pub mod entity;
mod entity_info;
mod palette; mod palette;
mod world; mod world;
@ -16,9 +15,6 @@ use std::backtrace::Backtrace;
pub use bit_storage::BitStorage; pub use bit_storage::BitStorage;
pub use chunk_storage::{Chunk, ChunkStorage, PartialChunkStorage}; pub use chunk_storage::{Chunk, ChunkStorage, PartialChunkStorage};
pub use container::*; pub use container::*;
pub use entity_info::{
EntityInfos, EntityPlugin, LoadedBy, Local, PartialEntityInfos, RelativeEntityUpdate,
};
use thiserror::Error; use thiserror::Error;
pub use world::*; pub use world::*;

View file

@ -1,7 +1,8 @@
use crate::{ use crate::{
entity::{EntityUuid, MinecraftEntityId, WorldName}, entity::{
entity_info::LoadedBy, EntityInfos, EntityUuid, LoadedBy, Local, MinecraftEntityId, PartialEntityInfos, WorldName,
ChunkStorage, EntityInfos, Local, PartialChunkStorage, PartialEntityInfos, WorldContainer, },
ChunkStorage, PartialChunkStorage, WorldContainer,
}; };
use azalea_core::ChunkPos; use azalea_core::ChunkPos;
use azalea_ecs::{ use azalea_ecs::{

View file

@ -1,4 +1,4 @@
//! mat's bot for testing new azalea features //! a bot for testing new azalea features
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]

View file

@ -9,10 +9,7 @@ use azalea_ecs::{
system::{Commands, Query}, system::{Commands, Query},
AppTickExt, AppTickExt,
}; };
use azalea_world::{ use azalea_world::entity::{metadata::Player, set_rotation, Jumping, Local, Physics, Position};
entity::{metadata::Player, set_rotation, Jumping, Physics, Position},
Local,
};
use std::f64::consts::PI; use std::f64::consts::PI;
use crate::pathfinder::PathfinderPlugin; use crate::pathfinder::PathfinderPlugin;

View file

@ -17,7 +17,7 @@ use azalea_ecs::{
AppTickExt, AppTickExt,
}; };
use azalea_world::entity::metadata::Player; use azalea_world::entity::metadata::Player;
use azalea_world::Local; use azalea_world::entity::Local;
use azalea_world::{ use azalea_world::{
entity::{Physics, Position, WorldName}, entity::{Physics, Position, WorldName},
WorldContainer, WorldContainer,