From 83da96b421789824e78cf4afddf9edea8623e7bc Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Fri, 20 Dec 2024 22:33:04 +0300 Subject: [PATCH] fix: fix initial gamemode send on new versions --- src/lib/modules/login.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib/modules/login.ts b/src/lib/modules/login.ts index 9c1310d3..ace928c2 100644 --- a/src/lib/modules/login.ts +++ b/src/lib/modules/login.ts @@ -148,6 +148,17 @@ export const player = async function (player: Player, serv: Server, settings: Op const dimensionCodec = getDimensionCodec(MAX_HEIGHT, serv.supportFeature('dimensionDataIsAvailable'), settings.version) // const dimensionCodec = serv.mcData.loginPacket.dimensionCodec + const worldState = (serv.mcData.loginPacket as any).worldState + if (worldState) { + worldState.gamemode = { + 0: 'survival', + 1: 'creative', + 2: 'adventure', + 3: 'spectator' + }[player.gameMode] + worldState.previousGamemode = player.prevGameMode + } + player._client.write('login', { ...serv.mcData.loginPacket, // for new fields entityId: player.id,