diff options
| author | mat <git@matdoes.dev> | 2023-05-26 15:18:04 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-05-26 15:18:04 -0500 |
| commit | 6188230009b49f96b755ade32a28b932e7810196 (patch) | |
| tree | f7b6bc8e25dfda27f3162f9e6bd53721fb3a86cc /azalea-client/src/mining.rs | |
| parent | 9bdace4aab064257dccb39fab4d47fde6dd9a062 (diff) | |
| download | azalea-drasl-6188230009b49f96b755ade32a28b932e7810196.tar.xz | |
add stuff related to chat signing
and also some stuff related to digging because i forgot to do a different branch lol
Diffstat (limited to 'azalea-client/src/mining.rs')
| -rw-r--r-- | azalea-client/src/mining.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/azalea-client/src/mining.rs b/azalea-client/src/mining.rs new file mode 100644 index 00000000..5af9a20b --- /dev/null +++ b/azalea-client/src/mining.rs @@ -0,0 +1,35 @@ +use azalea_core::BlockPos; +use bevy_app::{App, Plugin}; +use bevy_ecs::prelude::*; + +use crate::Client; + +/// A plugin that allows clients to break blocks in the world. +pub struct MinePlugin; +impl Plugin for MinePlugin { + fn build(&self, app: &mut App) { + app.add_event::<StartMiningBlockEvent>() + .add_system(handle_start_mining_block_event); + } +} + +impl Client { + /// Start mining a block. + pub fn start_mining_block(&self, position: BlockPos) { + self.ecs.lock().send_event(StartMiningBlockEvent { + entity: self.entity, + position, + }); + } +} + +pub struct StartMiningBlockEvent { + pub entity: Entity, + pub position: BlockPos, +} + +fn handle_start_mining_block_event(mut events: EventReader<StartMiningBlockEvent>) { + for event in events.iter() { + // + } +} |
