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