mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
rename movedirection to walkdirection
This commit is contained in:
parent
606e3e19a1
commit
ecd5964d13
4 changed files with 15 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::{movement::MoveDirection, Account, Player};
|
||||
use crate::{movement::WalkDirection, Account, Player};
|
||||
use azalea_auth::game_profile::GameProfile;
|
||||
use azalea_chat::component::Component;
|
||||
use azalea_core::{ChunkPos, ResourceLocation, Vec3};
|
||||
|
@ -95,7 +95,7 @@ pub struct PhysicsState {
|
|||
/// Minecraft only sends a movement packet either after 20 ticks or if the player moved enough. This is that tick counter.
|
||||
pub position_remainder: u32,
|
||||
|
||||
pub move_direction: MoveDirection,
|
||||
pub move_direction: WalkDirection,
|
||||
pub forward_impulse: f32,
|
||||
pub left_impulse: f32,
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ mod player;
|
|||
|
||||
pub use account::Account;
|
||||
pub use client::{Client, ClientInformation, Event};
|
||||
pub use movement::MoveDirection;
|
||||
pub use movement::WalkDirection;
|
||||
pub use player::Player;
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -184,21 +184,21 @@ impl Client {
|
|||
let mut left_impulse: f32 = 0.;
|
||||
let move_direction = physics_state.move_direction;
|
||||
match move_direction {
|
||||
MoveDirection::Forward | MoveDirection::ForwardRight | MoveDirection::ForwardLeft => {
|
||||
WalkDirection::Forward | WalkDirection::ForwardRight | WalkDirection::ForwardLeft => {
|
||||
forward_impulse += 1.;
|
||||
}
|
||||
MoveDirection::Backward
|
||||
| MoveDirection::BackwardRight
|
||||
| MoveDirection::BackwardLeft => {
|
||||
WalkDirection::Backward
|
||||
| WalkDirection::BackwardRight
|
||||
| WalkDirection::BackwardLeft => {
|
||||
forward_impulse -= 1.;
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
match move_direction {
|
||||
MoveDirection::Right | MoveDirection::ForwardRight | MoveDirection::BackwardRight => {
|
||||
WalkDirection::Right | WalkDirection::ForwardRight | WalkDirection::BackwardRight => {
|
||||
left_impulse += 1.;
|
||||
}
|
||||
MoveDirection::Left | MoveDirection::ForwardLeft | MoveDirection::BackwardLeft => {
|
||||
WalkDirection::Left | WalkDirection::ForwardLeft | WalkDirection::BackwardLeft => {
|
||||
left_impulse -= 1.;
|
||||
}
|
||||
_ => {}
|
||||
|
@ -213,7 +213,7 @@ impl Client {
|
|||
}
|
||||
|
||||
/// Start walking in the given direction.
|
||||
pub fn walk(&mut self, direction: MoveDirection) {
|
||||
pub fn walk(&mut self, direction: WalkDirection) {
|
||||
let mut physics_state = self.physics_state.lock();
|
||||
physics_state.move_direction = direction;
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ impl Client {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub enum MoveDirection {
|
||||
pub enum WalkDirection {
|
||||
#[default]
|
||||
None,
|
||||
Forward,
|
||||
|
|
|
@ -4,7 +4,7 @@ mod moves;
|
|||
mod mtdstarlite;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use azalea::prelude::*;
|
||||
use azalea::{prelude::*, WalkDirection};
|
||||
use azalea::{Client, Event};
|
||||
use azalea_core::BlockPos;
|
||||
use azalea_world::entity::EntityData;
|
||||
|
@ -31,7 +31,7 @@ impl azalea::Plugin for Plugin {
|
|||
|
||||
pub trait Trait {
|
||||
fn goto(&self, goal: impl Goal);
|
||||
fn execute_path(&mut self, path: &Vec<Node>);
|
||||
fn tick_execute_path(&mut self, path: &Vec<Node>);
|
||||
}
|
||||
|
||||
impl Trait for azalea_client::Client {
|
||||
|
@ -74,10 +74,11 @@ impl Trait for azalea_client::Client {
|
|||
let p = pf.find_path();
|
||||
}
|
||||
|
||||
fn execute_path(&mut self, path: &Vec<Node>) {
|
||||
fn tick_execute_path(&mut self, path: &Vec<Node>) {
|
||||
let start = path[0];
|
||||
let center = start.pos.center();
|
||||
self.look_at(¢er);
|
||||
self.walk(WalkDirection::Forward);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue