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/src/auto_tool.rs | 2 ++ azalea/src/pathfinder/simulation.rs | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 18 deletions(-) (limited to 'azalea/src') diff --git a/azalea/src/auto_tool.rs b/azalea/src/auto_tool.rs index 55ec6924..2cf53085 100644 --- a/azalea/src/auto_tool.rs +++ b/azalea/src/auto_tool.rs @@ -43,6 +43,8 @@ pub fn best_tool_in_hotbar_for_block(block: BlockState, menu: &Menu) -> BestTool dimensions: Default::default(), bounding_box: Default::default(), has_impulse: Default::default(), + horizontal_collision: Default::default(), + vertical_collision: Default::default(), }, &FluidOnEyes::new(Fluid::Empty), ) diff --git a/azalea/src/pathfinder/simulation.rs b/azalea/src/pathfinder/simulation.rs index 88261b7f..b41d895a 100644 --- a/azalea/src/pathfinder/simulation.rs +++ b/azalea/src/pathfinder/simulation.rs @@ -7,13 +7,13 @@ use azalea_client::{ }; use azalea_core::{position::Vec3, resource_location::ResourceLocation, tick::GameTick}; use azalea_entity::{ - attributes::AttributeInstance, metadata::Sprinting, Attributes, EntityDimensions, Physics, - Position, + attributes::AttributeInstance, Attributes, EntityDimensions, Physics, Position, }; -use azalea_world::{ChunkStorage, Instance, InstanceContainer, InstanceName, MinecraftEntityId}; +use azalea_world::{ChunkStorage, Instance, InstanceContainer, MinecraftEntityId}; use bevy_app::App; use bevy_ecs::prelude::*; use parking_lot::RwLock; +use uuid::Uuid; #[derive(Bundle, Clone)] pub struct SimulatedPlayerBundle { @@ -82,24 +82,24 @@ impl Simulation { schedule.set_executor_kind(bevy_ecs::schedule::ExecutorKind::SingleThreaded); }); - let entity = app - .world - .spawn(( - MinecraftEntityId(0), - InstanceName(instance_name), - azalea_entity::LocalEntity, - azalea_entity::Jumping::default(), - azalea_entity::LookDirection::default(), - Sprinting(true), - azalea_entity::metadata::Player, - azalea_entity::EyeHeight::new(player.physics.dimensions.height * 0.85), - player, - )) - .id(); + let mut entity = app.world.spawn(( + MinecraftEntityId(0), + azalea_entity::LocalEntity, + azalea_entity::metadata::PlayerMetadataBundle::default(), + azalea_entity::EntityBundle::new( + Uuid::nil(), + *player.position, + azalea_registry::EntityKind::Player, + instance_name, + ), + )); + entity.insert(player); + + let entity_id = entity.id(); Self { app, - entity, + entity: entity_id, _instance: instance, } } -- cgit v1.2.3