mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
fmt
This commit is contained in:
parent
b445b7c032
commit
5ab9c501e9
4 changed files with 15 additions and 16 deletions
|
@ -36,7 +36,7 @@ pub use client::{
|
||||||
TickBroadcast,
|
TickBroadcast,
|
||||||
};
|
};
|
||||||
pub use events::Event;
|
pub use events::Event;
|
||||||
pub use local_player::{GameProfileComponent, InstanceHolder, TabList, Hunger};
|
pub use local_player::{GameProfileComponent, Hunger, InstanceHolder, TabList};
|
||||||
pub use movement::{
|
pub use movement::{
|
||||||
PhysicsState, SprintDirection, StartSprintEvent, StartWalkEvent, WalkDirection,
|
PhysicsState, SprintDirection, StartSprintEvent, StartWalkEvent, WalkDirection,
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,12 +35,9 @@ impl Plugin for MinePlugin {
|
||||||
.add_event::<AttackBlockEvent>()
|
.add_event::<AttackBlockEvent>()
|
||||||
.add_systems(
|
.add_systems(
|
||||||
GameTick,
|
GameTick,
|
||||||
(
|
(continue_mining_block, handle_auto_mine)
|
||||||
continue_mining_block,
|
|
||||||
handle_auto_mine
|
|
||||||
)
|
|
||||||
.chain()
|
.chain()
|
||||||
.before(PhysicsSet)
|
.before(PhysicsSet),
|
||||||
)
|
)
|
||||||
.add_systems(
|
.add_systems(
|
||||||
Update,
|
Update,
|
||||||
|
@ -75,7 +72,8 @@ impl Client {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// When enabled, the bot will mine any block that it is looking at if it is reachable.
|
/// When enabled, the bot will mine any block that it is looking at if it is
|
||||||
|
/// reachable.
|
||||||
pub fn left_click_mine(&self, enabled: bool) {
|
pub fn left_click_mine(&self, enabled: bool) {
|
||||||
let mut ecs = self.ecs.lock();
|
let mut ecs = self.ecs.lock();
|
||||||
let mut entity_mut = ecs.entity_mut(self.entity);
|
let mut entity_mut = ecs.entity_mut(self.entity);
|
||||||
|
@ -105,7 +103,7 @@ fn handle_auto_mine(
|
||||||
With<LeftClickMine>,
|
With<LeftClickMine>,
|
||||||
>,
|
>,
|
||||||
mut start_mining_block_event: EventWriter<StartMiningBlockEvent>,
|
mut start_mining_block_event: EventWriter<StartMiningBlockEvent>,
|
||||||
mut stop_mining_block_event: EventWriter<StopMiningBlockEvent>
|
mut stop_mining_block_event: EventWriter<StopMiningBlockEvent>,
|
||||||
) {
|
) {
|
||||||
for (
|
for (
|
||||||
hit_result_component,
|
hit_result_component,
|
||||||
|
@ -124,16 +122,15 @@ fn handle_auto_mine(
|
||||||
inventory,
|
inventory,
|
||||||
current_mining_pos,
|
current_mining_pos,
|
||||||
current_mining_item,
|
current_mining_item,
|
||||||
)) && !hit_result_component.miss
|
))
|
||||||
|
&& !hit_result_component.miss
|
||||||
{
|
{
|
||||||
start_mining_block_event.send(StartMiningBlockEvent {
|
start_mining_block_event.send(StartMiningBlockEvent {
|
||||||
entity,
|
entity,
|
||||||
position: block_pos,
|
position: block_pos,
|
||||||
});
|
});
|
||||||
} else if mining.is_some() && hit_result_component.miss {
|
} else if mining.is_some() && hit_result_component.miss {
|
||||||
stop_mining_block_event.send(StopMiningBlockEvent {
|
stop_mining_block_event.send(StopMiningBlockEvent { entity });
|
||||||
entity
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ mod slot;
|
||||||
use std::ops::{Deref, DerefMut, RangeInclusive};
|
use std::ops::{Deref, DerefMut, RangeInclusive};
|
||||||
|
|
||||||
use azalea_inventory_macros::declare_menus;
|
use azalea_inventory_macros::declare_menus;
|
||||||
pub use slot::{ItemSlot, ItemSlotData, DataComponentPatch};
|
pub use slot::{DataComponentPatch, ItemSlot, ItemSlotData};
|
||||||
|
|
||||||
// TODO: remove this here and in azalea-inventory-macros when rust makes
|
// TODO: remove this here and in azalea-inventory-macros when rust makes
|
||||||
// Default be implemented for all array sizes
|
// Default be implemented for all array sizes
|
||||||
|
|
|
@ -3,11 +3,13 @@ use std::process::Command;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match env::var("RUSTUP_TOOLCHAIN") {
|
match env::var("RUSTUP_TOOLCHAIN") {
|
||||||
Ok(rust_toolchain) if !rust_toolchain.starts_with("nightly") => { // stable & beta
|
Ok(rust_toolchain) if !rust_toolchain.starts_with("nightly") => {
|
||||||
|
// stable & beta
|
||||||
panic!("Azalea currently requires nightly Rust. You can use `rustup override set nightly` to set the toolchain for this directory.");
|
panic!("Azalea currently requires nightly Rust. You can use `rustup override set nightly` to set the toolchain for this directory.");
|
||||||
}
|
}
|
||||||
Ok(_) => return, // nightly
|
Ok(_) => return, // nightly
|
||||||
Err(_) => { // probably not installed via rustup, run rustc and parse its output
|
Err(_) => {
|
||||||
|
// probably not installed via rustup, run rustc and parse its output
|
||||||
let rustc_command = env::var("RUSTC")
|
let rustc_command = env::var("RUSTC")
|
||||||
.or_else(|_| env::var("CARGO_BUILD_RUSTC"))
|
.or_else(|_| env::var("CARGO_BUILD_RUSTC"))
|
||||||
.unwrap_or(String::from("rustc"));
|
.unwrap_or(String::from("rustc"));
|
||||||
|
|
Loading…
Add table
Reference in a new issue