diff options
| -rw-r--r-- | Cargo.lock | 1 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | azalea-client/Cargo.toml | 3 | ||||
| -rw-r--r-- | azalea-client/src/plugins/mining.rs | 2 | ||||
| -rw-r--r-- | azalea-entity/src/plugin/mod.rs | 8 | ||||
| -rw-r--r-- | azalea-world/src/container.rs | 7 |
6 files changed, 14 insertions, 8 deletions
@@ -347,6 +347,7 @@ dependencies = [ "bevy_log", "bevy_tasks", "bevy_time", + "bevy_utils", "chrono", "derive_more", "indexmap", @@ -35,6 +35,7 @@ async-compat = "0.2.5" base64 = "0.22.1" bevy_app = "0.17.2" bevy_ecs = { version = "0.17.2", default-features = false } +bevy_utils = { version = "0.17.2", default-features = false } bevy_log = "0.17.2" bevy_tasks = "0.17.2" bevy_time = "0.17.2" diff --git a/azalea-client/Cargo.toml b/azalea-client/Cargo.toml index 74052e53..5dc05151 100644 --- a/azalea-client/Cargo.toml +++ b/azalea-client/Cargo.toml @@ -38,6 +38,9 @@ thiserror.workspace = true tokio = { workspace = true, features = ["sync"] } tracing.workspace = true uuid.workspace = true +# TODO: this is here to make bevy show system names in conflict warnings. +# in bevy 0.18, we should be able to just enable the debug feature on bevy_ecs instead. +bevy_utils = { workspace = true, features = ["debug"] } [dev-dependencies] anyhow.workspace = true diff --git a/azalea-client/src/plugins/mining.rs b/azalea-client/src/plugins/mining.rs index 4ed14482..869e7ac9 100644 --- a/azalea-client/src/plugins/mining.rs +++ b/azalea-client/src/plugins/mining.rs @@ -46,6 +46,7 @@ impl Plugin for MiningPlugin { .before(PhysicsSystems) .before(super::movement::send_position) .before(super::interact::handle_start_use_item_queued) + .after(azalea_entity::update_fluid_on_eyes) .in_set(MiningSystems), ) .add_systems( @@ -58,7 +59,6 @@ impl Plugin for MiningPlugin { .in_set(MiningSystems) .after(InventorySystems) .after(MoveEventsSystems) - .after(azalea_entity::update_fluid_on_eyes) .after(crate::interact::pick::update_hit_result_component) .after(crate::attack::handle_attack_event), ) diff --git a/azalea-entity/src/plugin/mod.rs b/azalea-entity/src/plugin/mod.rs index 4ff6f4cd..7296f2ff 100644 --- a/azalea-entity/src/plugin/mod.rs +++ b/azalea-entity/src/plugin/mod.rs @@ -5,7 +5,7 @@ use std::collections::HashSet; use azalea_block::{BlockState, BlockTrait, fluid_state::FluidKind, properties}; use azalea_core::{ - position::{BlockPos, ChunkPos, Vec3}, + position::{BlockPos, ChunkPos}, tick::GameTick, }; use azalea_registry::{builtin::BlockKind, tags}; @@ -60,12 +60,12 @@ impl Plugin for EntityPlugin { add_dead, clamp_look_direction, update_on_climbable, - (update_dimensions, update_bounding_box, update_fluid_on_eyes).chain(), + (update_dimensions, update_bounding_box).chain(), update_crouching, ), ), ) - .add_systems(GameTick, update_in_loaded_chunk) + .add_systems(GameTick, (update_in_loaded_chunk, update_fluid_on_eyes)) .init_resource::<EntityUuidIndex>(); } } @@ -109,7 +109,7 @@ pub fn update_fluid_on_eyes( }; let adjusted_eye_y = position.y + (dimensions.eye_height as f64) - 0.1111111119389534; - let eye_block_pos = BlockPos::from(Vec3::new(position.x, adjusted_eye_y, position.z)); + let eye_block_pos = BlockPos::from(position.with_y(adjusted_eye_y)); let fluid_at_eye = instance .read() .get_fluid_state(eye_block_pos) diff --git a/azalea-world/src/container.rs b/azalea-world/src/container.rs index 3e167085..c2788198 100644 --- a/azalea-world/src/container.rs +++ b/azalea-world/src/container.rs @@ -40,8 +40,9 @@ impl InstanceContainer { InstanceContainer::default() } - /// Get a world from the container. Returns `None` if none of the clients - /// are in this world. + /// Get an instance (aka world) from the container. + /// + /// Returns `None` if none of the clients are in this instance. pub fn get(&self, name: &InstanceName) -> Option<Arc<RwLock<Instance>>> { self.instances.get(name).and_then(|world| world.upgrade()) } @@ -92,6 +93,6 @@ impl InstanceContainer { /// /// If two entities share the same instance name, we assume they're in the /// same instance. -#[derive(Component, Clone, Debug, PartialEq, Deref, DerefMut)] +#[derive(Component, Clone, Debug, PartialEq, Deref, DerefMut, Hash, Eq)] #[doc(alias("worldname", "world name"))] pub struct InstanceName(pub Identifier); |
