1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00
This commit is contained in:
mat 2024-08-11 09:03:57 +00:00
parent b445b7c032
commit 5ab9c501e9
4 changed files with 15 additions and 16 deletions

View file

@ -36,7 +36,7 @@ pub use client::{
TickBroadcast,
};
pub use events::Event;
pub use local_player::{GameProfileComponent, InstanceHolder, TabList, Hunger};
pub use local_player::{GameProfileComponent, Hunger, InstanceHolder, TabList};
pub use movement::{
PhysicsState, SprintDirection, StartSprintEvent, StartWalkEvent, WalkDirection,
};

View file

@ -35,12 +35,9 @@ impl Plugin for MinePlugin {
.add_event::<AttackBlockEvent>()
.add_systems(
GameTick,
(
continue_mining_block,
handle_auto_mine
)
(continue_mining_block, handle_auto_mine)
.chain()
.before(PhysicsSet)
.before(PhysicsSet),
)
.add_systems(
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) {
let mut ecs = self.ecs.lock();
let mut entity_mut = ecs.entity_mut(self.entity);
@ -105,7 +103,7 @@ fn handle_auto_mine(
With<LeftClickMine>,
>,
mut start_mining_block_event: EventWriter<StartMiningBlockEvent>,
mut stop_mining_block_event: EventWriter<StopMiningBlockEvent>
mut stop_mining_block_event: EventWriter<StopMiningBlockEvent>,
) {
for (
hit_result_component,
@ -124,16 +122,15 @@ fn handle_auto_mine(
inventory,
current_mining_pos,
current_mining_item,
)) && !hit_result_component.miss
))
&& !hit_result_component.miss
{
start_mining_block_event.send(StartMiningBlockEvent {
entity,
position: block_pos,
});
} else if mining.is_some() && hit_result_component.miss {
stop_mining_block_event.send(StopMiningBlockEvent {
entity
});
stop_mining_block_event.send(StopMiningBlockEvent { entity });
}
}
}

View file

@ -9,7 +9,7 @@ mod slot;
use std::ops::{Deref, DerefMut, RangeInclusive};
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
// Default be implemented for all array sizes

View file

@ -3,11 +3,13 @@ use std::process::Command;
fn main() {
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.");
}
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")
.or_else(|_| env::var("CARGO_BUILD_RUSTC"))
.unwrap_or(String::from("rustc"));