mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 18:05:51 -04:00
fix some network issues (<1.13)
This commit is contained in:
parent
a6c06d4d80
commit
ad7354964d
@ -41,7 +41,7 @@ import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||
import de.bixilon.minosoft.data.text.ChatComponent
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
import de.bixilon.minosoft.protocol.packets.c2s.play.entity.player.ClientActionC2SP
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_1_8_9
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_17W13B
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
|
||||
// https://c4k3.github.io/wiki.vg/images/1/13/Inventory-slots.png
|
||||
@ -104,7 +104,7 @@ class PlayerInventory(
|
||||
}
|
||||
|
||||
override fun onOpen() {
|
||||
if (connection.version <= V_1_8_9) { // TODO: find out version
|
||||
if (connection.version < V_17W13B) {
|
||||
connection.network.send(ClientActionC2SP(ClientActionC2SP.ClientActions.OPEN_INVENTORY))
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class ClientActionC2SP(
|
||||
enum class ClientActions {
|
||||
PERFORM_RESPAWN,
|
||||
REQUEST_STATISTICS,
|
||||
OPEN_INVENTORY,
|
||||
OPEN_INVENTORY, // removed in 17w13b
|
||||
;
|
||||
|
||||
companion object : ValuesEnum<ClientActions> {
|
||||
|
@ -20,8 +20,9 @@ import de.bixilon.minosoft.modding.event.events.container.ContainerOpenEvent
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_14W03B
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_19W11A
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_19W02A
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_1_14
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_1_8_9
|
||||
import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayInByteBuffer
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import de.bixilon.minosoft.util.logging.LogLevels
|
||||
@ -45,18 +46,18 @@ class OpenContainerS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
||||
}
|
||||
}
|
||||
val title: ChatComponent = buffer.readChatComponent()
|
||||
val slotCount: Int = if (buffer.versionId <= V_19W11A) { // ToDo: This is completely guessed, it is not present in 1.16.5 (unchecked)
|
||||
val slotCount: Int = if (buffer.versionId <= V_19W02A) { // ToDo: This is completely guessed, it is not present in 1.16.5 (unchecked)
|
||||
buffer.readUnsignedByte()
|
||||
} else {
|
||||
// ToDo: load from pixlyzer
|
||||
0
|
||||
}
|
||||
val hasTitle: Boolean = if (buffer.versionId > V_14W03B && buffer.versionId <= V_1_14) { // upper version completely guessed
|
||||
val hasTitle: Boolean = if (buffer.versionId > V_14W03B && buffer.versionId <= V_1_8_9) { // TODO: upper version (1.8) is probably worng. it changed between 1.7.10..1.8
|
||||
buffer.readBoolean()
|
||||
} else {
|
||||
true
|
||||
}
|
||||
var entityId: Int? = if (containerType.identifier == DefaultInventoryTypes.HORSE || buffer.versionId < V_14W03B) { // ToDo: This was removed at some point
|
||||
var entityId: Int? = if (buffer.versionId >= V_19W02A && (containerType.identifier == DefaultInventoryTypes.HORSE || buffer.versionId < V_14W03B)) {
|
||||
buffer.readInt()
|
||||
} else {
|
||||
null
|
||||
|
Loading…
x
Reference in New Issue
Block a user