network: fix BlockPlace packet writing, fix gamemode in JoinGame (remove debug statement)

This commit is contained in:
Bixilon 2021-10-22 13:32:43 +02:00
parent 3e49afab2f
commit 3cc6a57859
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 6 additions and 5 deletions

View File

@ -51,9 +51,7 @@ class BlockPlaceC2SP(
buffer.writeVarInt(hand.ordinal) buffer.writeVarInt(hand.ordinal)
} }
} }
if (buffer.versionId >= ProtocolVersions.V_19W03A) {
buffer.writeBoolean(insideBlock)
}
if (buffer.versionId < ProtocolVersions.V_16W39C) { if (buffer.versionId < ProtocolVersions.V_16W39C) {
buffer.writeByte((cursorPosition.x * 15.0f).toInt()) buffer.writeByte((cursorPosition.x * 15.0f).toInt())
buffer.writeByte((cursorPosition.y * 15.0f).toInt()) buffer.writeByte((cursorPosition.y * 15.0f).toInt())
@ -63,6 +61,10 @@ class BlockPlaceC2SP(
buffer.writeFloat(cursorPosition.y) buffer.writeFloat(cursorPosition.y)
buffer.writeFloat(cursorPosition.z) buffer.writeFloat(cursorPosition.z)
} }
if (buffer.versionId >= ProtocolVersions.V_19W03A) {
buffer.writeBoolean(insideBlock)
}
} }
override fun log() { override fun log() {

View File

@ -83,8 +83,7 @@ class JoinGameS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
gamemode = Gamemodes[(gamemodeRaw and (0x8.inv()))] gamemode = Gamemodes[(gamemodeRaw and (0x8.inv()))]
} else { } else {
isHardcore = buffer.readBoolean() isHardcore = buffer.readBoolean()
buffer.readUnsignedByte() gamemode = Gamemodes[buffer.readUnsignedByte()]
gamemode = Gamemodes.SURVIVAL
} }
if (buffer.versionId < ProtocolVersions.V_1_9_1) { if (buffer.versionId < ProtocolVersions.V_1_9_1) {