From 348c71b97b2dfc45d7412ec33f6131e20592bb14 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sun, 10 Dec 2023 00:08:08 -0600 Subject: Climbing (#121) * start implementing climbing * fix tests * fix bots running at lower tick rate --- azalea-entity/src/lib.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'azalea-entity/src/lib.rs') diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs index bf3dfc82..eb5b5b25 100644 --- a/azalea-entity/src/lib.rs +++ b/azalea-entity/src/lib.rs @@ -116,8 +116,13 @@ pub fn on_pos(offset: f32, chunk_storage: &ChunkStorage, pos: &Position) -> Bloc /// The Minecraft UUID of the entity. For players, this is their actual player /// UUID, and for other entities it's just random. -#[derive(Component, Deref, DerefMut, Clone, Copy)] +#[derive(Component, Deref, DerefMut, Clone, Copy, Default)] pub struct EntityUuid(Uuid); +impl EntityUuid { + pub fn new(uuid: Uuid) -> Self { + Self(uuid) + } +} impl Debug for EntityUuid { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { (self.0).fmt(f) @@ -228,6 +233,10 @@ pub struct Physics { pub bounding_box: AABB, pub has_impulse: bool, + + pub horizontal_collision: bool, + // pub minor_horizontal_collision: bool, + pub vertical_collision: bool, } impl Physics { @@ -246,6 +255,9 @@ impl Physics { dimensions, has_impulse: false, + + horizontal_collision: false, + vertical_collision: false, } } } @@ -311,6 +323,7 @@ pub struct EntityBundle { pub attributes: Attributes, pub jumping: Jumping, pub fluid_on_eyes: FluidOnEyes, + pub on_climbable: OnClimbable, } impl EntityBundle { @@ -346,6 +359,7 @@ impl EntityBundle { jumping: Jumping(false), fluid_on_eyes: FluidOnEyes(azalea_registry::Fluid::Empty), + on_climbable: OnClimbable(false), } } } @@ -373,6 +387,9 @@ impl FluidOnEyes { } } +#[derive(Component, Clone, Debug, PartialEq, Deref, DerefMut)] +pub struct OnClimbable(bool); + // #[cfg(test)] // mod tests { // use super::*; -- cgit v1.2.3