syntax = "proto3"; package proto; // STRUCTS message angles { float pitch = 1; float yaw = 2; } message coords { int32 x = 1; int32 z = 2; } message vec3 { float x = 1; float y = 2; float z = 3; } message ivec3 { int32 x = 1; int32 y = 2; int32 z = 3; } message player { uint32 index = 1; uint32 commands = 2; coords chunk_pos = 3; vec3 local_pos = 4; angles viewangles = 5; vec3 velocity = 6; } // END OF STRUCTS // PACKETS message auth { string username = 1; string password = 2; } message init { uint64 seed = 1; int32 draw_distance = 2; player localplayer = 3; } message move { uint32 commands = 1; angles viewangles = 2; } message remove_player { uint32 index = 1; } message say { string text = 1; } message hear_player { uint32 index = 1; string text = 2; } message request_chunk { coords chunk_pos = 1; } message remove_chunk { coords chunk_pos = 1; } message chunk { coords chunk_pos = 1; // There is no uint8, so we have to pack four blocks into each uint32. repeated uint32 blocks = 2 [packed = true]; } message add_block { coords chunk_pos = 1; ivec3 block_pos = 2; // A bit inefficient as we only need 8 bits. We could use the rest for other // stuff down the road. uint32 block = 3; } message remove_block { coords chunk_pos = 1; ivec3 block_pos = 2; } message server_message { string message = 1; bool fatal = 2; } // END OF PACKETS // Actual thing we read. message packet { oneof contents { auth auth_packet = 1; init init_packet = 2; move move_packet = 3; player player_packet = 4; remove_player remove_player_packet = 5; say say_packet = 6; hear_player hear_player_packet = 7; request_chunk request_chunk_packet = 8; chunk chunk_packet = 9; remove_chunk remove_chunk_packet = 10; add_block add_block_packet = 11; remove_block remove_block_packet = 12; server_message server_message_packet = 13; } }