fix 1.7 network errors, read/handle legacy tab list correctly

This commit is contained in:
Moritz Zwerger 2023-10-07 19:14:31 +02:00
parent bc315053c6
commit cf8c427af1
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 7 additions and 4 deletions

View File

@ -32,7 +32,7 @@ import java.util.*
class EntityPlayerS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
val entityId: Int
val entityUUID: UUID?
val entityUUID: UUID
val entity: PlayerEntity
init {

View File

@ -33,7 +33,7 @@ class NamedSoundS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
val pitch: Float
lateinit var position: Vec3d
private set
lateinit var category: SoundCategories
var category: SoundCategories? = null
private set
var seed: Long = 0L
private set

View File

@ -12,7 +12,9 @@
*/
package de.bixilon.minosoft.protocol.packets.s2c.play.tab
import de.bixilon.minosoft.data.entities.entities.player.additional.AdditionalDataUpdate
import de.bixilon.minosoft.data.entities.entities.player.additional.PlayerAdditional
import de.bixilon.minosoft.modding.event.events.TabListEntryChangeEvent
import de.bixilon.minosoft.protocol.ProtocolUtil.encodeNetwork
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
@ -34,9 +36,9 @@ class LegacyTabListS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
buffer.readVarInt()
}
if (buffer.readBoolean()) {
items[name] = ping // update latency or add
} else {
items[name] = null // remove
} else {
items[name] = ping // update latency or add
}
}
@ -58,6 +60,7 @@ class LegacyTabListS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
connection.tabList.name[name] = item
}
item.ping = ping
connection.events.fire(TabListEntryChangeEvent(connection, mapOf(uuid to AdditionalDataUpdate(ping = ping))))
}
}