Skip to content

Commit f99a383

Browse files
committed
Fix native backend regression with older MC vers
1 parent 2ba981a commit f99a383

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

android/app/src/main/java/com/enderchat/modules/connection/ConnectionModule.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,9 @@ class ConnectionModule(reactContext: ReactApplicationContext)
343343
// Remove upstream listeners, stop unnecessary background tasks
344344
}
345345

346-
/* private fun println(log: Any?) {
346+
private fun println(log: Any?) {
347347
sendEvent(reactContext = reactApplicationContext, "ecm:log", Arguments.createMap().apply {
348348
putString("log", log.toString())
349349
})
350-
} */
350+
}
351351
}

src/minecraft/connection/native.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,13 @@ export class NativeServerConnection extends events.EventEmitter implements Serve
102102
packet.id === packetIds.CLIENTBOUND_LOGIN_SUCCESS(version) &&
103103
this.state === ConnectionState.LOGIN
104104
) {
105-
this.state =
106-
version >= protocolMap['1.20.2'] ? ConnectionState.CONFIGURATION : ConnectionState.PLAY
107-
this.writePacket(
108-
packetIds.SERVERBOUND_LOGIN_ACKNOWLEDGED(version) ?? 0,
109-
Buffer.alloc(0),
110-
).catch((err: unknown) => this.emit('error', err))
105+
if (version >= protocolMap['1.20.2']) {
106+
this.state = ConnectionState.CONFIGURATION
107+
this.writePacket(
108+
packetIds.SERVERBOUND_LOGIN_ACKNOWLEDGED(version) ?? 0,
109+
Buffer.alloc(0),
110+
).catch((err: unknown) => this.emit('error', err))
111+
} else this.state = ConnectionState.PLAY
111112
} else if (
112113
packet.id === packetIds.CLIENTBOUND_FINISH_CONFIGURATION(version) &&
113114
this.state === ConnectionState.CONFIGURATION

src/minecraft/packets/ids.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const packetIds = {
2323
SERVERBOUND_LOGIN_START: generateIdFunction([[protocolMap['1.16.4'], 0x00]]),
2424
SERVERBOUND_ENCRYPTION_RESPONSE: generateIdFunction([[protocolMap['1.16.4'], 0x01]]),
2525
SERVERBOUND_LOGIN_PLUGIN_RESPONSE: generateIdFunction([[protocolMap['1.16.4'], 0x02]]),
26-
SERVERBOUND_LOGIN_ACKNOWLEDGED: generateIdFunction([[protocolMap['1.16.4'], 0x03]]),
26+
SERVERBOUND_LOGIN_ACKNOWLEDGED: generateIdFunction([[protocolMap['1.20.2'], 0x03]]),
2727

2828
// ===========================
2929
// Clientbound (configuration)

0 commit comments

Comments
 (0)