func sendPacket(pk lav7.Packet) { sendFromFields(0x80, raknet.Fields{ "seqNumber": lastSeq, "packets": []*raknet.EncapsulatedPacket{ raknet.NewEncapsulated( func() *buffer.Buffer { buf := buffer.FromBytes([]byte{pk.Pid()}) buf.Append(pk.Write()) return buf }(), ), }, }) lastSeq++ }
func sendCompressed(pk lav7.Packet) { b := append([]byte{pk.Pid()}, pk.Write().Done()...) sendPacket(&lav7.Batch{ Payloads: [][]byte{b}, }) }