Skip to content

Commit

Permalink
fix: fix initial gamemode send on new versions
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Dec 20, 2024
1 parent d4b6bd1 commit 83da96b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/modules/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 83da96b

Please sign in to comment.