diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2020-07-27 06:05:53 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2020-07-27 06:05:53 +0200 |
commit | d899b21504c02cae99eb3688e561cf9bad4120c4 (patch) | |
tree | bfa380e1b81ab848766becff8322e783e4dcde1a /src/GameState.cpp | |
parent | Merge pull request #40 from LaG1924/lua-scripting (diff) | |
download | AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar.gz AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar.bz2 AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar.lz AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar.xz AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.tar.zst AltCraft-d899b21504c02cae99eb3688e561cf9bad4120c4.zip |
Diffstat (limited to 'src/GameState.cpp')
-rw-r--r-- | src/GameState.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/GameState.cpp b/src/GameState.cpp index e4278ec..8e50ee6 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -254,6 +254,7 @@ void GameState::UpdatePacket(std::shared_ptr<Packet> ptr) { entity.entityId = packet->EntityId; entity.width = 0.6; entity.height = 1.8; + world = World(packet->Dimension); world.AddEntity(entity); player = world.GetEntityPtr(entity.entityId); @@ -385,8 +386,22 @@ void GameState::UpdatePacket(std::shared_ptr<Packet> ptr) { break; case ResourcePackSend: break; - case Respawn: + case Respawn: { + auto packet = std::static_pointer_cast<PacketRespawn>(ptr); + Entity entity; + entity.entityId = player->entityId; + entity.width = 0.6; + entity.height = 1.8; + world = World(packet->Dimension); + world.AddEntity(entity); + player = world.GetEntityPtr(entity.entityId); + + gameStatus.gamemode = (packet->Gamemode & 0b11111011); + gameStatus.dimension = packet->Dimension; + gameStatus.difficulty = packet->Difficulty; + gameStatus.levelType = packet->LevelType; break; + } case EntityHeadLook: break; case SelectAdvancementTab: |