From 1ead4a159054c5f8814f325fb7797466331fa095 Mon Sep 17 00:00:00 2001 From: DankParrot Date: Mon, 3 Aug 2020 18:40:15 -0700 Subject: [PATCH] Spawn the player!!!! --- src/DedicatedServer.cpp | 22 +++++++++++++++++++++- src/protocol/protocol.hjson | 23 +++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/DedicatedServer.cpp b/src/DedicatedServer.cpp index c29df6a..2c3b11e 100644 --- a/src/DedicatedServer.cpp +++ b/src/DedicatedServer.cpp @@ -102,7 +102,7 @@ namespace Feather } template <> - void DedicatedServer::HandlePacket(MinecraftClient& client, const Login::ServerboundStart& start) + void DedicatedServer::HandlePacket(MinecraftClient& client,const Login::ServerboundStart& start) { //Login::ClientboundSuccess success = //{ @@ -134,5 +134,25 @@ namespace Feather }; client.SendMessage(join); + + Play::ClientboundSpawnPosition spawnPos = + { + .location = BlockPos(0, 64, 0), + }; + + client.SendMessage(spawnPos); + + Play::ClientboundPlayerPositionAndLook playerPos = + { + .x = 0, + .y = 64, + .z = 0, + .xRot = 0, + .yRot = 0, + .flags = 0, + .id = 0, + }; + + client.SendMessage(playerPos); } } diff --git a/src/protocol/protocol.hjson b/src/protocol/protocol.hjson index 52fd519..3117b3e 100644 --- a/src/protocol/protocol.hjson +++ b/src/protocol/protocol.hjson @@ -155,6 +155,29 @@ enableRespawnScreen : bool } } + + PlayerPositionAndLook: + { + id: 0x36 + vars: { + x: double + y: double + z: double + // xRot is yaw, yRot is pitch + xRot: float + yRot: float + flags: byte + id: varint + } + } + + SpawnPosition: + { + id: 0x4E + vars: { + location: position + } + } } } }