diff options
| author | mat <git@matdoes.dev> | 2025-06-02 21:51:08 -0930 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-06-02 21:51:08 -0930 |
| commit | 61443fa481aeb6f9b488bf9475c512554a58473d (patch) | |
| tree | b806be1ca36e5c95ab76078fa1555851cea00de5 /azalea-client/src/plugins/interact.rs | |
| parent | 1edb9d34486b432c84351692aa82a3c0328a7d69 (diff) | |
| download | azalea-drasl-61443fa481aeb6f9b488bf9475c512554a58473d.tar.xz | |
fix wrong sequence number being sent
Diffstat (limited to 'azalea-client/src/plugins/interact.rs')
| -rw-r--r-- | azalea-client/src/plugins/interact.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/azalea-client/src/plugins/interact.rs b/azalea-client/src/plugins/interact.rs index 712e3242..95f7c17c 100644 --- a/azalea-client/src/plugins/interact.rs +++ b/azalea-client/src/plugins/interact.rs @@ -104,10 +104,9 @@ pub struct CurrentSequenceNumber(u32); impl CurrentSequenceNumber { /// Get the next sequence number that we're going to use and increment the /// value. - pub fn get_and_increment(&mut self) -> u32 { - let cur = self.0; + pub fn get_next(&mut self) -> u32 { self.0 += 1; - cur + self.0 } } @@ -148,7 +147,7 @@ pub fn handle_start_use_item_event( /// just inserts this component for you. /// /// [`GameTick`]: azalea_core::tick::GameTick -#[derive(Component)] +#[derive(Component, Debug)] pub struct StartUseItemQueued { pub hand: InteractionHand, /// Optionally force us to send a [`ServerboundUseItemOn`] on the given @@ -209,7 +208,7 @@ pub fn handle_start_use_item_queued( entity, ServerboundUseItem { hand: start_use_item.hand, - sequence: sequence_number.get_and_increment(), + sequence: sequence_number.get_next(), x_rot: look_direction.x_rot, y_rot: look_direction.y_rot, }, @@ -220,7 +219,7 @@ pub fn handle_start_use_item_queued( ServerboundUseItemOn { hand: start_use_item.hand, block_hit: block_hit_result.into(), - sequence: sequence_number.get_and_increment(), + sequence: sequence_number.get_next(), }, )); // TODO: depending on the result of useItemOn, this might |
