mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2025-01-24 22:01:49 +01:00
Update VV
This commit is contained in:
parent
7527c9fb5a
commit
3debc6d767
@ -47,8 +47,8 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.viaversion:viaversion:4.0.0-21w16a") { isTransitive = false }
|
||||
implementation("com.viaversion:viabackwards:4.0.0-21w16a") { isTransitive = false }
|
||||
implementation("com.viaversion:viaversion:4.0.0-21w17a") { isTransitive = false }
|
||||
implementation("com.viaversion:viabackwards:4.0.0-21w17a") { isTransitive = false }
|
||||
implementation("com.github.ViaVersion.ViaRewind:viarewind-all:dev-SNAPSHOT") { isTransitive = false }
|
||||
implementation("io.netty:netty-all:4.1.63.Final")
|
||||
implementation("org.yaml:snakeyaml:1.28")
|
||||
|
@ -10,14 +10,14 @@ import com.viaversion.viaversion.exception.CancelEncoderException
|
||||
class ViaCodec(val info: UserConnection) : MessageToMessageCodec<ByteBuf, ByteBuf>() {
|
||||
override fun decode(ctx: ChannelHandlerContext, bytebuf: ByteBuf, out: MutableList<Any>) {
|
||||
if (!ctx.channel().isActive) return
|
||||
if (!info.checkIncomingPacket()) throw CancelDecoderException.generate(null)
|
||||
if (!info.checkClientboundPacket()) throw CancelDecoderException.generate(null)
|
||||
if (!info.shouldTransformPacket()) {
|
||||
out.add(bytebuf.retain())
|
||||
return
|
||||
}
|
||||
val transformedBuf: ByteBuf = ctx.alloc().buffer().writeBytes(bytebuf)
|
||||
try {
|
||||
info.transformIncoming(transformedBuf, CancelDecoderException::generate)
|
||||
info.transformClientbound(transformedBuf, CancelDecoderException::generate)
|
||||
out.add(transformedBuf.retain())
|
||||
} finally {
|
||||
transformedBuf.release()
|
||||
@ -26,14 +26,14 @@ class ViaCodec(val info: UserConnection) : MessageToMessageCodec<ByteBuf, ByteBu
|
||||
|
||||
override fun encode(ctx: ChannelHandlerContext, bytebuf: ByteBuf, out: MutableList<Any>) {
|
||||
if (!ctx.channel().isActive) throw CancelEncoderException.CACHED
|
||||
if (!info.checkOutgoingPacket()) throw CancelEncoderException.generate(null)
|
||||
if (!info.checkServerboundPacket()) throw CancelEncoderException.generate(null)
|
||||
if (!info.shouldTransformPacket()) {
|
||||
out.add(bytebuf.retain())
|
||||
return
|
||||
}
|
||||
val transformedBuf: ByteBuf = ctx.alloc().buffer().writeBytes(bytebuf)
|
||||
try {
|
||||
info.transformOutgoing(transformedBuf, CancelEncoderException::generate)
|
||||
info.transformServerbound(transformedBuf, CancelEncoderException::generate)
|
||||
out.add(transformedBuf.retain())
|
||||
} finally {
|
||||
transformedBuf.release()
|
||||
|
@ -1,8 +0,0 @@
|
||||
package com.viaversion.aas.platform
|
||||
|
||||
import com.viaversion.viaversion.api.boss.BossColor
|
||||
import com.viaversion.viaversion.api.boss.BossStyle
|
||||
import com.viaversion.viaversion.boss.CommonBoss
|
||||
|
||||
class AspirinBossBar(title: String, health: Float, style: BossStyle, color: BossColor) :
|
||||
CommonBoss<Unit>(title, health, color, style)
|
@ -2,15 +2,9 @@ package com.viaversion.aas.platform
|
||||
|
||||
import com.viaversion.viaversion.ViaAPIBase
|
||||
import io.netty.buffer.ByteBuf
|
||||
import com.viaversion.viaversion.api.boss.BossBar
|
||||
import com.viaversion.viaversion.api.boss.BossColor
|
||||
import com.viaversion.viaversion.api.boss.BossStyle
|
||||
import java.util.*
|
||||
|
||||
object AspirinViaAPI : ViaAPIBase<UUID>() {
|
||||
override fun createBossBar(p0: String, p1: BossColor, p2: BossStyle): BossBar<*> = AspirinBossBar(p0, 0f, p2, p1)
|
||||
override fun createBossBar(p0: String, p1: Float, p2: BossColor, p3: BossStyle): BossBar<*> =
|
||||
AspirinBossBar(p0, p1, p3, p2)
|
||||
|
||||
override fun sendRawPacket(p0: UUID, p1: ByteBuf) = super.sendRawPacket(p0, p1)
|
||||
override fun getPlayerVersion(p0: UUID?): Int = throw UnsupportedOperationException()
|
||||
|
@ -16,7 +16,7 @@ import kotlin.experimental.and
|
||||
|
||||
fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
//Entity Equipment
|
||||
this.registerOutgoing(State.PLAY, 0x04, 0x04, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x04, 0x04, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(Type.SHORT) //Slot
|
||||
@ -25,7 +25,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Animation
|
||||
this.registerOutgoing(State.PLAY, 0x0B, 0x0B, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x0B, 0x0B, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper ->
|
||||
val entityId = packetWrapper.read(Type.VAR_INT) //Entity Id
|
||||
@ -47,7 +47,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Collect Item
|
||||
this.registerOutgoing(State.PLAY, 0x0D, 0x0D, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x0D, 0x0D, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Collected Entity ID
|
||||
map(Type.INT, Type.VAR_INT) //Collector Entity ID
|
||||
@ -56,7 +56,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
|
||||
|
||||
//Spawn Object
|
||||
this.registerOutgoing(State.PLAY, 0x0E, 0x0E, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x0E, 0x0E, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT)
|
||||
map(Type.BYTE)
|
||||
@ -117,7 +117,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Spawn Mob
|
||||
this.registerOutgoing(State.PLAY, 0x0F, 0x0F, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x0F, 0x0F, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT)
|
||||
map(Type.UNSIGNED_BYTE)
|
||||
@ -152,7 +152,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Spawn Painting
|
||||
this.registerOutgoing(State.PLAY, 0x10, 0x10, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x10, 0x10, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT) //Entity Id
|
||||
map(Type.STRING) //Title
|
||||
@ -168,7 +168,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Spawn Experience Orb
|
||||
this.registerOutgoing(State.PLAY, 0x11, 0x11, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x11, 0x11, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT)
|
||||
map(Type.INT)
|
||||
@ -185,7 +185,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Entity Velocity
|
||||
this.registerOutgoing(State.PLAY, 0x12, 0x12, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x12, 0x12, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(Type.SHORT) //velX
|
||||
@ -195,7 +195,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Destroy Entities
|
||||
this.registerOutgoing(State.PLAY, 0x13, 0x13, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x13, 0x13, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper ->
|
||||
val amount = packetWrapper.read(Type.BYTE).toInt()
|
||||
@ -211,14 +211,14 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Entity
|
||||
this.registerOutgoing(State.PLAY, 0x14, 0x14, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x14, 0x14, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
}
|
||||
})
|
||||
|
||||
//Entity Relative Move
|
||||
this.registerOutgoing(State.PLAY, 0x15, 0x15, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x15, 0x15, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(Type.BYTE) //x
|
||||
@ -231,7 +231,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Entity Look
|
||||
this.registerOutgoing(State.PLAY, 0x16, 0x16, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x16, 0x16, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(Type.BYTE) //yaw
|
||||
@ -243,7 +243,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Entity Look and Relative Move
|
||||
this.registerOutgoing(State.PLAY, 0x17, 0x17, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x17, 0x17, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(Type.BYTE) //x
|
||||
@ -258,7 +258,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Entity Teleport
|
||||
this.registerOutgoing(State.PLAY, 0x18, 0x18, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x18, 0x18, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(Type.INT) //x
|
||||
@ -273,7 +273,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Entity Head Look
|
||||
this.registerOutgoing(State.PLAY, 0x19, 0x19, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x19, 0x19, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(Type.BYTE) //Head yaw
|
||||
@ -281,7 +281,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Entity MetadataType
|
||||
this.registerOutgoing(State.PLAY, 0x1C, 0x1C, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x1C, 0x1C, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(Types1_7_6_10.METADATA_LIST, Types1_8.METADATA_LIST) //MetadataType
|
||||
@ -301,7 +301,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Entity Effect
|
||||
this.registerOutgoing(State.PLAY, 0x1D, 0x1D, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x1D, 0x1D, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(Type.BYTE) //Effect Id
|
||||
@ -312,7 +312,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Remove Entity Effect
|
||||
this.registerOutgoing(State.PLAY, 0x1E, 0x1E, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x1E, 0x1E, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(Type.BYTE) //Effect Id
|
||||
@ -320,7 +320,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Entity Properties
|
||||
this.registerOutgoing(State.PLAY, 0x20, 0x20, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x20, 0x20, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
handler { packetWrapper ->
|
||||
@ -343,7 +343,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
|
||||
|
||||
//Spawn Global Entity
|
||||
this.registerOutgoing(State.PLAY, 0x2C, 0x2C, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x2C, 0x2C, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT)
|
||||
map(Type.BYTE)
|
||||
@ -360,7 +360,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Use Entity
|
||||
this.registerIncoming(State.PLAY, 0x02, 0x02, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x02, 0x02, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT, Type.INT)
|
||||
handler { packetWrapper ->
|
||||
@ -378,7 +378,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Entity Action
|
||||
this.registerIncoming(State.PLAY, 0x0B, 0x0B, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x0B, 0x0B, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT, Type.INT) //Entity Id
|
||||
handler { packetWrapper -> packetWrapper.write(Type.BYTE, (packetWrapper.read(Type.VAR_INT) + 1).toByte()) } //Action Id
|
||||
@ -387,7 +387,7 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
|
||||
})
|
||||
|
||||
//Steer Vehicle
|
||||
this.registerIncoming(State.PLAY, 0x0C, 0x0C, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x0C, 0x0C, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.FLOAT) //Sideways
|
||||
map(Type.FLOAT) //Forwards
|
||||
|
@ -14,7 +14,7 @@ import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.legacy.Leg
|
||||
fun Protocol1_8To1_7_6.registerInventoryPackets() {
|
||||
|
||||
//Open Window
|
||||
this.registerOutgoing(State.PLAY, 0x2D, 0x2D, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x2D, 0x2D, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.UNSIGNED_BYTE)
|
||||
handler { packetWrapper ->
|
||||
@ -40,7 +40,7 @@ fun Protocol1_8To1_7_6.registerInventoryPackets() {
|
||||
})
|
||||
|
||||
//Set Slot
|
||||
this.registerOutgoing(State.PLAY, 0x2F, 0x2F, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x2F, 0x2F, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper ->
|
||||
val windowId = packetWrapper.read(Type.BYTE).toShort() //Window Id
|
||||
@ -55,7 +55,7 @@ fun Protocol1_8To1_7_6.registerInventoryPackets() {
|
||||
})
|
||||
|
||||
//Window Items
|
||||
this.registerOutgoing(State.PLAY, 0x30, 0x30, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x30, 0x30, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.UNSIGNED_BYTE) //Window Id
|
||||
handler { packetWrapper ->
|
||||
@ -76,7 +76,7 @@ fun Protocol1_8To1_7_6.registerInventoryPackets() {
|
||||
|
||||
|
||||
//Click Window
|
||||
this.registerIncoming(State.PLAY, 0x0E, 0x0E, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x0E, 0x0E, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper ->
|
||||
val windowId = packetWrapper.read(Type.UNSIGNED_BYTE) //Window Id
|
||||
@ -100,7 +100,7 @@ fun Protocol1_8To1_7_6.registerInventoryPackets() {
|
||||
})
|
||||
|
||||
//Creative Inventory Action
|
||||
this.registerIncoming(State.PLAY, 0x10, 0x10, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x10, 0x10, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.SHORT) //Slot
|
||||
map(Type.ITEM, Types1_7_6_10.COMPRESSED_NBT_ITEM) //Item
|
||||
|
@ -7,7 +7,7 @@ import com.viaversion.viaversion.api.protocol.packet.State
|
||||
|
||||
fun Protocol1_8To1_7_6.registerLoginPackets() {
|
||||
//Encryption Request
|
||||
this.registerOutgoing(State.LOGIN, 0x01, 0x01, object : PacketRemapper() {
|
||||
this.registerClientbound(State.LOGIN, 0x01, 0x01, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.STRING) //Server ID
|
||||
map(Type.SHORT_BYTE_ARRAY, Type.BYTE_ARRAY_PRIMITIVE)
|
||||
@ -16,7 +16,7 @@ fun Protocol1_8To1_7_6.registerLoginPackets() {
|
||||
})
|
||||
|
||||
//Encryption Response
|
||||
this.registerIncoming(State.LOGIN, 0x01, 0x01, object : PacketRemapper() {
|
||||
this.registerServerbound(State.LOGIN, 0x01, 0x01, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.BYTE_ARRAY_PRIMITIVE, Type.SHORT_BYTE_ARRAY)
|
||||
map(Type.BYTE_ARRAY_PRIMITIVE, Type.SHORT_BYTE_ARRAY)
|
||||
|
@ -33,14 +33,14 @@ import kotlin.experimental.and
|
||||
|
||||
fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
//Keep Alive
|
||||
this.registerOutgoing(State.PLAY, 0x00, 0x00, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x00, 0x00, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT)
|
||||
}
|
||||
})
|
||||
|
||||
//Join Game
|
||||
this.registerOutgoing(State.PLAY, 0x01, 0x01, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x01, 0x01, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT) //Entiy Id
|
||||
map(Type.UNSIGNED_BYTE) //Gamemode
|
||||
@ -55,7 +55,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Chat Message
|
||||
this.registerOutgoing(State.PLAY, 0x02, 0x02, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x02, 0x02, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.STRING) //Chat Message
|
||||
create { packetWrapper ->
|
||||
@ -65,14 +65,14 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Spawn Position
|
||||
this.registerOutgoing(State.PLAY, 0x05, 0x05, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x05, 0x05, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(xyzToPosition, TypeRemapper(Type.POSITION)) //Position
|
||||
}
|
||||
})
|
||||
|
||||
//Update Health
|
||||
this.registerOutgoing(State.PLAY, 0x06, 0x06, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x06, 0x06, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.FLOAT) //Health
|
||||
map(Type.SHORT, Type.VAR_INT) //Food
|
||||
@ -81,7 +81,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Player Position And Look
|
||||
this.registerOutgoing(State.PLAY, 0x08, 0x08, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x08, 0x08, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.DOUBLE) //x
|
||||
handler { packetWrapper ->
|
||||
@ -99,7 +99,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Use Bed
|
||||
this.registerOutgoing(State.PLAY, 0x0A, 0x0A, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x0A, 0x0A, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT, Type.VAR_INT) //Entity Id
|
||||
map(xyzUBytePos, TypeRemapper(Type.POSITION))
|
||||
@ -107,7 +107,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Spawn Player
|
||||
this.registerOutgoing(State.PLAY, 0x0C, 0x0C, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x0C, 0x0C, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper ->
|
||||
val entityId = packetWrapper.passthrough(Type.VAR_INT) //Entity Id
|
||||
@ -203,7 +203,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Set Experience
|
||||
this.registerOutgoing(State.PLAY, 0x1F, 0x1F, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x1F, 0x1F, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.FLOAT) //Experience bar
|
||||
map(Type.SHORT, Type.VAR_INT) //Level
|
||||
@ -213,7 +213,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
|
||||
|
||||
//Player List Item
|
||||
this.registerOutgoing(State.PLAY, 0x38, 0x38, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x38, 0x38, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper ->
|
||||
val name = packetWrapper.read(Type.STRING)
|
||||
@ -278,7 +278,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Scoreboard Objective
|
||||
this.registerOutgoing(State.PLAY, 0x3B, 0x3B, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x3B, 0x3B, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.STRING) // name
|
||||
handler { packetWrapper ->
|
||||
@ -294,7 +294,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Update Score
|
||||
this.registerOutgoing(State.PLAY, 0x3C, 0x3C, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x3C, 0x3C, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper ->
|
||||
val name = packetWrapper.passthrough(Type.STRING)
|
||||
@ -312,7 +312,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Scoreboard Teams
|
||||
this.registerOutgoing(State.PLAY, 0x3E, 0x3E, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x3E, 0x3E, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.STRING)
|
||||
handler { packetWrapper ->
|
||||
@ -337,7 +337,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Custom Payload
|
||||
this.registerOutgoing(State.PLAY, 0x3F, 0x3F, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x3F, 0x3F, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.STRING)
|
||||
handler { packetWrapper ->
|
||||
@ -385,14 +385,14 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Keep Alive
|
||||
this.registerIncoming(State.PLAY, 0x00, 0x00, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x00, 0x00, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT, Type.INT)
|
||||
}
|
||||
})
|
||||
|
||||
//Custom Payload
|
||||
this.registerIncoming(State.PLAY, 0x17, 0x17, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x17, 0x17, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.STRING)
|
||||
handler { packetWrapper ->
|
||||
@ -434,7 +434,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Player Position
|
||||
this.registerIncoming(State.PLAY, 0x04, 0x04, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x04, 0x04, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.DOUBLE) //X
|
||||
handler { packetWrapper ->
|
||||
@ -447,7 +447,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Player Position And Look
|
||||
this.registerIncoming(State.PLAY, 0x06, 0x06, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x06, 0x06, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.DOUBLE) //X
|
||||
handler { packetWrapper ->
|
||||
@ -462,7 +462,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Animation
|
||||
this.registerIncoming(State.PLAY, 0x0A, 0x0A, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x0A, 0x0A, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
create { packetWrapper ->
|
||||
packetWrapper.write(Type.INT, 0) //Entity Id, hopefully 0 is ok
|
||||
@ -473,7 +473,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
|
||||
|
||||
//Client Settings
|
||||
this.registerIncoming(State.PLAY, 0x15, 0x15, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x15, 0x15, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.STRING)
|
||||
map(Type.BYTE)
|
||||
@ -488,7 +488,7 @@ fun Protocol1_8To1_7_6.registerPlayerPackets() {
|
||||
})
|
||||
|
||||
//Tab-Complete
|
||||
this.registerIncoming(State.PLAY, 0x14, 0x14, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x14, 0x14, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper ->
|
||||
val text = packetWrapper.read(Type.STRING)
|
||||
|
@ -17,21 +17,21 @@ import kotlin.experimental.and
|
||||
|
||||
fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
//Chunk Data
|
||||
this.registerOutgoing(State.PLAY, 0x21, 0x21, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x21, 0x21, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper -> ChunkPacketTransformer.transformChunk(packetWrapper) }
|
||||
}
|
||||
})
|
||||
|
||||
//Multi Block Change
|
||||
this.registerOutgoing(State.PLAY, 0x22, 0x22, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x22, 0x22, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper -> ChunkPacketTransformer.transformMultiBlockChange(packetWrapper) }
|
||||
}
|
||||
})
|
||||
|
||||
//Block Change
|
||||
this.registerOutgoing(State.PLAY, 0x23, 0x23, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x23, 0x23, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(xyzUBytePos, TypeRemapper(Type.POSITION)) //Position
|
||||
handler { packetWrapper ->
|
||||
@ -43,7 +43,7 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
})
|
||||
|
||||
//Block Action
|
||||
this.registerOutgoing(State.PLAY, 0x24, 0x24, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x24, 0x24, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(xyzShortPos, TypeRemapper(Type.POSITION)) //Position
|
||||
map(Type.UNSIGNED_BYTE)
|
||||
@ -53,7 +53,7 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
})
|
||||
|
||||
//Block Break Animation
|
||||
this.registerOutgoing(State.PLAY, 0x25, 0x25, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x25, 0x25, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT) //Entity Id
|
||||
map(xyzToPosition, TypeRemapper(Type.POSITION)) //Position
|
||||
@ -62,14 +62,14 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
})
|
||||
|
||||
//Map Chunk Bulk
|
||||
this.registerOutgoing(State.PLAY, 0x26, 0x26, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x26, 0x26, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper -> ChunkPacketTransformer.transformChunkBulk(packetWrapper) }
|
||||
}
|
||||
})
|
||||
|
||||
//Effect
|
||||
this.registerOutgoing(State.PLAY, 0x28, 0x28, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x28, 0x28, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.INT) // id
|
||||
map(xyzUBytePos, TypeRemapper(Type.POSITION))
|
||||
@ -84,7 +84,7 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
})
|
||||
|
||||
//Particle
|
||||
this.registerOutgoing(State.PLAY, 0x2A, 0x2A, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x2A, 0x2A, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
handler { packetWrapper ->
|
||||
val parts = packetWrapper.read(Type.STRING).split("_").toTypedArray()
|
||||
@ -121,7 +121,7 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
})
|
||||
|
||||
//Update Sign
|
||||
this.registerOutgoing(State.PLAY, 0x33, 0x33, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x33, 0x33, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(xyzShortPos, TypeRemapper(Type.POSITION)) //Position
|
||||
handler { packetWrapper ->
|
||||
@ -136,7 +136,7 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
})
|
||||
|
||||
//Update Block Entity
|
||||
this.registerOutgoing(State.PLAY, 0x35, 0x35, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x35, 0x35, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(xyzShortPos, TypeRemapper(Type.POSITION)) //Position
|
||||
map(Type.UNSIGNED_BYTE) //Action
|
||||
@ -145,7 +145,7 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
})
|
||||
|
||||
//Map
|
||||
this.registerOutgoing(State.PLAY, 0x34, 0x34, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x34, 0x34, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT)
|
||||
handler { packetWrapper ->
|
||||
@ -198,7 +198,7 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
})
|
||||
|
||||
//Open Sign Editor
|
||||
this.registerOutgoing(State.PLAY, 0x36, 0x36, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x36, 0x36, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(xyzToPosition, TypeRemapper(Type.POSITION)) //Position
|
||||
}
|
||||
@ -206,7 +206,7 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
|
||||
|
||||
//Player Digging
|
||||
this.registerIncoming(State.PLAY, 0x07, 0x07, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x07, 0x07, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.UNSIGNED_BYTE, Type.BYTE) //Status
|
||||
map(TypeRemapper(Type.POSITION), xyzUBytePosWriter)
|
||||
@ -215,7 +215,7 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
})
|
||||
|
||||
//Player Block Placement
|
||||
this.registerIncoming(State.PLAY, 0x08, 0x08, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x08, 0x08, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(TypeRemapper(Type.POSITION), xyzUBytePosWriter)
|
||||
map(Type.UNSIGNED_BYTE)
|
||||
@ -247,7 +247,7 @@ fun Protocol1_8To1_7_6.registerWorldPackets() {
|
||||
})
|
||||
|
||||
//Update Sign
|
||||
this.registerIncoming(State.PLAY, 0x12, 0x12, object : PacketRemapper() {
|
||||
this.registerServerbound(State.PLAY, 0x12, 0x12, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(TypeRemapper(Type.POSITION), xyzShortPosWriter)
|
||||
handler { packetWrapper ->
|
||||
|
@ -11,14 +11,14 @@ import com.viaversion.viaversion.api.protocol.packet.State
|
||||
object Protocol1_7_6to1_7_2 : AbstractSimpleProtocol() {
|
||||
override fun registerPackets() {
|
||||
//Login Success
|
||||
this.registerOutgoing(State.LOGIN, 0x02, 0x02, object : PacketRemapper() {
|
||||
this.registerClientbound(State.LOGIN, 0x02, 0x02, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.STRING, INSERT_DASHES)
|
||||
}
|
||||
})
|
||||
|
||||
//Spawn Player
|
||||
this.registerOutgoing(State.PLAY, 0x0C, 0x0C, object : PacketRemapper() {
|
||||
this.registerClientbound(State.PLAY, 0x0C, 0x0C, object : PacketRemapper() {
|
||||
override fun registerMap() {
|
||||
map(Type.VAR_INT)
|
||||
map(Type.STRING, INSERT_DASHES)
|
||||
|
Loading…
Reference in New Issue
Block a user