mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2024-11-15 10:55:27 +01:00
1.7.2 -> 1.7.6 was moved to viarewind
This commit is contained in:
parent
e4b8cf1c29
commit
b0e09bee90
@ -1,17 +1,11 @@
|
||||
package com.viaversion.aas.protocol
|
||||
|
||||
import com.viaversion.aas.protocol.id47toid5.Protocol1_8To1_7_6
|
||||
import com.viaversion.aas.protocol.id5toid4.Protocol1_7_6to1_7_2
|
||||
import com.viaversion.viaversion.api.Via
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
|
||||
|
||||
// cursed 1.7 -> 1.8 from https://github.com/Gerrygames/ClientViaVersion
|
||||
// + https://github.com/creeper123123321/ViaRewind/tree/17to18
|
||||
fun registerAspirinProtocols() {
|
||||
Via.getManager().protocolManager.registerProtocol(
|
||||
Protocol1_7_6to1_7_2,
|
||||
ProtocolVersion.v1_7_6,
|
||||
ProtocolVersion.v1_7_1
|
||||
)
|
||||
Via.getManager().protocolManager.registerProtocol(Protocol1_8To1_7_6, ProtocolVersion.v1_8, ProtocolVersion.v1_7_6)
|
||||
}
|
||||
|
@ -3,21 +3,9 @@ package com.viaversion.aas.protocol
|
||||
import com.viaversion.viaversion.api.minecraft.Position
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper
|
||||
import com.viaversion.viaversion.api.protocol.remapper.ValueReader
|
||||
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer
|
||||
import com.viaversion.viaversion.api.protocol.remapper.ValueWriter
|
||||
import com.viaversion.viaversion.api.type.Type
|
||||
|
||||
val INSERT_DASHES: ValueTransformer<String, String> = object : ValueTransformer<String, String>(Type.STRING) {
|
||||
override fun transform(packetWrapper: PacketWrapper, s: String?): String {
|
||||
val builder = StringBuilder(s)
|
||||
builder.insert(20, "-")
|
||||
builder.insert(16, "-")
|
||||
builder.insert(12, "-")
|
||||
builder.insert(8, "-")
|
||||
return builder.toString()
|
||||
}
|
||||
}
|
||||
|
||||
val xyzToPosition = ValueReader { packetWrapper: PacketWrapper ->
|
||||
val x = packetWrapper.read(Type.INT)
|
||||
val y = packetWrapper.read(Type.INT).toShort()
|
||||
@ -30,17 +18,17 @@ val xyzUBytePos = ValueReader { packetWrapper: PacketWrapper ->
|
||||
val z = packetWrapper.read(Type.INT)
|
||||
Position(x, y, z)
|
||||
}
|
||||
val xyzUBytePosWriter: ValueWriter<Position> = ValueWriter<Position> { packetWrapper: PacketWrapper, pos: Position ->
|
||||
val xyzUBytePosWriter = ValueWriter { packetWrapper: PacketWrapper, pos: Position ->
|
||||
packetWrapper.write(Type.INT, pos.x)
|
||||
packetWrapper.write(Type.UNSIGNED_BYTE, pos.y.toShort())
|
||||
packetWrapper.write(Type.INT, pos.z)
|
||||
}
|
||||
val xyzShortPosWriter: ValueWriter<Position> = ValueWriter<Position> { packetWrapper: PacketWrapper, pos: Position ->
|
||||
val xyzShortPosWriter = ValueWriter { packetWrapper: PacketWrapper, pos: Position ->
|
||||
packetWrapper.write(Type.INT, pos.x)
|
||||
packetWrapper.write(Type.SHORT, pos.y.toShort())
|
||||
packetWrapper.write(Type.INT, pos.z)
|
||||
}
|
||||
val xyzShortPos: ValueReader<Position> = ValueReader<Position> { packetWrapper: PacketWrapper ->
|
||||
val xyzShortPos = ValueReader { packetWrapper: PacketWrapper ->
|
||||
val x = packetWrapper.read(Type.INT)
|
||||
val y = packetWrapper.read(Type.SHORT)
|
||||
val z = packetWrapper.read(Type.INT)
|
||||
|
@ -1,32 +0,0 @@
|
||||
package com.viaversion.aas.protocol.id5toid4
|
||||
|
||||
import com.viaversion.aas.protocol.INSERT_DASHES
|
||||
import com.viaversion.viaversion.api.connection.UserConnection
|
||||
import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol
|
||||
import com.viaversion.viaversion.api.protocol.packet.State
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper
|
||||
import com.viaversion.viaversion.api.type.Type
|
||||
|
||||
// Based on https://github.com/Gerrygames/ClientViaVersion
|
||||
object Protocol1_7_6to1_7_2 : AbstractSimpleProtocol() {
|
||||
override fun registerPackets() {
|
||||
//Login Success
|
||||
this.registerClientbound(State.LOGIN, 0x02, 0x02, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.STRING, INSERT_DASHES)
|
||||
}
|
||||
})
|
||||
|
||||
//Spawn Player
|
||||
this.registerClientbound(State.PLAY, 0x0C, 0x0C, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT)
|
||||
map(Type.STRING, INSERT_DASHES)
|
||||
map(Type.STRING)
|
||||
create(Type.VAR_INT, 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun init(userConnection: UserConnection) {}
|
||||
}
|
Loading…
Reference in New Issue
Block a user