292 lines
6.8 KiB
Plaintext
292 lines
6.8 KiB
Plaintext
{
|
|
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_view
|
|
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
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
|
|
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]
|
|
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |