blob: ab141661baf39a738d1d2d44c0fb47688fa3c85d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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() {
// //
// }
}
|