aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/plugins/interact
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-09-28 13:10:04 -0545
committermat <git@matdoes.dev>2025-09-28 13:10:04 -0545
commit2c8b7c5c2c9297273abfba8f7743f1bc25f166b1 (patch)
tree3d3aded400100c136287fa59293ce26c61644d00 /azalea-client/src/plugins/interact
parente2ed19c1ed92f0dccc881d835d9ac6e0f7f834c0 (diff)
downloadazalea-drasl-2c8b7c5c2c9297273abfba8f7743f1bc25f166b1.tar.xz
upgrade bevy to 0.17.0-rc.2
Diffstat (limited to 'azalea-client/src/plugins/interact')
-rw-r--r--azalea-client/src/plugins/interact/mod.rs23
1 files changed, 8 insertions, 15 deletions
diff --git a/azalea-client/src/plugins/interact/mod.rs b/azalea-client/src/plugins/interact/mod.rs
index dc60ef66..b5defdf0 100644
--- a/azalea-client/src/plugins/interact/mod.rs
+++ b/azalea-client/src/plugins/interact/mod.rs
@@ -48,8 +48,7 @@ use crate::{
pub struct InteractPlugin;
impl Plugin for InteractPlugin {
fn build(&self, app: &mut App) {
- app.add_event::<StartUseItemEvent>()
- .add_event::<SwingArmEvent>()
+ app.add_message::<StartUseItemEvent>()
.add_systems(
Update,
(
@@ -63,7 +62,6 @@ impl Plugin for InteractPlugin {
update_hit_result_component
.after(clamp_look_direction)
.after(update_last_bounding_box),
- handle_swing_arm_event,
)
.after(InventorySet)
.after(MoveEventsSet)
@@ -89,7 +87,7 @@ impl Client {
/// Note that this may trigger anticheats as it doesn't take into account
/// whether you're actually looking at the block.
pub fn block_interact(&self, position: BlockPos) {
- self.ecs.lock().send_event(StartUseItemEvent {
+ self.ecs.lock().write_message(StartUseItemEvent {
entity: self.entity,
hand: InteractionHand::MainHand,
force_block: Some(position),
@@ -104,7 +102,7 @@ impl Client {
/// If we're looking at a block or entity, then it will be clicked. Also see
/// [`Client::block_interact`].
pub fn start_use_item(&self) {
- self.ecs.lock().send_event(StartUseItemEvent {
+ self.ecs.lock().write_message(StartUseItemEvent {
entity: self.entity,
hand: InteractionHand::MainHand,
force_block: None,
@@ -209,7 +207,7 @@ impl BlockStatePredictionHandler {
/// This event just inserts the [`StartUseItemQueued`] component on the given
/// entity.
#[doc(alias("right click"))]
-#[derive(Event)]
+#[derive(Message)]
pub struct StartUseItemEvent {
pub entity: Entity,
pub hand: InteractionHand,
@@ -218,7 +216,7 @@ pub struct StartUseItemEvent {
}
pub fn handle_start_use_item_event(
mut commands: Commands,
- mut events: EventReader<StartUseItemEvent>,
+ mut events: MessageReader<StartUseItemEvent>,
) {
for event in events.read() {
commands.entity(event.entity).insert(StartUseItemQueued {
@@ -427,23 +425,18 @@ pub fn can_use_game_master_blocks(
/// Swing your arm. This is purely a visual effect and won't interact with
/// anything in the world.
-#[derive(Event, Clone, Debug)]
+#[derive(EntityEvent, Clone, Debug)]
pub struct SwingArmEvent {
pub entity: Entity,
}
-pub fn handle_swing_arm_trigger(trigger: Trigger<SwingArmEvent>, mut commands: Commands) {
+pub fn handle_swing_arm_trigger(swing_arm: On<SwingArmEvent>, mut commands: Commands) {
commands.trigger(SendPacketEvent::new(
- trigger.event().entity,
+ swing_arm.entity,
ServerboundSwing {
hand: InteractionHand::MainHand,
},
));
}
-pub fn handle_swing_arm_event(mut events: EventReader<SwingArmEvent>, mut commands: Commands) {
- for event in events.read() {
- commands.trigger(event.clone());
- }
-}
#[allow(clippy::type_complexity)]
fn update_attributes_for_held_item(