blob: 10af7d0d02ad311d08872da69d0b2f832bad101e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package moe.nea.firmament.apis.ingame
import io.netty.buffer.ByteBuf
import net.minecraft.network.codec.PacketCodec
import net.minecraft.network.packet.CustomPayload
import net.minecraft.util.Identifier
interface FirmamentCustomPayload : CustomPayload {
class Unhandled private constructor(val identifier: Identifier) : FirmamentCustomPayload {
override fun getId(): CustomPayload.Id<out CustomPayload> {
return CustomPayload.id(identifier.toString())
}
companion object {
fun <B : ByteBuf> createCodec(identifier: Identifier): PacketCodec<B, Unhandled> {
return object : PacketCodec<B, Unhandled> {
override fun decode(buf: B): Unhandled {
return Unhandled(identifier)
}
override fun encode(buf: B, value: Unhandled) {
// we will never send an unhandled packet stealthy
}
}
}
}
}
}
|