mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
fix wrong sequence number being sent
This commit is contained in:
parent
1edb9d3448
commit
61443fa481
2 changed files with 9 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use azalea_block::{BlockTrait, BlockState, fluid_state::FluidState};
|
||||
use azalea_block::{BlockState, BlockTrait, fluid_state::FluidState};
|
||||
use azalea_core::{direction::Direction, game_type::GameMode, position::BlockPos, tick::GameTick};
|
||||
use azalea_entity::{FluidOnEyes, Physics, mining::get_mine_progress};
|
||||
use azalea_inventory::ItemStack;
|
||||
|
@ -345,7 +345,7 @@ fn handle_mining_queued(
|
|||
action: s_player_action::Action::StartDestroyBlock,
|
||||
pos: mining_queued.position,
|
||||
direction: mining_queued.direction,
|
||||
sequence: sequence_number.get_and_increment(),
|
||||
sequence: sequence_number.get_next(),
|
||||
},
|
||||
));
|
||||
// vanilla really does send two swing arm packets
|
||||
|
@ -580,7 +580,7 @@ pub fn continue_mining_block(
|
|||
action: s_player_action::Action::StartDestroyBlock,
|
||||
pos: mining.pos,
|
||||
direction: mining.dir,
|
||||
sequence: sequence_number.get_and_increment(),
|
||||
sequence: sequence_number.get_next(),
|
||||
},
|
||||
));
|
||||
commands.trigger(SwingArmEvent { entity });
|
||||
|
@ -634,7 +634,7 @@ pub fn continue_mining_block(
|
|||
action: s_player_action::Action::StopDestroyBlock,
|
||||
pos: mining.pos,
|
||||
direction: mining.dir,
|
||||
sequence: sequence_number.get_and_increment(),
|
||||
sequence: sequence_number.get_next(),
|
||||
},
|
||||
));
|
||||
**mine_progress = 0.;
|
||||
|
|
Loading…
Add table
Reference in a new issue