diff options
-rw-r--r-- | src/GameState.cpp | 4 | ||||
-rw-r--r-- | src/Section.cpp | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/GameState.cpp b/src/GameState.cpp index a2f7d87..de9f1d7 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -52,11 +52,11 @@ void GameState::UpdatePacket(std::shared_ptr<Packet> ptr) case SpawnGlobalEntity: break; case SpawnMob: { - auto packet = std::static_pointer_cast<PacketSpawnObject>(ptr); + auto packet = std::static_pointer_cast<PacketSpawnMob>(ptr); Entity entity; entity.entityId = packet->EntityId; entity.pos = VectorF(packet->X, packet->Y, packet->Z); - entity.uuid = packet->ObjectUuid; + entity.uuid = packet->EntityUuid; entity.vel = Entity::DecodeVelocity(packet->VelocityX, packet->VelocityY, packet->VelocityZ); entity.yaw = packet->Yaw / 256.0; entity.pitch = packet->Pitch / 256.0; diff --git a/src/Section.cpp b/src/Section.cpp index 1083538..2f72411 100644 --- a/src/Section.cpp +++ b/src/Section.cpp @@ -4,6 +4,12 @@ #include <cstring> void Section::CalculateHash() const { + if (block.empty()) { + hash = 0; + return; + } + + size_t offset = 0; std::vector<unsigned char> rawData; |