You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

385 lines
9.9 KiB

{
types:
{
varint: {
// native type
type: int32_t
// this is the max size. varint is 3 to 5
size: 5
// R/W: ReadVarInt, WriteVarInt
method: VarInt
// Alias types use ReadVarInt<T>
generic: true
}
ProtocolState: {
alias: varint
}
string: {
type: std::string
clientbound: {type: 'const std::string&'}
method: String
// requires count: e.g. string[256]
// generated C type will not be an array
size: count
}
uuid: {
type: MinecraftUUID
size: 16
}
position: {
type: BlockPos
size: 8
method: Position
}
direction: {
type: Direction
size: 1
alias: varint
}
uint64: {type: 'uint64_t', size: 8}
int64: {type: 'int64_t', size: 8}
uint32: {type: 'uint32_t', size: 4}
int32: {type: 'int32_t', size: 4}
uint16: {type: 'uint16_t', size: 2}
int16: {type: 'int16_t', size: 2}
uint8: {type: 'uint8_t', size: 1}
int8: {type: 'int8_t', size: 1}
byte: {type: 'uint8_t', size: 1}
// if no native type is specified,
// it's assumed to be the type's name
bool: {size: 1}
float: {size: 4}
double: {size: 8}
}
states :
{
Handholding : -1
Play : 0
Status : 1
Login : 2
}
messages :
{
handholding :
{
serverbound :
{
Handshake :
{
id : 0
vars :
{
protocolVersion : varint
serverIP : string[255]
port : uint16
intention : ProtocolState
}
}
}
}
status :
{
clientbound :
{
Response :
{
id : 0
vars :
{
jsonResponse : string[32767]
}
}
Pong :
{
id : 1
vars :
{
timestamp : uint64
}
}
}
serverbound :
{
Request :
{
id : 0
vars :
{
}
}
Ping :
{
id : 1
vars :
{
timestamp : uint64
}
}
}
}
login :
{
clientbound :
{
Disconnect :
{
id : 0
vars :
{
reason : string[32767]
}
}
Success :
{
id : 2
vars :
{
uuid : string[32]
username : string[16]
}
}
}
serverbound :
{
Start :
{
id : 0
vars :
{
username : string[16]
}
}
}
}
play :
{
serverbound:
{
ChatMessage:
{
id : 0x03
vars :
{
message : string[256]
}
}
KeepAlive:
{
id : 0x0F
vars :
{
id : int64
}
}
PlayerAction: {
id: 0x1A
enums: {
Action: {
.type: varint
StartBreakBlock: 0
AbortBreakBlock: 1
FinishedBreakBlock: 2
DropItemStack: 3
DropItem: 4
ReleaseUseItem: 5 # shoot array, finished eating, etc
SwapItemHands: 6
}
}
vars: {
action: Action
pos: position
direction: direction
}
}
}
clientbound :
{
ChatMessage:
{
id : 0x0F
vars :
{
jsonData : string[32767]
position : uint8
}
}
JoinGame :
{
id : 38
vars :
{
entityId : int32
gamemode : uint8
dimension : int32
seedHash : uint64
maxPlayers : uint8
levelType : string[16]
viewDistance : varint
reducedDebugInfo : bool
enableRespawnScreen : bool
}
}
KeepAlive:
{
id: 0x21
vars: {
id: int64
}
}
ChunkData:
{
id: 0x22
vars: {
chunkX: int32
chunkZ: int32
fullChunk: bool
// bitmask for each 16x16x16 chunk section
// LSB: section at y=0, bits for up to y=15
chunkSections: varint
//heightmaps: nbt
// only if fullChunk == true
biomes(fullChunk?): int32[1024]
dataSize: varint
data: byte[dataSize]
//numBlockEntities: varint
//blockEntities: nbt[numBlockEntities]
}
}
PlayerInfo: {
id: 0x34
enums: {
Action: {
.type: varint
AddPlayer: 0
UpdateGamemode: 1
UpdateLatency: 2
UpdateDisplayName: 3
RemovePlayer: 4
}
# this could be a global enum
Gamemode: {
.type: varint
Survival: 0,
Creative: 1,
Adventure: 2,
Spectator: 3
}
}
vars: {
action: Action
numPlayers: varint
players(#numPlayers): {
uuid: uuid
.switch(action): {
AddPlayer: {
name: string[16]
numProps: varint
properties(#numProps): {
name: string[32767]
value: string[32767]
isSigned: bool
signature(isSigned?): string[32767]
}
gamemode: Gamemode
ping: varint
//hasDisplayName: bool
//displayName(hasDisplayName?): chat
}
UpdateGamemode: {
gamemode: Gamemode
}
UpdateLatency: {
# in ms
ping: varint
}
UpdateDisplayName: {
//hasDisplayName: bool
//displayName(hasDisplayName?): chat
}
RemovePlayer: {}
}
}
}
}
PlayerPositionAndLook:
{
id: 0x36
enums: {
RelativeFlags: {
.type: byte
X: 1,
Y: 2,
Z: 4,
Y_ROT: 8,
X_ROT: 16,
}
}
vars: {
x: double
y: double
z: double
// xRot is yaw, yRot is pitch
xRot: float
yRot: float
flags: RelativeFlags
id: varint
}
}
SpawnPosition:
{
id: 0x4E
vars: {
location: position
}
}
}
}
}
}