From 40dd39feed4b98a4d72cfdc99ce6160148de2884 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 25 Mar 2026 12:46:44 -0700 Subject: [PATCH] refactor: move hasFullPackedGuid into Packet class, deduplicate 2 definitions Add Packet::hasFullPackedGuid() method and remove identical standalone definitions from game_handler.cpp and packet_parsers_classic.cpp. Replace 53 free-function calls with method calls. --- include/network/packet.hpp | 8 ++++ src/game/game_handler.cpp | 68 +++++++++++------------------ src/game/packet_parsers_classic.cpp | 42 ++++++------------ src/game/world_packets.cpp | 28 ++++++------ 4 files changed, 61 insertions(+), 85 deletions(-) diff --git a/include/network/packet.hpp b/include/network/packet.hpp index 7e5105cb..c53ad671 100644 --- a/include/network/packet.hpp +++ b/include/network/packet.hpp @@ -34,6 +34,14 @@ public: size_t getReadPos() const { return readPos; } size_t getSize() const { return data.size(); } size_t getRemainingSize() const { return data.size() - readPos; } + bool hasFullPackedGuid() const { + if (readPos >= data.size()) return false; + uint8_t mask = data[readPos]; + size_t guidBytes = 1; + for (int bit = 0; bit < 8; ++bit) + if (mask & (1u << bit)) ++guidBytes; + return getRemainingSize() >= guidBytes; + } void setReadPos(size_t pos) { readPos = pos; } private: diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 1d8042e7..a85f3131 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -169,22 +169,6 @@ float slowUpdateObjectBlockLogThresholdMs() { constexpr size_t kMaxQueuedInboundPackets = 4096; -bool hasFullPackedGuid(const network::Packet& packet) { - if (packet.getReadPos() >= packet.getSize()) { - return false; - } - - const auto& rawData = packet.getData(); - const uint8_t mask = rawData[packet.getReadPos()]; - size_t guidBytes = 1; - for (int bit = 0; bit < 8; ++bit) { - if ((mask & (1u << bit)) != 0) { - ++guidBytes; - } - } - return packet.getRemainingSize() >= guidBytes; -} - bool packetHasRemaining(const network::Packet& packet, size_t need) { const size_t size = packet.getSize(); const size_t pos = packet.getReadPos(); @@ -1982,10 +1966,10 @@ void GameHandler::registerOpcodeHandlers() { return UpdateObjectParser::readPackedGuid(packet); }; if (packet.getRemainingSize() < (prUsesFullGuid ? 8u : 1u) - || (!prUsesFullGuid && !hasFullPackedGuid(packet))) { packet.setReadPos(packet.getSize()); return; } + || (!prUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t caster = readPrGuid(); if (packet.getRemainingSize() < (prUsesFullGuid ? 8u : 1u) - || (!prUsesFullGuid && !hasFullPackedGuid(packet))) { packet.setReadPos(packet.getSize()); return; } + || (!prUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t victim = readPrGuid(); if (packet.getRemainingSize() < 4) return; uint32_t spellId = packet.readUInt32(); @@ -3638,7 +3622,7 @@ void GameHandler::registerOpcodeHandlers() { if (packet.getRemainingSize() < 4) return; uint32_t spellId = packet.readUInt32(); if (packet.getRemainingSize() < (spellMissUsesFullGuid ? 8u : 1u) - || (!spellMissUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!spellMissUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t casterGuid = readSpellMissGuid(); @@ -3661,7 +3645,7 @@ void GameHandler::registerOpcodeHandlers() { bool truncated = false; for (uint32_t i = 0; i < rawCount; ++i) { if (packet.getRemainingSize() < (spellMissUsesFullGuid ? 9u : 2u) - || (!spellMissUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!spellMissUsesFullGuid && !packet.hasFullPackedGuid())) { truncated = true; return; } @@ -3935,11 +3919,11 @@ void GameHandler::registerOpcodeHandlers() { } else { if (packet.getRemainingSize() < 4) return; dispelSpellId = packet.readUInt32(); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(packet.getSize()); return; } dispelCasterGuid = UpdateObjectParser::readPackedGuid(packet); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(packet.getSize()); return; } /*uint64_t victim =*/ UpdateObjectParser::readPackedGuid(packet); @@ -4863,12 +4847,12 @@ void GameHandler::registerOpcodeHandlers() { return UpdateObjectParser::readPackedGuid(packet); }; if (packet.getRemainingSize() < (energizeTbc ? 8u : 1u) - || (!energizeTbc && !hasFullPackedGuid(packet))) { + || (!energizeTbc && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t victimGuid = readEnergizeGuid(); if (packet.getRemainingSize() < (energizeTbc ? 8u : 1u) - || (!energizeTbc && !hasFullPackedGuid(packet))) { + || (!energizeTbc && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t casterGuid = readEnergizeGuid(); @@ -5994,13 +5978,13 @@ void GameHandler::registerOpcodeHandlers() { if (packet.getRemainingSize() < shieldMinSz) { packet.setReadPos(packet.getSize()); return; } - if (!shieldTbc && (!hasFullPackedGuid(packet))) { + if (!shieldTbc && (!packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t victimGuid = shieldTbc ? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet); if (packet.getRemainingSize() < (shieldTbc ? 8u : 1u) - || (!shieldTbc && !hasFullPackedGuid(packet))) { + || (!shieldTbc && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t casterGuid = shieldTbc @@ -6033,13 +6017,13 @@ void GameHandler::registerOpcodeHandlers() { if (packet.getRemainingSize() < minSz) { packet.setReadPos(packet.getSize()); return; } - if (!immuneUsesFullGuid && !hasFullPackedGuid(packet)) { + if (!immuneUsesFullGuid && !packet.hasFullPackedGuid()) { packet.setReadPos(packet.getSize()); return; } uint64_t casterGuid = immuneUsesFullGuid ? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet); if (packet.getRemainingSize() < (immuneUsesFullGuid ? 8u : 2u) - || (!immuneUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!immuneUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t victimGuid = immuneUsesFullGuid @@ -6063,13 +6047,13 @@ void GameHandler::registerOpcodeHandlers() { // + uint32 count + count × (uint32 dispelled_spellId + uint32 unk) const bool dispelUsesFullGuid = isActiveExpansion("tbc"); if (packet.getRemainingSize() < (dispelUsesFullGuid ? 8u : 1u) - || (!dispelUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!dispelUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t casterGuid = dispelUsesFullGuid ? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet); if (packet.getRemainingSize() < (dispelUsesFullGuid ? 8u : 1u) - || (!dispelUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!dispelUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t victimGuid = dispelUsesFullGuid @@ -6157,13 +6141,13 @@ void GameHandler::registerOpcodeHandlers() { // TBC: full uint64 victim + full uint64 caster + same tail const bool stealUsesFullGuid = isActiveExpansion("tbc"); if (packet.getRemainingSize() < (stealUsesFullGuid ? 8u : 1u) - || (!stealUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!stealUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t stealVictim = stealUsesFullGuid ? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet); if (packet.getRemainingSize() < (stealUsesFullGuid ? 8u : 1u) - || (!stealUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!stealUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t stealCaster = stealUsesFullGuid @@ -6231,12 +6215,12 @@ void GameHandler::registerOpcodeHandlers() { return UpdateObjectParser::readPackedGuid(packet); }; if (packet.getRemainingSize() < (procChanceUsesFullGuid ? 8u : 1u) - || (!procChanceUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!procChanceUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t procTargetGuid = readProcChanceGuid(); if (packet.getRemainingSize() < (procChanceUsesFullGuid ? 8u : 1u) - || (!procChanceUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!procChanceUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t procCasterGuid = readProcChanceGuid(); @@ -6260,13 +6244,13 @@ void GameHandler::registerOpcodeHandlers() { const bool ikUsesFullGuid = isActiveExpansion("tbc"); auto ik_rem = [&]() { return packet.getRemainingSize(); }; if (ik_rem() < (ikUsesFullGuid ? 8u : 1u) - || (!ikUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!ikUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t ikCaster = ikUsesFullGuid ? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet); if (ik_rem() < (ikUsesFullGuid ? 8u : 1u) - || (!ikUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!ikUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t ikVictim = ikUsesFullGuid @@ -6310,7 +6294,7 @@ void GameHandler::registerOpcodeHandlers() { if (packet.getRemainingSize() < (exeUsesFullGuid ? 8u : 1u)) { packet.setReadPos(packet.getSize()); return; } - if (!exeUsesFullGuid && !hasFullPackedGuid(packet)) { + if (!exeUsesFullGuid && !packet.hasFullPackedGuid()) { packet.setReadPos(packet.getSize()); return; } uint64_t exeCaster = exeUsesFullGuid @@ -6332,7 +6316,7 @@ void GameHandler::registerOpcodeHandlers() { // SPELL_EFFECT_POWER_DRAIN: packed_guid target + uint32 amount + uint32 powerType + float multiplier for (uint32_t li = 0; li < effectLogCount; ++li) { if (packet.getRemainingSize() < (exeUsesFullGuid ? 8u : 1u) - || (!exeUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!exeUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); break; } uint64_t drainTarget = exeUsesFullGuid @@ -6370,7 +6354,7 @@ void GameHandler::registerOpcodeHandlers() { // SPELL_EFFECT_HEALTH_LEECH: packed_guid target + uint32 amount + float multiplier for (uint32_t li = 0; li < effectLogCount; ++li) { if (packet.getRemainingSize() < (exeUsesFullGuid ? 8u : 1u) - || (!exeUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!exeUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); break; } uint64_t leechTarget = exeUsesFullGuid @@ -6435,7 +6419,7 @@ void GameHandler::registerOpcodeHandlers() { // SPELL_EFFECT_INTERRUPT_CAST: packed_guid target + uint32 interrupted_spell_id for (uint32_t li = 0; li < effectLogCount; ++li) { if (packet.getRemainingSize() < (exeUsesFullGuid ? 8u : 1u) - || (!exeUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!exeUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); break; } uint64_t icTarget = exeUsesFullGuid @@ -6849,13 +6833,13 @@ void GameHandler::registerOpcodeHandlers() { if (rl_rem() < 4) { packet.setReadPos(packet.getSize()); return; } /*uint32_t hitInfo =*/ packet.readUInt32(); if (rl_rem() < (rlUsesFullGuid ? 8u : 1u) - || (!rlUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!rlUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t attackerGuid = rlUsesFullGuid ? packet.readUInt64() : UpdateObjectParser::readPackedGuid(packet); if (rl_rem() < (rlUsesFullGuid ? 8u : 1u) - || (!rlUsesFullGuid && !hasFullPackedGuid(packet))) { + || (!rlUsesFullGuid && !packet.hasFullPackedGuid())) { packet.setReadPos(packet.getSize()); return; } uint64_t victimGuid = rlUsesFullGuid diff --git a/src/game/packet_parsers_classic.cpp b/src/game/packet_parsers_classic.cpp index a1066df5..bfa2550c 100644 --- a/src/game/packet_parsers_classic.cpp +++ b/src/game/packet_parsers_classic.cpp @@ -9,22 +9,6 @@ namespace game { namespace { -bool hasFullPackedGuid(const network::Packet& packet) { - if (packet.getReadPos() >= packet.getSize()) { - return false; - } - - const auto& rawData = packet.getData(); - const uint8_t mask = rawData[packet.getReadPos()]; - size_t guidBytes = 1; - for (int bit = 0; bit < 8; ++bit) { - if ((mask & (1u << bit)) != 0) { - ++guidBytes; - } - } - return packet.getRemainingSize() >= guidBytes; -} - std::string formatPacketBytes(const network::Packet& packet, size_t startPos) { const auto& rawData = packet.getData(); if (startPos >= rawData.size()) { @@ -52,7 +36,7 @@ bool skipClassicSpellCastTargets(network::Packet& packet, uint64_t* primaryTarge const uint16_t targetFlags = packet.readUInt16(); const auto readPackedTargetGuid = [&](bool capture) -> bool { - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { return false; } const uint64_t guid = UpdateObjectParser::readPackedGuid(packet); @@ -509,12 +493,12 @@ bool ClassicPacketParsers::parseSpellStart(network::Packet& packet, SpellStartDa const size_t startPos = packet.getReadPos(); if (rem() < 2) return false; - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } data.casterGuid = UpdateObjectParser::readPackedGuid(packet); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } @@ -584,9 +568,9 @@ bool ClassicPacketParsers::parseSpellGo(network::Packet& packet, SpellGoData& da }; if (rem() < 2) return false; - if (!hasFullPackedGuid(packet)) return false; + if (!packet.hasFullPackedGuid()) return false; data.casterGuid = UpdateObjectParser::readPackedGuid(packet); - if (!hasFullPackedGuid(packet)) return false; + if (!packet.hasFullPackedGuid()) return false; data.casterUnit = UpdateObjectParser::readPackedGuid(packet); // Vanilla/Turtle SMSG_SPELL_GO does not include castCount here. @@ -635,7 +619,7 @@ bool ClassicPacketParsers::parseSpellGo(network::Packet& packet, SpellGoData& da for (uint16_t i = 0; i < rawHitCount; ++i) { uint64_t targetGuid = 0; if (usePackedGuids) { - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { return false; } targetGuid = UpdateObjectParser::readPackedGuid(packet); @@ -708,7 +692,7 @@ bool ClassicPacketParsers::parseSpellGo(network::Packet& packet, SpellGoData& da bool truncatedMissTargets = false; const auto parseMissEntry = [&](SpellGoMissEntry& m, bool usePackedGuid) -> bool { if (usePackedGuid) { - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { return false; } m.targetGuid = UpdateObjectParser::readPackedGuid(packet); @@ -797,12 +781,12 @@ bool ClassicPacketParsers::parseAttackerStateUpdate(network::Packet& packet, Att const size_t startPos = packet.getReadPos(); data.hitInfo = packet.readUInt32(); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } data.attackerGuid = UpdateObjectParser::readPackedGuid(packet); // PackedGuid in Vanilla - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } @@ -863,10 +847,10 @@ bool ClassicPacketParsers::parseAttackerStateUpdate(network::Packet& packet, Att // ============================================================================ bool ClassicPacketParsers::parseSpellDamageLog(network::Packet& packet, SpellDamageLogData& data) { auto rem = [&]() { return packet.getRemainingSize(); }; - if (rem() < 2 || !hasFullPackedGuid(packet)) return false; + if (rem() < 2 || !packet.hasFullPackedGuid()) return false; data.targetGuid = UpdateObjectParser::readPackedGuid(packet); // PackedGuid in Vanilla - if (rem() < 1 || !hasFullPackedGuid(packet)) return false; + if (rem() < 1 || !packet.hasFullPackedGuid()) return false; data.attackerGuid = UpdateObjectParser::readPackedGuid(packet); // PackedGuid in Vanilla // uint32(spellId) + uint32(damage) + uint8(schoolMask) + uint32(absorbed) @@ -898,10 +882,10 @@ bool ClassicPacketParsers::parseSpellDamageLog(network::Packet& packet, SpellDam // ============================================================================ bool ClassicPacketParsers::parseSpellHealLog(network::Packet& packet, SpellHealLogData& data) { auto rem = [&]() { return packet.getRemainingSize(); }; - if (rem() < 2 || !hasFullPackedGuid(packet)) return false; + if (rem() < 2 || !packet.hasFullPackedGuid()) return false; data.targetGuid = UpdateObjectParser::readPackedGuid(packet); // PackedGuid in Vanilla - if (rem() < 1 || !hasFullPackedGuid(packet)) return false; + if (rem() < 1 || !packet.hasFullPackedGuid()) return false; data.casterGuid = UpdateObjectParser::readPackedGuid(packet); // PackedGuid in Vanilla if (rem() < 13) return false; // uint32 + uint32 + uint32 + uint8 = 13 bytes diff --git a/src/game/world_packets.cpp b/src/game/world_packets.cpp index 84b3d384..c81cea73 100644 --- a/src/game/world_packets.cpp +++ b/src/game/world_packets.cpp @@ -3391,12 +3391,12 @@ bool AttackerStateUpdateParser::parse(network::Packet& packet, AttackerStateUpda size_t startPos = packet.getReadPos(); data.hitInfo = packet.readUInt32(); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } data.attackerGuid = UpdateObjectParser::readPackedGuid(packet); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } @@ -3478,12 +3478,12 @@ bool SpellDamageLogParser::parse(network::Packet& packet, SpellDamageLogData& da if (packet.getRemainingSize() < 33) return false; size_t startPos = packet.getReadPos(); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } data.targetGuid = UpdateObjectParser::readPackedGuid(packet); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } @@ -3528,12 +3528,12 @@ bool SpellHealLogParser::parse(network::Packet& packet, SpellHealLogData& data) if (packet.getRemainingSize() < 21) return false; size_t startPos = packet.getReadPos(); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } data.targetGuid = UpdateObjectParser::readPackedGuid(packet); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } @@ -3765,11 +3765,11 @@ bool SpellStartParser::parse(network::Packet& packet, SpellStartData& data) { if (packet.getRemainingSize() < 15) return false; size_t startPos = packet.getReadPos(); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { return false; } data.casterGuid = UpdateObjectParser::readPackedGuid(packet); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } @@ -3799,13 +3799,13 @@ bool SpellStartParser::parse(network::Packet& packet, SpellStartData& data) { uint32_t targetFlags = packet.readUInt32(); auto readPackedTarget = [&](uint64_t* out) -> bool { - if (!hasFullPackedGuid(packet)) return false; + if (!packet.hasFullPackedGuid()) return false; uint64_t g = UpdateObjectParser::readPackedGuid(packet); if (out) *out = g; return true; }; auto skipPackedAndFloats3 = [&]() -> bool { - if (!hasFullPackedGuid(packet)) return false; + if (!packet.hasFullPackedGuid()) return false; UpdateObjectParser::readPackedGuid(packet); // transport GUID (may be zero) if (packet.getRemainingSize() < 12) return false; packet.readFloat(); packet.readFloat(); packet.readFloat(); @@ -3846,11 +3846,11 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) { if (packet.getRemainingSize() < 16) return false; size_t startPos = packet.getReadPos(); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { return false; } data.casterGuid = UpdateObjectParser::readPackedGuid(packet); - if (!hasFullPackedGuid(packet)) { + if (!packet.hasFullPackedGuid()) { packet.setReadPos(startPos); return false; } @@ -3974,13 +3974,13 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) { uint32_t targetFlags = packet.readUInt32(); auto readPackedTarget = [&](uint64_t* out) -> bool { - if (!hasFullPackedGuid(packet)) return false; + if (!packet.hasFullPackedGuid()) return false; uint64_t g = UpdateObjectParser::readPackedGuid(packet); if (out) *out = g; return true; }; auto skipPackedAndFloats3 = [&]() -> bool { - if (!hasFullPackedGuid(packet)) return false; + if (!packet.hasFullPackedGuid()) return false; UpdateObjectParser::readPackedGuid(packet); // transport GUID if (packet.getRemainingSize() < 12) return false; packet.readFloat(); packet.readFloat(); packet.readFloat();