From 284a5b645e3b9508234e842f3a3020b4f16aa432 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 30 Jan 2023 16:24:37 +0000 Subject: [PATCH] azalea-ecs stuff compiles --- Cargo.lock | 9 +- azalea-client/src/client.rs | 7 +- azalea-client/src/entity_query.rs | 10 +- azalea-client/src/events.rs | 4 +- azalea-client/src/local_player.rs | 5 +- azalea-client/src/movement.rs | 12 +- azalea-client/src/packet_handling.rs | 5 +- azalea-ecs/azalea-ecs-macros/src/component.rs | 4 +- azalea-ecs/azalea-ecs-macros/src/lib.rs | 6 +- .../azalea-ecs-macros/src/utils/attrs.rs | 2 + azalea-ecs/azalea-ecs-macros/src/utils/mod.rs | 16 +- azalea-ecs/src/lib.rs | 39 ++- azalea-physics/Cargo.toml | 3 +- azalea-physics/src/lib.rs | 55 ++-- azalea-world/Cargo.toml | 3 +- azalea-world/src/container.rs | 2 +- azalea-world/src/entity/attributes.rs | 2 +- azalea-world/src/entity/data.rs | 7 +- azalea-world/src/entity/dimensions.rs | 2 +- azalea-world/src/entity/metadata.rs | 262 +++++++++--------- azalea-world/src/entity/mod.rs | 12 +- azalea-world/src/entity_info.rs | 15 +- azalea-world/src/world.rs | 5 +- azalea/Cargo.toml | 3 +- azalea/src/bot.rs | 17 +- azalea/src/lib.rs | 8 +- azalea/src/pathfinder/mod.rs | 35 +-- azalea/src/prelude.rs | 3 +- azalea/src/swarm/chat.rs | 13 +- azalea/src/swarm/events.rs | 14 +- azalea/src/swarm/mod.rs | 21 +- bot/src/main.rs | 2 +- codegen/lib/code/entity.py | 14 +- 33 files changed, 327 insertions(+), 290 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 793c5c35..6ebf2ce5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -170,12 +170,11 @@ dependencies = [ "azalea-chat", "azalea-client", "azalea-core", + "azalea-ecs", "azalea-physics", "azalea-protocol", "azalea-registry", "azalea-world", - "bevy_app", - "bevy_ecs", "derive_more", "env_logger 0.10.0", "futures", @@ -377,10 +376,9 @@ version = "0.5.0" dependencies = [ "azalea-block", "azalea-core", + "azalea-ecs", "azalea-registry", "azalea-world", - "bevy_app", - "bevy_ecs", "iyes_loopless", "once_cell", "parking_lot", @@ -459,10 +457,9 @@ dependencies = [ "azalea-buf", "azalea-chat", "azalea-core", + "azalea-ecs", "azalea-nbt", "azalea-registry", - "bevy_app", - "bevy_ecs", "derive_more", "enum-as-inner", "iyes_loopless", diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index 9e9f112e..be971ccd 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -11,12 +11,13 @@ use crate::{ use azalea_auth::{game_profile::GameProfile, sessionserver::ClientSessionServerError}; use azalea_chat::FormattedText; -use azalea_ecs::{ecs::Ecs, TickPlugin}; use azalea_ecs::{ + app::{App, Plugin}, component::Component, + entity::Entity, schedule::{IntoSystemDescriptor, Schedule, Stage, SystemSet}, - App, Plugin, }; +use azalea_ecs::{ecs::Ecs, TickPlugin}; use azalea_physics::PhysicsPlugin; use azalea_protocol::{ connect::{Connection, ConnectionError}, @@ -38,7 +39,7 @@ use azalea_protocol::{ }, resolver, ServerAddress, }; -use azalea_world::{entity::Entity, EntityPlugin, Local, PartialWorld, World, WorldContainer}; +use azalea_world::{EntityPlugin, Local, PartialWorld, World, WorldContainer}; use bevy_time::TimePlugin; use iyes_loopless::prelude::*; use log::{debug, error}; diff --git a/azalea-client/src/entity_query.rs b/azalea-client/src/entity_query.rs index ceff5d29..9d2fcb09 100644 --- a/azalea-client/src/entity_query.rs +++ b/azalea-client/src/entity_query.rs @@ -1,9 +1,11 @@ use std::sync::Arc; -use azalea_ecs::component::Component; -use azalea_ecs::ecs::Ecs; -use azalea_ecs::query::{ROQueryItem, ReadOnlyWorldQuery, WorldQuery}; -use azalea_world::entity::Entity; +use azalea_ecs::{ + component::Component, + ecs::Ecs, + entity::Entity, + query::{ROQueryItem, ReadOnlyWorldQuery, WorldQuery}, +}; use parking_lot::Mutex; use crate::Client; diff --git a/azalea-client/src/events.rs b/azalea-client/src/events.rs index 50d0cb7a..502fb5a2 100644 --- a/azalea-client/src/events.rs +++ b/azalea-client/src/events.rs @@ -4,11 +4,11 @@ use std::sync::Arc; use azalea_ecs::{ + app::{App, Plugin}, component::Component, event::EventReader, query::{Added, Changed}, system::Query, - Plugin, }; use azalea_protocol::packets::game::{ clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket, ClientboundGamePacket, @@ -85,7 +85,7 @@ pub struct LocalPlayerEvents(pub mpsc::UnboundedSender); pub struct EventPlugin; impl Plugin for EventPlugin { - fn build(&self, app: &mut azalea_ecs::App) { + fn build(&self, app: &mut App) { app.add_system(chat_listener) .add_system(login_listener) .add_system(init_listener) diff --git a/azalea-client/src/local_player.rs b/azalea-client/src/local_player.rs index 9de987b5..3ad72bea 100644 --- a/azalea-client/src/local_player.rs +++ b/azalea-client/src/local_player.rs @@ -3,12 +3,13 @@ use std::{collections::HashMap, io, sync::Arc}; use azalea_auth::game_profile::GameProfile; use azalea_core::{ChunkPos, ResourceLocation}; use azalea_ecs::component::Component; +use azalea_ecs::entity::Entity; +use azalea_ecs::{query::Added, system::Query}; use azalea_protocol::packets::game::ServerboundGamePacket; use azalea_world::{ - entity::{self, Dead, Entity}, + entity::{self, Dead}, PartialWorld, World, }; -use bevy_ecs::{component::Component, query::Added, system::Query}; use derive_more::{Deref, DerefMut}; use parking_lot::RwLock; use thiserror::Error; diff --git a/azalea-client/src/movement.rs b/azalea-client/src/movement.rs index 30f017eb..8d6faabe 100644 --- a/azalea-client/src/movement.rs +++ b/azalea-client/src/movement.rs @@ -1,5 +1,7 @@ use crate::client::Client; use crate::local_player::{LocalPlayer, LocalPlayerInLoadedChunk, PhysicsState}; +use azalea_ecs::entity::Entity; +use azalea_ecs::{event::EventReader, query::With, system::Query}; use azalea_protocol::packets::game::serverbound_player_command_packet::ServerboundPlayerCommandPacket; use azalea_protocol::packets::game::{ serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket, @@ -7,12 +9,10 @@ use azalea_protocol::packets::game::{ serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket, serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket, }; -use azalea_world::entity::metadata::Sprinting; -use azalea_world::entity::{Attributes, Entity, Jumping, MinecraftEntityId}; -use azalea_world::{entity, MoveEntityError}; -use bevy_ecs::event::EventReader; -use bevy_ecs::prelude::With; -use bevy_ecs::system::Query; +use azalea_world::{ + entity::{self, metadata::Sprinting, Attributes, Jumping, MinecraftEntityId}, + MoveEntityError, +}; use std::backtrace::Backtrace; use thiserror::Error; diff --git a/azalea-client/src/packet_handling.rs b/azalea-client/src/packet_handling.rs index 0a235b64..7e9255a8 100644 --- a/azalea-client/src/packet_handling.rs +++ b/azalea-client/src/packet_handling.rs @@ -1,14 +1,13 @@ use std::{collections::HashSet, io::Cursor, sync::Arc}; use azalea_core::{ChunkPos, ResourceLocation, Vec3}; -use azalea_ecs::{component::Component, ecs::Ecs}; use azalea_ecs::{ component::Component, - prelude::{Entity, EventWriter}, + ecs::Ecs, query::Changed, schedule::{IntoSystemDescriptor, SystemSet}, system::{Commands, Query, ResMut, SystemState}, - App, Plugin, + app::{App, Plugin}, event::EventWriter, entity::Entity, }; use azalea_protocol::{ connect::{ReadConnection, WriteConnection}, diff --git a/azalea-ecs/azalea-ecs-macros/src/component.rs b/azalea-ecs/azalea-ecs-macros/src/component.rs index 50acfe49..015c31be 100644 --- a/azalea-ecs/azalea-ecs-macros/src/component.rs +++ b/azalea-ecs/azalea-ecs-macros/src/component.rs @@ -19,7 +19,7 @@ pub fn derive_resource(input: TokenStream) -> TokenStream { let (impl_generics, type_generics, where_clause) = &ast.generics.split_for_impl(); TokenStream::from(quote! { - impl #impl_generics #azalea_ecs_path::system::Resource for #struct_name #type_generics #where_clause { + impl #impl_generics #azalea_ecs_path::system::BevyResource for #struct_name #type_generics #where_clause { } }) } @@ -44,7 +44,7 @@ pub fn derive_component(input: TokenStream) -> TokenStream { let (impl_generics, type_generics, where_clause) = &ast.generics.split_for_impl(); TokenStream::from(quote! { - impl #impl_generics #azalea_ecs_path::component::Component for #struct_name #type_generics #where_clause { + impl #impl_generics #azalea_ecs_path::component::BevyComponent for #struct_name #type_generics #where_clause { type Storage = #storage; } }) diff --git a/azalea-ecs/azalea-ecs-macros/src/lib.rs b/azalea-ecs/azalea-ecs-macros/src/lib.rs index 5ddca300..09ccb094 100755 --- a/azalea-ecs/azalea-ecs-macros/src/lib.rs +++ b/azalea-ecs/azalea-ecs-macros/src/lib.rs @@ -151,13 +151,13 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream { match field_kind { BundleFieldKind::Component => { field_component_ids.push(quote! { - <#field_type as #ecs_path::bundle::Bundle>::component_ids(components, storages, &mut *ids); + <#field_type as #ecs_path::bundle::BevyBundle>::component_ids(components, storages, &mut *ids); }); field_get_components.push(quote! { self.#field.get_components(&mut *func); }); field_from_components.push(quote! { - #field: <#field_type as #ecs_path::bundle::Bundle>::from_components(ctx, &mut *func), + #field: <#field_type as #ecs_path::bundle::BevyBundle>::from_components(ctx, &mut *func), }); } @@ -174,7 +174,7 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream { TokenStream::from(quote! { /// SAFETY: ComponentId is returned in field-definition-order. [from_components] and [get_components] use field-definition-order - unsafe impl #impl_generics #ecs_path::bundle::Bundle for #struct_name #ty_generics #where_clause { + unsafe impl #impl_generics #ecs_path::bundle::BevyBundle for #struct_name #ty_generics #where_clause { fn component_ids( components: &mut #ecs_path::component::Components, storages: &mut #ecs_path::storage::Storages, diff --git a/azalea-ecs/azalea-ecs-macros/src/utils/attrs.rs b/azalea-ecs/azalea-ecs-macros/src/utils/attrs.rs index 8b2f0a2b..6863d79e 100644 --- a/azalea-ecs/azalea-ecs-macros/src/utils/attrs.rs +++ b/azalea-ecs/azalea-ecs-macros/src/utils/attrs.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use syn::DeriveInput; use super::symbol::Symbol; diff --git a/azalea-ecs/azalea-ecs-macros/src/utils/mod.rs b/azalea-ecs/azalea-ecs-macros/src/utils/mod.rs index 0af86d05..5fbba0e9 100644 --- a/azalea-ecs/azalea-ecs-macros/src/utils/mod.rs +++ b/azalea-ecs/azalea-ecs-macros/src/utils/mod.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + extern crate proc_macro; mod attrs; @@ -35,8 +37,9 @@ impl Default for BevyManifest { impl BevyManifest { pub fn maybe_get_path(&self, name: &str) -> Option { + const AZALEA: &str = "azalea"; + const BEVY_ECS: &str = "bevy_ecs"; const BEVY: &str = "bevy"; - const BEVY_INTERNAL: &str = "bevy_internal"; fn dep_package(dep: &Value) -> Option<&str> { if dep.as_str().is_some() { @@ -52,16 +55,18 @@ impl BevyManifest { let find_in_deps = |deps: &Map| -> Option { let package = if let Some(dep) = deps.get(name) { return Some(Self::parse_str(dep_package(dep).unwrap_or(name))); + } else if let Some(dep) = deps.get(AZALEA) { + dep_package(dep).unwrap_or(AZALEA) + } else if let Some(dep) = deps.get(BEVY_ECS) { + dep_package(dep).unwrap_or(BEVY_ECS) } else if let Some(dep) = deps.get(BEVY) { dep_package(dep).unwrap_or(BEVY) - } else if let Some(dep) = deps.get(BEVY_INTERNAL) { - dep_package(dep).unwrap_or(BEVY_INTERNAL) } else { return None; }; let mut path = Self::parse_str::(package); - if let Some(module) = name.strip_prefix("bevy_") { + if let Some(module) = name.strip_prefix("azalea_") { path.segments.push(Self::parse_str(module)); } Some(path) @@ -109,7 +114,8 @@ impl BevyManifest { /// /// # Args /// -/// - `input`: The [`syn::DeriveInput`] for struct that is deriving the label trait +/// - `input`: The [`syn::DeriveInput`] for struct that is deriving the label +/// trait /// - `trait_path`: The path [`syn::Path`] to the label trait pub fn derive_label( input: syn::DeriveInput, diff --git a/azalea-ecs/src/lib.rs b/azalea-ecs/src/lib.rs index 9a177e8c..1f8ac993 100644 --- a/azalea-ecs/src/lib.rs +++ b/azalea-ecs/src/lib.rs @@ -1,18 +1,29 @@ #![feature(trait_alias)] -//! Re-export the necessary parts of `bevy_ecs` and `bevy_app`. +//! Re-export important parts of `bevy_ecs` and `bevy_app` and make them more +//! compatible with Azalea. //! //! This is completely compatible with `bevy_ecs`, so it won't cause issues if //! you use plugins meant for Bevy. +//! +//! Changes: +//! - Add [`TickPlugin`], [`TickStage`] and [`AppTickExt`] +//! - Change the macros to use azalea_ecs instead of bevy_ecs +//! - Rename bevy_ecs::world::World to azalea_ecs::ecs::Ecs +//! - Re-export `bevy_app` in the `app` module. use std::{ task::{Context, Poll}, time::Duration, }; +pub mod ecs { + pub use bevy_ecs::world::World as Ecs; + pub use bevy_ecs::world::{EntityMut, EntityRef, Mut}; +} pub mod component { pub use azalea_ecs_macros::Component; - pub use bevy_ecs::component::{ComponentStorage, TableStorage}; + pub use bevy_ecs::component::{ComponentId, ComponentStorage, Components, TableStorage}; // we do this because re-exporting Component would re-export the macro as well, // which is bad (since we have our own Component macro) @@ -21,14 +32,24 @@ pub mod component { pub trait Component = bevy_ecs::component::Component; pub use bevy_ecs::component::Component as BevyComponent; } -pub mod ecs { - pub use bevy_ecs::world::World as Ecs; - pub use bevy_ecs::world::{EntityMut, EntityRef, Mut}; +pub mod bundle { + pub use azalea_ecs_macros::Bundle; + pub trait Bundle = bevy_ecs::bundle::Bundle; + pub use bevy_ecs::bundle::Bundle as BevyBundle; } -pub use bevy_app::*; +pub mod system { + pub use azalea_ecs_macros::Resource; + pub use bevy_ecs::system::{ + Command, Commands, EntityCommands, Query, Res, ResMut, SystemState, + }; + pub trait Resource = bevy_ecs::system::Resource; + pub use bevy_ecs::system::Resource as BevyResource; +} +pub use bevy_app as app; +pub use bevy_ecs::{entity, event, ptr, query, schedule, storage}; + +use app::{App, CoreStage, Plugin}; use bevy_ecs::schedule::*; -pub use bevy_ecs::system; -pub use bevy_ecs::{event, query, schedule}; use ecs::Ecs; use futures::task::noop_waker_ref; use tokio::time::Interval; @@ -68,7 +89,7 @@ impl TickStage { impl Stage for TickStage { fn run(&mut self, ecs: &mut Ecs) { // keep calling run until it's caught up - while let Poll::Ready(r) = self + while let Poll::Ready(_) = self .interval .poll_tick(&mut Context::from_waker(&noop_waker_ref())) { diff --git a/azalea-physics/Cargo.toml b/azalea-physics/Cargo.toml index 224f3e14..e0fc7f96 100644 --- a/azalea-physics/Cargo.toml +++ b/azalea-physics/Cargo.toml @@ -13,11 +13,10 @@ azalea-block = { path = "../azalea-block", version = "^0.5.0" } azalea-core = { path = "../azalea-core", version = "^0.5.0" } azalea-world = { path = "../azalea-world", version = "^0.5.0" } azalea-registry = { path = "../azalea-registry", version = "^0.5.0" } -bevy_app = { version = "0.9.1", default-features = false } -bevy_ecs = { version = "0.9.1", default-features = false } iyes_loopless = "0.9.1" once_cell = "1.16.0" parking_lot = "^0.12.1" +azalea-ecs = { version = "0.5.0", path = "../azalea-ecs" } [dev-dependencies] uuid = "^1.1.2" diff --git a/azalea-physics/src/lib.rs b/azalea-physics/src/lib.rs index 93f48517..2b06640d 100644 --- a/azalea-physics/src/lib.rs +++ b/azalea-physics/src/lib.rs @@ -4,44 +4,41 @@ pub mod collision; use azalea_block::{Block, BlockState}; use azalea_core::{BlockPos, Vec3}; +use azalea_ecs::{ + app::{App, Plugin}, + entity::Entity, + event::{EventReader, EventWriter}, + query::With, + schedule::{IntoSystemDescriptor, SystemSet}, + system::{Query, Res}, + AppTickExt, +}; use azalea_world::{ entity::{ - metadata::Sprinting, move_relative, Attributes, Entity, Jumping, Physics, Position, - WorldName, + metadata::Sprinting, move_relative, Attributes, Jumping, Physics, Position, WorldName, }, Local, World, WorldContainer, }; -use bevy_app::Plugin; -use bevy_ecs::{ - event::{EventReader, EventWriter}, - query::With, - schedule::{IntoSystemDescriptor, SystemStage}, - system::Res, -}; -use bevy_ecs::{schedule::SystemSet, system::Query}; use collision::{move_colliding, MoverType}; pub struct PhysicsPlugin; impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut bevy_app::App) { - app.add_event::() - .stage("tick", |stage: &mut SystemStage| { - stage.add_system_set( - SystemSet::new() - .with_system(ai_step.label("ai_step")) - .with_system( - force_jump_listener - .label("force_jump_listener") - .after("ai_step"), - ) - .with_system( - travel - .label("travel") - .after("ai_step") - .after("force_jump_listener"), - ), + fn build(&self, app: &mut App) { + app.add_event::().add_tick_system_set( + SystemSet::new() + .with_system(ai_step.label("ai_step")) + .with_system( + force_jump_listener + .label("force_jump_listener") + .after("ai_step"), ) - }); + .with_system( + travel + .label("travel") + .after("ai_step") + .after("force_jump_listener"), + ), + ); } } @@ -310,11 +307,11 @@ mod tests { use super::*; use azalea_core::{ChunkPos, ResourceLocation}; + use azalea_ecs::app::App; use azalea_world::{ entity::{EntityBundle, MinecraftEntityId}, Chunk, EntityPlugin, PartialWorld, }; - use bevy_app::App; use iyes_loopless::fixedtimestep::FixedTimestepStageLabel; use parking_lot::RwLock; use uuid::Uuid; diff --git a/azalea-world/Cargo.toml b/azalea-world/Cargo.toml index d2d42940..4ddbd54f 100644 --- a/azalea-world/Cargo.toml +++ b/azalea-world/Cargo.toml @@ -13,10 +13,9 @@ azalea-block = {path = "../azalea-block", default-features = false, version = "^ azalea-buf = {path = "../azalea-buf", version = "^0.5.0"} azalea-chat = {path = "../azalea-chat", version = "^0.5.0"} azalea-core = {path = "../azalea-core", version = "^0.5.0", features = ["bevy_ecs"]} +azalea-ecs = { version = "0.5.0", path = "../azalea-ecs" } azalea-nbt = {path = "../azalea-nbt", version = "^0.5.0"} azalea-registry = {path = "../azalea-registry", version = "^0.5.0"} -bevy_app = {version = "0.9.1", default-features = false} -bevy_ecs = {version = "0.9.1", default-features = false} derive_more = {version = "0.99.17", features = ["deref", "deref_mut"]} enum-as-inner = "0.5.1" iyes_loopless = "0.9.1" diff --git a/azalea-world/src/container.rs b/azalea-world/src/container.rs index 86f42797..74d70659 100644 --- a/azalea-world/src/container.rs +++ b/azalea-world/src/container.rs @@ -1,5 +1,5 @@ use azalea_core::ResourceLocation; -use bevy_ecs::system::Resource; +use azalea_ecs::system::Resource; use log::error; use nohash_hasher::IntMap; use parking_lot::RwLock; diff --git a/azalea-world/src/entity/attributes.rs b/azalea-world/src/entity/attributes.rs index 33e47a6b..984c2de3 100644 --- a/azalea-world/src/entity/attributes.rs +++ b/azalea-world/src/entity/attributes.rs @@ -6,7 +6,7 @@ use std::{ }; use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; -use bevy_ecs::component::Component; +use azalea_ecs::component::Component; use thiserror::Error; use uuid::{uuid, Uuid}; diff --git a/azalea-world/src/entity/data.rs b/azalea-world/src/entity/data.rs index f5af8a5e..14d257e3 100755 --- a/azalea-world/src/entity/data.rs +++ b/azalea-world/src/entity/data.rs @@ -1,11 +1,12 @@ //! Define some types needed for entity metadata. use azalea_block::BlockState; -use azalea_buf::{BufReadError, McBufVarReadable, McBufVarWritable}; -use azalea_buf::{McBuf, McBufReadable, McBufWritable}; +use azalea_buf::{ + BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, +}; use azalea_chat::FormattedText; use azalea_core::{BlockPos, Direction, GlobalPos, Particle, Slot}; -use bevy_ecs::component::Component; +use azalea_ecs::component::Component; use derive_more::Deref; use enum_as_inner::EnumAsInner; use nohash_hasher::IntSet; diff --git a/azalea-world/src/entity/dimensions.rs b/azalea-world/src/entity/dimensions.rs index 5e716307..daf85432 100755 --- a/azalea-world/src/entity/dimensions.rs +++ b/azalea-world/src/entity/dimensions.rs @@ -1,5 +1,5 @@ use azalea_core::{Vec3, AABB}; -use bevy_ecs::{query::Changed, system::Query}; +use azalea_ecs::{query::Changed, system::Query}; use super::{Physics, Position}; diff --git a/azalea-world/src/entity/metadata.rs b/azalea-world/src/entity/metadata.rs index fe771fb2..c95d8c3a 100644 --- a/azalea-world/src/entity/metadata.rs +++ b/azalea-world/src/entity/metadata.rs @@ -7,7 +7,7 @@ use super::{EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Rotation use azalea_block::BlockState; use azalea_chat::FormattedText; use azalea_core::{BlockPos, Direction, Particle, Slot}; -use bevy_ecs::{bundle::Bundle, component::Component}; +use azalea_ecs::{bundle::Bundle, component::Component}; use derive_more::{Deref, DerefMut}; use thiserror::Error; use uuid::Uuid; @@ -79,7 +79,7 @@ pub struct CanDuplicate(pub bool); pub struct Allay; impl Allay { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -160,7 +160,7 @@ pub struct Waiting(pub bool); pub struct AreaEffectCloud; impl AreaEffectCloud { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -245,7 +245,7 @@ pub struct RightLegPose(pub Rotations); pub struct ArmorStand; impl ArmorStand { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -356,7 +356,7 @@ pub struct ArrowEffectColor(pub i32); pub struct Arrow; impl Arrow { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -431,7 +431,7 @@ pub struct AxolotlFromBucket(pub bool); pub struct Axolotl; impl Axolotl { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -520,7 +520,7 @@ pub struct Resting(pub bool); pub struct Bat; impl Bat { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -596,7 +596,7 @@ pub struct BeeRemainingAngerTime(pub i32); pub struct Bee; impl Bee { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -687,7 +687,7 @@ pub struct Charged(pub bool); pub struct Blaze; impl Blaze { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -775,7 +775,7 @@ pub struct BubbleTime(pub i32); pub struct Boat; impl Boat { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -871,7 +871,7 @@ pub struct LastPoseChangeTick(pub i64); pub struct Camel; impl Camel { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -990,7 +990,7 @@ pub struct CatCollarColor(pub i32); pub struct Cat; impl Cat { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1090,7 +1090,7 @@ pub struct Climbing(pub bool); pub struct CaveSpider; impl CaveSpider { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1162,7 +1162,7 @@ impl Default for CaveSpiderMetadataBundle { pub struct ChestBoat; impl ChestBoat { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1229,7 +1229,7 @@ pub struct CustomDisplay(pub bool); pub struct ChestMinecart; impl ChestMinecart { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1283,7 +1283,7 @@ impl Default for ChestMinecartMetadataBundle { pub struct Chicken; impl Chicken { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1357,7 +1357,7 @@ pub struct CodFromBucket(pub bool); pub struct Cod; impl Cod { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1431,7 +1431,7 @@ pub struct LastOutput(pub FormattedText); pub struct CommandBlockMinecart; impl CommandBlockMinecart { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1495,7 +1495,7 @@ impl Default for CommandBlockMinecartMetadataBundle { pub struct Cow; impl Cow { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1573,7 +1573,7 @@ pub struct IsIgnited(pub bool); pub struct Creeper; impl Creeper { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1662,7 +1662,7 @@ pub struct MoistnessLevel(pub i32); pub struct Dolphin; impl Dolphin { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1756,7 +1756,7 @@ pub struct DonkeyChest(pub bool); pub struct Donkey; impl Donkey { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1856,7 +1856,7 @@ impl Default for DonkeyMetadataBundle { pub struct DragonFireball; impl DragonFireball { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1907,7 +1907,7 @@ pub struct DrownedConversion(pub bool); pub struct Drowned; impl Drowned { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -1983,7 +1983,7 @@ pub struct EggItemStack(pub Slot); pub struct Egg; impl Egg { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2037,7 +2037,7 @@ pub struct AttackTarget(pub i32); pub struct ElderGuardian; impl ElderGuardian { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2114,7 +2114,7 @@ pub struct ShowBottom(pub bool); pub struct EndCrystal; impl EndCrystal { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2171,7 +2171,7 @@ pub struct Phase(pub i32); pub struct EnderDragon; impl EnderDragon { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2240,7 +2240,7 @@ pub struct EnderPearlItemStack(pub Slot); pub struct EnderPearl; impl EnderPearl { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2296,7 +2296,7 @@ pub struct StaredAt(pub bool); pub struct Enderman; impl Enderman { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2379,7 +2379,7 @@ impl Default for EndermanMetadataBundle { pub struct Endermite; impl Endermite { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2451,7 +2451,7 @@ pub struct EvokerSpellCasting(pub u8); pub struct Evoker; impl Evoker { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2529,7 +2529,7 @@ impl Default for EvokerMetadataBundle { pub struct EvokerFangs; impl EvokerFangs { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2576,7 +2576,7 @@ pub struct ExperienceBottleItemStack(pub Slot); pub struct ExperienceBottle; impl ExperienceBottle { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2626,7 +2626,7 @@ impl Default for ExperienceBottleMetadataBundle { pub struct ExperienceOrb; impl ExperienceOrb { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2673,7 +2673,7 @@ pub struct EyeOfEnderItemStack(pub Slot); pub struct EyeOfEnder; impl EyeOfEnder { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2725,7 +2725,7 @@ pub struct StartPos(pub BlockPos); pub struct FallingBlock; impl FallingBlock { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2777,7 +2777,7 @@ pub struct FireballItemStack(pub Slot); pub struct Fireball; impl Fireball { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2833,7 +2833,7 @@ pub struct ShotAtAngle(pub bool); pub struct FireworkRocket; impl FireworkRocket { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2897,7 +2897,7 @@ pub struct Biting(pub bool); pub struct FishingBobber; impl FishingBobber { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -2970,7 +2970,7 @@ pub struct TrustedId1(pub Option); pub struct Fox; impl Fox { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3082,7 +3082,7 @@ pub struct TongueTarget(pub OptionalUnsignedInt); pub struct Frog; impl Frog { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3166,7 +3166,7 @@ pub struct Fuel(pub bool); pub struct FurnaceMinecart; impl FurnaceMinecart { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3227,7 +3227,7 @@ pub struct IsCharging(pub bool); pub struct Ghast; impl Ghast { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3294,7 +3294,7 @@ impl Default for GhastMetadataBundle { pub struct Giant; impl Giant { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3366,7 +3366,7 @@ pub struct Rotation(pub i32); pub struct GlowItemFrame; impl GlowItemFrame { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3418,7 +3418,7 @@ pub struct DarkTicksRemaining(pub i32); pub struct GlowSquid; impl GlowSquid { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3497,7 +3497,7 @@ pub struct HasRightHorn(pub bool); pub struct Goat; impl Goat { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3584,7 +3584,7 @@ impl Default for GoatMetadataBundle { pub struct Guardian; impl Guardian { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3664,7 +3664,7 @@ pub struct HoglinImmuneToZombification(pub bool); pub struct Hoglin; impl Hoglin { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3741,7 +3741,7 @@ impl Default for HoglinMetadataBundle { pub struct HopperMinecart; impl HopperMinecart { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3809,7 +3809,7 @@ pub struct HorseTypeVariant(pub i32); pub struct Horse; impl Horse { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3909,7 +3909,7 @@ impl Default for HorseMetadataBundle { pub struct Husk; impl Husk { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -3987,7 +3987,7 @@ pub struct IllusionerSpellCasting(pub u8); pub struct Illusioner; impl Illusioner { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4067,7 +4067,7 @@ pub struct PlayerCreated(pub bool); pub struct IronGolem; impl IronGolem { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4140,7 +4140,7 @@ pub struct ItemItem(pub Slot); pub struct Item; impl Item { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4190,7 +4190,7 @@ impl Default for ItemMetadataBundle { pub struct ItemFrame; impl ItemFrame { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4245,7 +4245,7 @@ impl Default for ItemFrameMetadataBundle { pub struct LeashKnot; impl LeashKnot { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4290,7 +4290,7 @@ impl Default for LeashKnotMetadataBundle { pub struct LightningBolt; impl LightningBolt { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4355,7 +4355,7 @@ pub struct LlamaVariant(pub i32); pub struct Llama; impl Llama { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4470,7 +4470,7 @@ impl Default for LlamaMetadataBundle { pub struct LlamaSpit; impl LlamaSpit { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4517,7 +4517,7 @@ pub struct SlimeSize(pub i32); pub struct MagmaCube; impl MagmaCube { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4583,7 +4583,7 @@ impl Default for MagmaCubeMetadataBundle { pub struct Marker; impl Marker { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4628,7 +4628,7 @@ impl Default for MarkerMetadataBundle { pub struct Minecart; impl Minecart { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4684,7 +4684,7 @@ pub struct MooshroomKind(pub String); pub struct Mooshroom; impl Mooshroom { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4778,7 +4778,7 @@ pub struct MuleChest(pub bool); pub struct Mule; impl Mule { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4880,7 +4880,7 @@ pub struct Trusting(pub bool); pub struct Ocelot; impl Ocelot { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -4959,7 +4959,7 @@ pub struct PaintingVariant(pub azalea_registry::PaintingVariant); pub struct Painting; impl Painting { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5027,7 +5027,7 @@ pub struct PandaFlags(pub u8); pub struct Panda; impl Panda { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5141,7 +5141,7 @@ pub struct ParrotVariant(pub i32); pub struct Parrot; impl Parrot { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5226,7 +5226,7 @@ pub struct PhantomSize(pub i32); pub struct Phantom; impl Phantom { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5297,7 +5297,7 @@ pub struct PigBoostTime(pub i32); pub struct Pig; impl Pig { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5387,7 +5387,7 @@ pub struct IsDancing(pub bool); pub struct Piglin; impl Piglin { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5477,7 +5477,7 @@ pub struct PiglinBruteImmuneToZombification(pub bool); pub struct PiglinBrute; impl PiglinBrute { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5554,7 +5554,7 @@ pub struct PillagerIsChargingCrossbow(pub bool); pub struct Pillager; impl Pillager { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5644,7 +5644,7 @@ pub struct ShoulderRight(pub azalea_nbt::Tag); pub struct Player; impl Player { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5732,7 +5732,7 @@ pub struct PolarBearStanding(pub bool); pub struct PolarBear; impl PolarBear { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5811,7 +5811,7 @@ pub struct PotionItemStack(pub Slot); pub struct Potion; impl Potion { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5865,7 +5865,7 @@ pub struct PuffState(pub i32); pub struct Pufferfish; impl Pufferfish { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -5942,7 +5942,7 @@ pub struct RabbitKind(pub i32); pub struct Rabbit; impl Rabbit { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6021,7 +6021,7 @@ pub struct RavagerIsCelebrating(pub bool); pub struct Ravager; impl Ravager { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6096,7 +6096,7 @@ pub struct SalmonFromBucket(pub bool); pub struct Salmon; impl Salmon { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6168,7 +6168,7 @@ pub struct Sheared(pub bool); pub struct Sheep; impl Sheep { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6252,7 +6252,7 @@ pub struct ShulkerColor(pub u8); pub struct Shulker; impl Shulker { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6332,7 +6332,7 @@ impl Default for ShulkerMetadataBundle { pub struct ShulkerBullet; impl ShulkerBullet { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6377,7 +6377,7 @@ impl Default for ShulkerBulletMetadataBundle { pub struct Silverfish; impl Silverfish { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6447,7 +6447,7 @@ pub struct StrayConversion(pub bool); pub struct Skeleton; impl Skeleton { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6532,7 +6532,7 @@ pub struct SkeletonHorseOwnerUuid(pub Option); pub struct SkeletonHorse; impl SkeletonHorse { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6627,7 +6627,7 @@ impl Default for SkeletonHorseMetadataBundle { pub struct Slime; impl Slime { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6696,7 +6696,7 @@ pub struct SmallFireballItemStack(pub Slot); pub struct SmallFireball; impl SmallFireball { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6748,7 +6748,7 @@ pub struct HasPumpkin(pub bool); pub struct SnowGolem; impl SnowGolem { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6821,7 +6821,7 @@ pub struct SnowballItemStack(pub Slot); pub struct Snowball; impl Snowball { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6871,7 +6871,7 @@ impl Default for SnowballMetadataBundle { pub struct SpawnerMinecart; impl SpawnerMinecart { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6933,7 +6933,7 @@ pub struct SpectralArrowPierceLevel(pub u8); pub struct SpectralArrow; impl SpectralArrow { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -6995,7 +6995,7 @@ impl Default for SpectralArrowMetadataBundle { pub struct Spider; impl Spider { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7069,7 +7069,7 @@ impl Default for SpiderMetadataBundle { pub struct Squid; impl Squid { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7134,7 +7134,7 @@ impl Default for SquidMetadataBundle { pub struct Stray; impl Stray { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7208,7 +7208,7 @@ pub struct StriderSaddle(pub bool); pub struct Strider; impl Strider { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7297,7 +7297,7 @@ pub struct TadpoleFromBucket(pub bool); pub struct Tadpole; impl Tadpole { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7369,7 +7369,7 @@ pub struct Fuse(pub i32); pub struct Tnt; impl Tnt { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7419,7 +7419,7 @@ impl Default for TntMetadataBundle { pub struct TntMinecart; impl TntMinecart { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7473,7 +7473,7 @@ impl Default for TntMinecartMetadataBundle { pub struct TraderLlama; impl TraderLlama { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7570,7 +7570,7 @@ pub struct Foil(pub bool); pub struct Trident; impl Trident { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7646,7 +7646,7 @@ pub struct TropicalFishTypeVariant(pub i32); pub struct TropicalFish; impl TropicalFish { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7733,7 +7733,7 @@ pub struct Travelling(pub bool); pub struct Turtle; impl Turtle { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7837,7 +7837,7 @@ pub struct VexFlags(pub u8); pub struct Vex; impl Vex { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7914,7 +7914,7 @@ pub struct VillagerVillagerData(pub VillagerData); pub struct Villager; impl Villager { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -7999,7 +7999,7 @@ pub struct VindicatorIsCelebrating(pub bool); pub struct Vindicator; impl Vindicator { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8074,7 +8074,7 @@ pub struct WanderingTraderUnhappyCounter(pub i32); pub struct WanderingTrader; impl WanderingTrader { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8150,7 +8150,7 @@ pub struct ClientAngerLevel(pub i32); pub struct Warden; impl Warden { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8227,7 +8227,7 @@ pub struct WitchUsingItem(pub bool); pub struct Witch; impl Witch { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8313,7 +8313,7 @@ pub struct Inv(pub i32); pub struct Wither; impl Wither { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8401,7 +8401,7 @@ impl Default for WitherMetadataBundle { pub struct WitherSkeleton; impl WitherSkeleton { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8471,7 +8471,7 @@ pub struct Dangerous(pub bool); pub struct WitherSkull; impl WitherSkull { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8527,7 +8527,7 @@ pub struct WolfRemainingAngerTime(pub i32); pub struct Wolf; impl Wolf { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8622,7 +8622,7 @@ pub struct ZoglinBaby(pub bool); pub struct Zoglin; impl Zoglin { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8695,7 +8695,7 @@ impl Default for ZoglinMetadataBundle { pub struct Zombie; impl Zombie { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8790,7 +8790,7 @@ pub struct ZombieHorseOwnerUuid(pub Option); pub struct ZombieHorse; impl ZombieHorse { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8889,7 +8889,7 @@ pub struct ZombieVillagerVillagerData(pub VillagerData); pub struct ZombieVillager; impl ZombieVillager { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -8977,7 +8977,7 @@ impl Default for ZombieVillagerMetadataBundle { pub struct ZombifiedPiglin; impl ZombifiedPiglin { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -9051,7 +9051,7 @@ impl Default for ZombifiedPiglinMetadataBundle { pub struct AbstractAgeable; impl AbstractAgeable { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -9121,7 +9121,7 @@ impl Default for AbstractAgeableMetadataBundle { pub struct AbstractAnimal; impl AbstractAnimal { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -9190,7 +9190,7 @@ impl Default for AbstractAnimalMetadataBundle { pub struct AbstractCreature; impl AbstractCreature { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -9252,7 +9252,7 @@ impl Default for AbstractCreatureMetadataBundle { pub struct AbstractEntity; impl AbstractEntity { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -9337,7 +9337,7 @@ impl Default for AbstractEntityMetadataBundle { pub struct AbstractInsentient; impl AbstractInsentient { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -9405,7 +9405,7 @@ impl Default for AbstractInsentientMetadataBundle { pub struct AbstractLiving; impl AbstractLiving { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -9489,7 +9489,7 @@ impl Default for AbstractLivingMetadataBundle { pub struct AbstractMinecart; impl AbstractMinecart { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -9564,7 +9564,7 @@ impl Default for AbstractMinecartMetadataBundle { pub struct AbstractMonster; impl AbstractMonster { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -9629,7 +9629,7 @@ impl Default for AbstractMonsterMetadataBundle { pub struct AbstractTameable; impl AbstractTameable { pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem, ) -> Result<(), UpdateMetadataError> { match d.index { @@ -9712,7 +9712,7 @@ impl Default for AbstractTameableMetadataBundle { } pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, entity_kind: azalea_registry::EntityKind, items: Vec, ) -> Result<(), UpdateMetadataError> { @@ -10317,7 +10317,7 @@ pub fn apply_metadata( } pub fn apply_default_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, kind: azalea_registry::EntityKind, ) { match kind { diff --git a/azalea-world/src/entity/mod.rs b/azalea-world/src/entity/mod.rs index 9a924bb7..8ceddab6 100644 --- a/azalea-world/src/entity/mod.rs +++ b/azalea-world/src/entity/mod.rs @@ -11,9 +11,10 @@ use self::{attributes::AttributeInstance, metadata::Health}; pub use attributes::Attributes; use azalea_block::BlockState; use azalea_core::{BlockPos, ChunkPos, ResourceLocation, Vec3, AABB}; -use bevy_ecs::{ +use azalea_ecs::{ bundle::Bundle, component::Component, + entity::Entity, query::Changed, system::{Commands, Query}, }; @@ -23,15 +24,6 @@ pub use dimensions::{update_bounding_box, EntityDimensions}; use std::fmt::Debug; use uuid::Uuid; -/// A lightweight identifier of an entity. -/// -/// Don't rely on the index of this being the same as a Minecraft entity id! -/// (unless you're implementin a server, in which case you can decide your -/// entity ids however you want) -/// -/// If you want to refer to a Minecraft entity id, use [`MinecraftEntityId`]. -pub type Entity = bevy_ecs::entity::Entity; - /// An entity ID used by Minecraft. These are not guaranteed to be unique in /// shared worlds, that's what [`Entity`] is for. #[derive(Component, Copy, Clone, Debug, PartialEq, Eq, Deref, DerefMut)] diff --git a/azalea-world/src/entity_info.rs b/azalea-world/src/entity_info.rs index 3faee2a4..0a6cf00e 100644 --- a/azalea-world/src/entity_info.rs +++ b/azalea-world/src/entity_info.rs @@ -1,19 +1,20 @@ use crate::{ deduplicate_entities, entity::{ - self, add_dead, update_bounding_box, Entity, EntityUuid, MinecraftEntityId, Position, - WorldName, + self, add_dead, update_bounding_box, EntityUuid, MinecraftEntityId, Position, WorldName, }, update_entity_by_id_index, update_uuid_index, PartialWorld, WorldContainer, }; use azalea_core::ChunkPos; -use bevy_app::{App, Plugin}; -use bevy_ecs::{ - prelude::Component, +use azalea_ecs::{ + app::{App, Plugin}, + component::Component, + ecs::Ecs, + ecs::EntityMut, + entity::Entity, query::{Added, Changed, With, Without}, schedule::{IntoSystemDescriptor, SystemSet}, system::{Command, Commands, Query, Res, ResMut, Resource}, - world::EntityMut, }; use derive_more::{Deref, DerefMut}; use log::{debug, warn}; @@ -121,7 +122,7 @@ pub struct RelativeEntityUpdate { pub update: Box, } impl Command for RelativeEntityUpdate { - fn write(self, world: &mut bevy_ecs::world::World) { + fn write(self, world: &mut Ecs) { let partial_entity_infos = &mut self.partial_world.write().entity_infos; let mut entity = world.entity_mut(self.entity); diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs index c11a4bca..77e95139 100644 --- a/azalea-world/src/world.rs +++ b/azalea-world/src/world.rs @@ -1,10 +1,11 @@ use crate::{ - entity::{Entity, EntityUuid, MinecraftEntityId, Position, WorldName}, + entity::{EntityUuid, MinecraftEntityId, Position, WorldName}, entity_info::LoadedBy, ChunkStorage, EntityInfos, PartialChunkStorage, PartialEntityInfos, WorldContainer, }; use azalea_core::ChunkPos; -use bevy_ecs::{ +use azalea_ecs::{ + entity::Entity, query::Changed, system::{Commands, Query, Res, ResMut}, }; diff --git a/azalea/Cargo.toml b/azalea/Cargo.toml index 33970558..c6527aaa 100644 --- a/azalea/Cargo.toml +++ b/azalea/Cargo.toml @@ -18,12 +18,11 @@ azalea-block = {version = "0.5.0", path = "../azalea-block"} azalea-chat = {version = "0.5.0", path = "../azalea-chat"} azalea-client = {version = "0.5.0", path = "../azalea-client"} azalea-core = {version = "0.5.0", path = "../azalea-core"} +azalea-ecs = { version = "0.5.0", path = "../azalea-ecs" } azalea-physics = {version = "0.5.0", path = "../azalea-physics"} azalea-protocol = {version = "0.5.0", path = "../azalea-protocol"} azalea-registry = {version = "0.5.0", path = "../azalea-registry"} azalea-world = {version = "0.5.0", path = "../azalea-world"} -bevy_app = {version = "0.9.1", default-features = false} -bevy_ecs = {version = "0.9.1", default-features = false} derive_more = {version = "0.99.17", features = ["deref", "deref_mut"]} futures = "0.3.25" iyes_loopless = "0.9.1" diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs index 27622b0e..b9e59244 100644 --- a/azalea/src/bot.rs +++ b/azalea/src/bot.rs @@ -1,14 +1,19 @@ use azalea_core::Vec3; -use azalea_world::entity::{set_rotation, Entity, Jumping, Physics, Position}; -use bevy_app::App; -use bevy_ecs::schedule::IntoSystemDescriptor; -use bevy_ecs::{event::EventReader, prelude::Component, schedule::SystemSet, system::Query}; +use azalea_ecs::{ + app::{App, Plugin}, + component::Component, + event::EventReader, + schedule::IntoSystemDescriptor, + schedule::SystemSet, + system::Query, entity::Entity, +}; +use azalea_world::entity::{set_rotation, Jumping, Physics, Position}; use iyes_loopless::prelude::*; use std::f64::consts::PI; #[derive(Clone, Default)] -pub struct Plugin; -impl bevy_app::Plugin for Plugin { +pub struct BotPlugin; +impl Plugin for BotPlugin { fn build(&self, app: &mut App) { app.add_event::() .add_event::() diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs index 98b85d0a..f48edf07 100644 --- a/azalea/src/lib.rs +++ b/azalea/src/lib.rs @@ -11,11 +11,13 @@ mod swarm; pub use azalea_block as blocks; pub use azalea_client::*; pub use azalea_core::{BlockPos, Vec3}; +use azalea_ecs::{ + app::{App, Plugin}, + component::Component, +}; pub use azalea_protocol as protocol; pub use azalea_registry::EntityKind; pub use azalea_world::{entity, World}; -use bevy_app::Plugin; -use bevy_ecs::prelude::Component; use futures::Future; use protocol::ServerAddress; pub use swarm::*; @@ -36,7 +38,7 @@ where S: Default + Send + Sync + Clone + 'static, Fut: Future>, { - app: bevy_app::App, + app: App, /// The function that's called every time a bot receives an [`Event`]. handler: Option>, state: S, diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index 54e8ac3b..c50683ed 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -6,28 +6,31 @@ use crate::{SprintDirection, WalkDirection}; use azalea_client::{StartSprintEvent, StartWalkEvent}; use azalea_core::{BlockPos, CardinalDirection}; -use azalea_world::entity::{Entity, Physics, Position, WorldName}; -use azalea_world::WorldContainer; -use bevy_ecs::event::EventReader; -use bevy_ecs::schedule::SystemSet; -use bevy_ecs::system::{Query, Res}; -use bevy_ecs::{component::Component, event::EventWriter}; -use iyes_loopless::prelude::*; +use azalea_ecs::app::{App, Plugin}; +use azalea_ecs::AppTickExt; +use azalea_ecs::{ + component::Component, + entity::Entity, + event::EventReader, + event::EventWriter, + schedule::SystemSet, + system::{Query, Res}, +}; +use azalea_world::{ + entity::{Physics, Position, WorldName}, + WorldContainer, +}; use log::{debug, error}; use mtdstarlite::Edge; pub use mtdstarlite::MTDStarLite; use std::collections::VecDeque; #[derive(Clone, Default)] -pub struct Plugin; -impl bevy_app::Plugin for Plugin { - fn build(&self, app: &mut bevy_app::App) { - app.add_fixed_timestep_system_set( - "tick", - 0, - SystemSet::new().with_system(tick_execute_path), - ) - .add_system(goto_listener); +pub struct PathfinderPlugin; +impl Plugin for PathfinderPlugin { + fn build(&self, app: &mut App) { + app.add_tick_system_set(SystemSet::new().with_system(tick_execute_path)) + .add_system(goto_listener); } } diff --git a/azalea/src/prelude.rs b/azalea/src/prelude.rs index ac9d87b9..3d8cc13e 100644 --- a/azalea/src/prelude.rs +++ b/azalea/src/prelude.rs @@ -4,5 +4,4 @@ pub use crate::bot::BotClientExt; pub use crate::pathfinder::PathfinderClientExt; pub use azalea_client::{Account, Client, Event}; -pub use bevy_ecs; -pub use bevy_ecs::component::Component; +pub use azalea_ecs::component::Component; diff --git a/azalea/src/swarm/chat.rs b/azalea/src/swarm/chat.rs index ff2372d6..9131de82 100644 --- a/azalea/src/swarm/chat.rs +++ b/azalea/src/swarm/chat.rs @@ -14,8 +14,11 @@ // messages from the queue that are before that index. use azalea_client::{packet_handling::ChatReceivedEvent, ChatPacket, LocalPlayer}; -use bevy_ecs::{ - prelude::{Component, Entity, EventReader, EventWriter}, +use azalea_ecs::app::{Plugin, App}; +use azalea_ecs::{ + component::Component, + entity::Entity, + event::{EventReader, EventWriter}, query::{Added, Without}, system::{Commands, Query, Res, ResMut, Resource}, }; @@ -24,9 +27,9 @@ use std::collections::VecDeque; use crate::{Swarm, SwarmEvent}; #[derive(Clone)] -pub struct Plugin; -impl bevy_app::Plugin for Plugin { - fn build(&self, app: &mut bevy_app::App) { +pub struct SwarmChatPlugin; +impl Plugin for SwarmChatPlugin { + fn build(&self, app: &mut App) { app.add_event::() .add_system(chat_listener) .add_system(add_default_client_state) diff --git a/azalea/src/swarm/events.rs b/azalea/src/swarm/events.rs index 26615512..81d8c731 100644 --- a/azalea/src/swarm/events.rs +++ b/azalea/src/swarm/events.rs @@ -1,14 +1,16 @@ use azalea_client::LocalPlayer; -use azalea_world::entity::MinecraftEntityId; -use bevy_ecs::{ - prelude::{EventWriter, With}, +use azalea_ecs::{ + app::{App, Plugin}, + event::EventWriter, + query::With, system::{Query, ResMut, Resource}, }; +use azalea_world::entity::MinecraftEntityId; use derive_more::{Deref, DerefMut}; -pub struct Plugin; -impl bevy_app::Plugin for Plugin { - fn build(&self, app: &mut bevy_app::App) { +pub struct SwarmPlugin; +impl Plugin for SwarmPlugin { + fn build(&self, app: &mut App) { app.add_event::() .add_system(check_ready) .init_resource::(); diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index bc5ec1b7..6cd0f8df 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -5,14 +5,19 @@ mod events; use crate::{bot, HandleFn}; use azalea_client::{init_ecs_app, start_ecs, Account, ChatPacket, Client, Event, JoinError}; +use azalea_ecs::{ + app::{App, Plugin}, + component::Component, + ecs::Ecs, + entity::Entity, + system::Resource, +}; use azalea_protocol::{ connect::ConnectionError, resolver::{self, ResolverError}, ServerAddress, }; -use azalea_world::{entity::Entity, WorldContainer}; -use bevy_app::Plugin; -use bevy_ecs::{prelude::Component, system::Resource}; +use azalea_world::WorldContainer; use futures::future::join_all; use log::error; use parking_lot::{Mutex, RwLock}; @@ -31,7 +36,7 @@ use tokio::sync::mpsc; /// [`azalea::start_swarm`]: fn.start_swarm.html #[derive(Clone, Resource)] pub struct Swarm { - pub ecs_lock: Arc>, + pub ecs_lock: Arc>, bots: Arc>>, @@ -54,7 +59,7 @@ where Fut: Future>, SwarmFut: Future>, { - app: bevy_app::App, + app: App, /// The accounts that are going to join the server. accounts: Vec, /// The individual bot states. This must be the same length as `accounts`, @@ -163,9 +168,9 @@ where } fn add_default_swarm_plugins(self) -> Self { - self.add_plugin(chat::Plugin) - .add_plugin(events::Plugin) - .add_plugin(bot::Plugin) + self.add_plugin(chat::SwarmChatPlugin) + .add_plugin(events::SwarmPlugin) + .add_plugin(bot::BotPlugin) } /// Build this `SwarmBuilder` into an actual [`Swarm`] and join the given diff --git a/bot/src/main.rs b/bot/src/main.rs index a1952794..727c8ec2 100644 --- a/bot/src/main.rs +++ b/bot/src/main.rs @@ -1,6 +1,6 @@ #![feature(type_alias_impl_trait)] -use azalea::bevy_ecs::query::With; +use azalea::ecs::query::With; use azalea::entity::metadata::Player; use azalea::entity::Position; use azalea::pathfinder::BlockPosGoal; diff --git a/codegen/lib/code/entity.py b/codegen/lib/code/entity.py index 4962400d..844793f6 100644 --- a/codegen/lib/code/entity.py +++ b/codegen/lib/code/entity.py @@ -46,7 +46,7 @@ use super::{EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Rotation use azalea_block::BlockState; use azalea_chat::FormattedText; use azalea_core::{BlockPos, Direction, Particle, Slot}; -use bevy_ecs::{bundle::Bundle, component::Component}; +use azalea_ecs::{bundle::Bundle, component::Component}; use derive_more::{Deref, DerefMut}; use thiserror::Error; use uuid::Uuid; @@ -183,7 +183,7 @@ impl From for UpdateMetadataError { # impl Allay { # pub fn apply_metadata( - # entity: &mut bevy_ecs::system::EntityCommands, + # entity: &mut azalea_ecs::system::EntityCommands, # d: EntityDataItem, # ) -> Result<(), UpdateMetadataError> { # match d.index { @@ -196,7 +196,7 @@ impl From for UpdateMetadataError { # } code.append(f'impl {struct_name} {{') code.append( - f' pub fn apply_metadata(entity: &mut bevy_ecs::system::EntityCommands, d: EntityDataItem) -> Result<(), UpdateMetadataError> {{') + f' pub fn apply_metadata(entity: &mut azalea_ecs::system::EntityCommands, d: EntityDataItem) -> Result<(), UpdateMetadataError> {{') code.append(f' match d.index {{') parent_last_index = -1 @@ -400,7 +400,7 @@ impl From for UpdateMetadataError { # and now make the main apply_metadata # pub fn apply_metadata( - # entity: &mut bevy_ecs::system::EntityCommands, + # entity: &mut azalea_ecs::system::EntityCommands, # items: Vec, # ) -> Result<(), UpdateMetadataError> { # if entity.contains::() { @@ -414,7 +414,7 @@ impl From for UpdateMetadataError { # } code.append( f'''pub fn apply_metadata( - entity: &mut bevy_ecs::system::EntityCommands, + entity: &mut azalea_ecs::system::EntityCommands, entity_kind: azalea_registry::EntityKind, items: Vec, ) -> Result<(), UpdateMetadataError> {{ @@ -436,7 +436,7 @@ impl From for UpdateMetadataError { code.append('}') code.append('') - # pub fn apply_default_metadata(entity: &mut bevy_ecs::system::EntityCommands, kind: azalea_registry::EntityKind) { + # pub fn apply_default_metadata(entity: &mut azalea_ecs::system::EntityCommands, kind: azalea_registry::EntityKind) { # match kind { # azalea_registry::EntityKind::AreaEffectCloud => { # entity.insert(AreaEffectCloudMetadataBundle::default()); @@ -444,7 +444,7 @@ impl From for UpdateMetadataError { # } # } code.append( - 'pub fn apply_default_metadata(entity: &mut bevy_ecs::system::EntityCommands, kind: azalea_registry::EntityKind) {') + 'pub fn apply_default_metadata(entity: &mut azalea_ecs::system::EntityCommands, kind: azalea_registry::EntityKind) {') code.append(' match kind {') for entity_id in burger_entity_data: if entity_id.startswith('~'):