mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-27 17:55:45 -05:00
Add basic deserializer and serializer typings (#975)
This commit is contained in:
parent
68e6400e30
commit
5e3196b2de
1 changed files with 21 additions and 0 deletions
21
src/index.d.ts
vendored
21
src/index.d.ts
vendored
|
@ -4,6 +4,7 @@ import { EventEmitter } from 'events';
|
|||
import { Socket } from 'net'
|
||||
import * as Stream from 'stream'
|
||||
import { Agent } from 'http'
|
||||
import { Transform } from "readable-stream";
|
||||
|
||||
type PromiseLike = Promise<void> | void
|
||||
|
||||
|
@ -17,6 +18,8 @@ declare module 'minecraft-protocol' {
|
|||
username: string
|
||||
session?: SessionOption
|
||||
profile?: any
|
||||
deserializer: FullPacketParser
|
||||
serializer: Serializer
|
||||
latency: number
|
||||
customPackets: any
|
||||
protocolVersion: number
|
||||
|
@ -51,6 +54,24 @@ declare module 'minecraft-protocol' {
|
|||
once(event: `raw.${string}`, handler: (buffer: Buffer, packetMeta: PacketMeta) => PromiseLike): this
|
||||
}
|
||||
|
||||
class FullPacketParser extends Transform {
|
||||
proto: any
|
||||
mainType: any
|
||||
noErrorLogging: boolean
|
||||
constructor (proto: any, mainType: any, noErrorLogging?: boolean)
|
||||
|
||||
parsePacketBuffer(buffer: Buffer): any
|
||||
}
|
||||
|
||||
class Serializer extends Transform {
|
||||
proto: any
|
||||
mainType: any
|
||||
queue: Buffer
|
||||
constructor(proto: any, mainType: any)
|
||||
|
||||
createPacketBuffer(packet: any): any
|
||||
}
|
||||
|
||||
export interface SessionOption {
|
||||
accessToken: string,
|
||||
/** My be needed for mojang auth. Is send by mojang on username + password auth */
|
||||
|
|
Loading…
Reference in a new issue