Added sequence where it was missing (#127)

This commit is contained in:
EmperialDev 2022-10-20 21:21:05 +02:00 committed by GitHub
parent 101aa3721b
commit 4a3ee77858
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,8 +2,8 @@
use std::collections::{HashSet, VecDeque};
use std::iter::FusedIterator;
use std::mem;
use std::time::Duration;
use std::{cmp, mem};
pub use bitfield_struct::bitfield;
pub use event::*;
@ -1034,7 +1034,7 @@ impl<C: Config> Client<C> {
C2sPlayPacket::PlayerAbilitiesC2s(_) => {}
C2sPlayPacket::PlayerAction(p) => {
if p.sequence.0 != 0 {
self.block_change_sequence = p.sequence.0;
self.block_change_sequence = cmp::max(p.sequence.0, self.block_change_sequence);
}
self.events.push_back(match p.status {
@ -1112,15 +1112,25 @@ impl<C: Config> Client<C> {
C2sPlayPacket::UpdateSign(_) => {}
C2sPlayPacket::SwingArm(p) => self.events.push_back(ClientEvent::ArmSwing(p.hand)),
C2sPlayPacket::TeleportToEntity(_) => {}
C2sPlayPacket::UseItemOn(p) => self.events.push_back(ClientEvent::InteractWithBlock {
hand: p.hand,
location: p.location,
face: p.face,
cursor_pos: p.cursor_pos,
head_inside_block: p.head_inside_block,
sequence: p.sequence,
}),
C2sPlayPacket::UseItem(_) => {}
C2sPlayPacket::UseItemOn(p) => {
if p.sequence.0 != 0 {
self.block_change_sequence = cmp::max(p.sequence.0, self.block_change_sequence);
}
self.events.push_back(ClientEvent::InteractWithBlock {
hand: p.hand,
location: p.location,
face: p.face,
cursor_pos: p.cursor_pos,
head_inside_block: p.head_inside_block,
sequence: p.sequence,
})
}
C2sPlayPacket::UseItem(p) => {
if p.sequence.0 != 0 {
self.block_change_sequence = cmp::max(p.sequence.0, self.block_change_sequence);
}
}
}
}