aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-08-25 02:34:31 -0500
committermat <git@matdoes.dev>2023-08-25 02:34:31 -0500
commitd5465cd28e43d48b3e913fdb1161eb907e4d80d0 (patch)
treeb0962ac1bd09b434c67296c038ef3b26245ce6d7 /azalea-client/src
parent9c31f8033f006d5f505ce97e359638d6c1136859 (diff)
downloadazalea-drasl-d5465cd28e43d48b3e913fdb1161eb907e4d80d0.tar.xz
add basic pathfinding test
Diffstat (limited to 'azalea-client/src')
-rw-r--r--azalea-client/src/client.rs4
-rw-r--r--azalea-client/src/lib.rs8
-rw-r--r--azalea-client/src/local_player.rs19
-rw-r--r--azalea-client/src/movement.rs21
4 files changed, 26 insertions, 26 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index 39b86b98..b44e8b4e 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -7,10 +7,10 @@ use crate::{
inventory::{InventoryComponent, InventoryPlugin},
local_player::{
death_event, handle_send_packet_event, update_in_loaded_chunk, GameProfileComponent,
- Hunger, LocalPlayer, PhysicsState, SendPacketEvent,
+ Hunger, LocalPlayer, SendPacketEvent,
},
mining::{self, MinePlugin},
- movement::{LastSentLookDirection, PlayerMovePlugin},
+ movement::{LastSentLookDirection, PhysicsState, PlayerMovePlugin},
packet_handling::{self, PacketHandlerPlugin, PacketReceiver},
player::retroactively_add_game_profile_component,
respawn::RespawnPlugin,
diff --git a/azalea-client/src/lib.rs b/azalea-client/src/lib.rs
index 0321a396..4cb1eebf 100644
--- a/azalea-client/src/lib.rs
+++ b/azalea-client/src/lib.rs
@@ -22,7 +22,7 @@ pub mod interact;
pub mod inventory;
mod local_player;
pub mod mining;
-mod movement;
+pub mod movement;
pub mod packet_handling;
pub mod ping;
mod player;
@@ -36,6 +36,8 @@ pub use client::{
TickBroadcast,
};
pub use events::Event;
-pub use local_player::{GameProfileComponent, LocalPlayer};
-pub use movement::{SprintDirection, StartSprintEvent, StartWalkEvent, WalkDirection};
+pub use local_player::{GameProfileComponent, LocalPlayer, LocalPlayerInLoadedChunk};
+pub use movement::{
+ PhysicsState, SprintDirection, StartSprintEvent, StartWalkEvent, WalkDirection,
+};
pub use player::PlayerInfo;
diff --git a/azalea-client/src/local_player.rs b/azalea-client/src/local_player.rs
index a66b7ad5..2e0ccc75 100644
--- a/azalea-client/src/local_player.rs
+++ b/azalea-client/src/local_player.rs
@@ -20,7 +20,7 @@ use tokio::{sync::mpsc, task::JoinHandle};
use crate::{
events::{Event as AzaleaEvent, LocalPlayerEvents},
- ClientInformation, WalkDirection,
+ ClientInformation,
};
/// This is a component for our local player entities that are probably in a
@@ -51,23 +51,6 @@ pub struct LocalPlayer {
pub(crate) write_packets_task: JoinHandle<()>,
}
-/// Component for entities that can move and sprint. Usually only in
-/// [`LocalPlayer`] entities.
-#[derive(Default, Component)]
-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 was_sprinting: bool,
- // Whether we're going to try to start sprinting this tick. Equivalent to
- // holding down ctrl for a tick.
- pub trying_to_sprint: bool,
-
- pub move_direction: WalkDirection,
- pub forward_impulse: f32,
- pub left_impulse: f32,
-}
-
/// A component only present in players that contains the [`GameProfile`] (which
/// you can use to get a player's name).
///
diff --git a/azalea-client/src/movement.rs b/azalea-client/src/movement.rs
index 0bda9b15..ad26f49c 100644
--- a/azalea-client/src/movement.rs
+++ b/azalea-client/src/movement.rs
@@ -1,7 +1,5 @@
use crate::client::Client;
-use crate::local_player::{
- update_in_loaded_chunk, LocalPlayer, LocalPlayerInLoadedChunk, PhysicsState,
-};
+use crate::local_player::{update_in_loaded_chunk, LocalPlayer, LocalPlayerInLoadedChunk};
use azalea_entity::{metadata::Sprinting, Attributes, Jumping};
use azalea_entity::{LastSentPosition, LookDirection, Physics, Position};
use azalea_physics::{force_jump_listener, PhysicsSet};
@@ -102,6 +100,23 @@ pub struct LastSentLookDirection {
pub y_rot: f32,
}
+/// Component for entities that can move and sprint. Usually only in
+/// [`LocalPlayer`] entities.
+#[derive(Default, Component, Clone)]
+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 was_sprinting: bool,
+ // Whether we're going to try to start sprinting this tick. Equivalent to
+ // holding down ctrl for a tick.
+ pub trying_to_sprint: bool,
+
+ pub move_direction: WalkDirection,
+ pub forward_impulse: f32,
+ pub left_impulse: f32,
+}
+
#[allow(clippy::type_complexity)]
pub(crate) fn send_position(
mut query: Query<