<commit_before>#ifndef MCPR_PACKET_H
#define MCPR_PACKET_H

#include <stdbool.h>
#include <stdint.h>

#include <jansson/jansson.h>

#include "mcpr.h"

#define MCPR_PKT_HS_SB_HANDSHAKE 0x00;

enum mcpr_entity_property_modifier_operation
{
    MCPR_ENTITY_PROPERTY_MODIFIER_OPERATION_ADD_SUBTRACT,
    MCPR_ENTITY_PROPERTY_MODIFIER_OPERATION_ADD_SUBTRACT_PERCENT,
    MCPR_ENTITY_PROPERTY_MODIFIER_OPERATION_MULTIPLY_PERCENT
};

struct mcpr_entity_property_modifier
{
    struct mcpr_uuid uuid;
    double amount;
    enum mcpr_entity_property_modifier_operation operation;
};

struct mcpr_entity_property
{
    enum mcpr_entity_property_key key;
    double value;
    int32_t number_of_modifiers;
    struct mcpr_entity_property_modifier *modifiers;
};

enum mcpr_sound_category
{
    MCPR_SOUND_CATEGORY_MASTER,
    MCPR_SOUND_CATEGORY_MUSIC,
    MCPR_SOUND_CATEGORY_RECORD,
    MCPR_SOUND_CATEGORY_WEATHER,
    MCPR_SOUND_CATEGORY_BLOCK,
    MCPR_SOUND_CATEGORY_HOSTILE,
    MCPR_SOUND_CATEGORY_NEUTRAL,
    MCPR_SOUND_CATEGORY_PLAYER,
    MCPR_SOUND_CATEGORY_AMBIENT,
    MCPR_SOUND_CATEGORY_VOICE
};

enum mcpr_title_action
{
    MCPR_TITLE_ACTION_SET_TITLE,
    MCPR_TITLE_ACTION_SET_SUBTITLE,
    MCPR_TITLE_ACTION_SET_ACTION_BAR,
    MCPR_TITLE_ACTION_SET_TIMES_AND_DISPLAY,
    MCPR_TITLE_ACTION_HIDE,
    MCPR_TITLE_ACTION_RESET
};

enum mcpr_update_score_action
{
    MCPR_UPDATE_SCORE_ACTION_REMOVE,
    MCPR_UPDATE_SCORE_ACTION_UPDATE
};

enum mcpr_teams_action
{
    MCPR_TEAMS_ACTION_CREATE,
    MCPR_TEAMS_ACTION_UPDATE_INFO,
    MCPR_TEAMS_ACTION_ADD_PLAYERS,
    MCPR_TEAMS_ACTION_REMOVE_PLAYERS
};

enum mcpr_scoreboard_objective_mode
{
    MCPR_SCOREBOARD_OBJECTIVE_MODE_CREATE,
    MCPR_SCOREBOARD_OBJECTIVE_MODE_REMOVE,
    MCPR_SCOREBOARD_OBJECTIVE_MODE_UPDATE
};

enum mcpr_scoreboard_position
{
    MCPR_SCOREBOARD_POSITION_LIST,
    MCPR_SCOREBOARD_POSITION_SIDEBAR,
    MCPR_SCOREBOARD_POSITION_BELOW_NAME
};

enum mcpr_world_border_action
{
    MCPR_WORLD_BORDER_ACTION_SET_SIZE,
    MCPR_WORLD_BORDER_ACTION_LERP_SIZE,
    MCPR_WORLD_BORDER_ACTION_SET_CENTER,
    MCPR_WORLD_BORDER_ACTION_INITIALIZE,
    MCPR_WORLD_BORDER_ACTION_SET_WARNING_TIME,
    MCPR_WORLD_BORDER_ACTION_SET_WARNING_BLOCKS,
};


enum mcpr_gamemode
{
    MCPR_GAMEMODE_SURVIVAL,
    MCPR_GAMEMODE_CREATIVE,
    MCPR_GAMEMODE_ADVENTURE,
    MCPR_GAMEMODE_SPECTATOR,
};

enum mcpr_level
{
    MCPR_LEVEL_DEFAULT,
    MCPR_LEVEL_FLAT,
    MCPR_LEVEL_LARGE_BIOMES,
    MCPR_LEVEL_AMPLIFIED,
    MCPR_LEVEL_DEFAULT_1_1
};

enum mcpr_player_list_item_action
{
    MCPR_PLAYER_LIST_ITEM_ACTION_ADD_PLAYER,
    MCPR_PLAYER_LIST_ITEM_ACTION_UPDATE_GAMEMODE,
    MCPR_PLAYER_LIST_ITEM_ACTION_UPDATE_LATENCY,
    MCPR_PLAYER_LIST_ITEM_ACTION_UPDATE_DISPLAY_NAME,
    MCPR_PLAYER_LIST_ITEM_ACTION_REMOVE_PLAYER
};

struct mcpr_player_list_item_property
{
    char *name;
    char *value;
    bool is_signed;
    char *signature; // Optional, only if is_signed is true
};

struct mcpr_player_list_item_player
{
    struct mcpr_uuid uuid;

    struct
    {
        char *name;
        int32_t number_of_properties;
        struct mcpr_player_list_item_property *properties;
    } action_add_player;

    struct
    {
        enum mcpr_gamemode gamemode;
    } action_update_gamemode;

    struct
    {
        int32_t ping;
    } action_update_latency;

    struct
    {
        bool has_display_name;
        json_t display_name; // Optional, only if has_display_name is true.
    } action_update_display_name;
};

enum mcpr_effect
{
    MCPR_EFFECT_DISPENSER_DISPENSE,
    MCPR_EFFECT_DISPENSER_DISPENSE_FAILED,
    MCPR_EFFECT_DISPENSER_SHOOT,
    MCPR_EFFECT_ENDER_EYE_LAUNCH,
    MCPR_EFFECT_FIREWORK_SHOT,
    MCPR_EFFECT_IRON_DOOR_OPEN,
    MCPR_EFFECT_WOODEN_DOOR_OPEN,
    MCPR_EFFECT_WOODEN_TRAPDOOR_OPEN,
    MCPR_EFFECT_FENCE_GATE_OPEN,
    MCPR_EFFECT_FIRE_EXTINGUISH,
    MCPR_EFFECT_PLAY_RECORD,
    MCPR_EFFECT_IRON_DOOR_CLOSE,
    MCPR_EFFECT_WOODEN_DOOR_CLOSE,
    MCPR_EFFECT_WOODEN_TRAPDOOR_CLOSE,
    MCPR_EFFECT_FENCE_GATE_CLOSE,
    MCPR_EFFECT_GHAST_WARN,
    MCPR_EFFECT_GHAST_SHOOT,
    MCPR_EFFECT_ENDERDRAGON_SHOOT,
    MCPR_EFFECT_BLAZE_SHOOT,
    MCPR_EFFECT_ZOMBIE_ATTACK_WOOD_DOOR,
    MCPR_EFFECT_ZOMBIE_ATTACK_IRON_DOOR,
    MCPR_EFFECT_ZOMBIE_BREAK_WOOD_DOOR,
    MCPR_EFFECT_WITHER_BREAK_BLOCK,
    MCPR_EFFECT_WITHER_SPAWN,
    MCPR_EFFECT_WITHER_SHOOT,
    MCPR_EFFECT_BAT_TAKEOFF,
    MCPR_EFFECT_ZOMBIE_INFECT,
    MCPR_EFFECT_ZOMBIE_VILLAGER_CONVERT,
    MCPR_EFFECT_ENDERDRAGON_DEATH,
    MCPR_EFFECT_ANVIL_DESTROY,
    MCPR_EFFECT_ANVIL_USE,
    MCPR_EFFECT_ANVIL_LAND,
    MCPR_EFFECT_PORTAL_TRAVEL,
    MCPR_EFFECT_CHORUS_FLOWER_GROW,
    MCPR_EFFECT_CHORUS_FLOWER_DIE,
    MCPR_EFFECT_BREWING_STAND_BREW,
    MCPR_EFFECT_IRON_TRAPDOOR_OPEN,
    MCPR_EFFECT_IRON_TRAPDOOR_CLOSE,
    MCPR_EFFECT_SPAWN_10_SMOKE_PARTICLES, // For example for fires.
    MCPR_EFFECT_BLOCK_BREAK,
    MCPR_EFFECT_SPLASH_POTION,
    MCPR_EFFECT_EYE_OF_ENDER_BREAK,
    MCPR_EFFECT_MOB_SPAWN_PARTICLE,
    MCPR_EFFECT_BONEMEAL_PARTICLES,
    MCPR_EFFECT_DRAGON_BREATH,
    MCPR_EFFECT_END_GATEWAY_SPAWN,
    MCPR_EFFECT_ENDERDRAGON_GROWL
};

enum mcpr_particle
{
    MCPR_PARTICLE_EXPLODE,
    MCPR_PARTICLE_LARGE_EXPLOSION,
    MCPR_PARTICLE_HUGE_EXPLOSION,
    MCPR_PARTICLE_FIREWORKS_SPARK,
    MCPR_PARTICLE_BUBBLE,
    MCPR_PARTICLE_SPLASH,
    MCPR_PARTICLE_WAKE,
    MCPR_PARTICLE_SUSPENDED,
    MCPR_PARTICLE_DEPTH_SUSPEND,
    MCPR_PARTICLE_CRIT,
    MCPR_PARTICLE_MAGIC_CRIT,
    MCPR_PARTICLE_SMOKE,
    MCPR_PARTICLE_LARGE_SMOKE,
    MCPR_PARTICLE_SPELL,
    MCPR_PARTICLE_INSTANT_SPELL,
    MCPR_PARTICLE_MOB_SPELL,
    MCPR_PARTICLE_MOB_SPELL_AMBIENT,
    MCPR_PARTICLE_WITCH_MAGIC,
    MCPR_PARTICLE_DRIP_WATER,
    MCPR_PARTICLE_DRIP_LAVA,
    MCPR_PARTICLE_ANGRY_VILLAGER,
    MCPR_PARTICLE_HAPPY_VILLAGER,
    MCPR_PARTICLE_TOWN_AURA,
    MCPR_PARTICLE_NOTE,
    MCPR_PARTICLE_PORTAL,
    MCPR_PARTICLE_ENCHANTMENT_TABLE,
    MCPR_PARTICLE_FLAME,
    MCPR_PARTICLE_LAVA,
    MCPR_PARTICLE_FOOTSTEP,
    MCPR_PARTICLE_CLOUD,
    MCPR_PARTICLE_RED_DUST,
    MCPR_PARTICLE_SNOWBALL_PROOF,
    MCPR_PARTICLE_SNOW_SHOVEL,
    MCPR_PARTICLE_SLIME,
    MCPR_PARTICLE_HEART,
    MCPR_PARTICLE_BARRIER,
    MCPR_PARTICLE_IRON_CRACK,
    MCPR_PARTICLE_BLOCK_CRACK,
    MCPR_PARTICLE_BLOCK_DUST,
    MCPR_PARTICLE_DROPLET,
    MCPR_PARTICLE_TAKE,
    MCPR_PARTICLE_MOB_APPEARANCE,
    MCPR_PARTICLE_DRAGON_BREATH,
    MCPR_PARTICLE_END_ROD,
    MCPR_PARTICLE_DAMAGE_INDICATOR,
    MCPR_PARTICLE_SWEEP_ATTACK,
    MCPR_PARTICLE_FALING_DUST
};

enum mcpr_difficulty
{
    MCPR_DIFFICULTY_PEACEFUL,
    MCPR_DIFFICULTY_EASY,
    MCPR_DIFFICULTY_NORMAL,
    MCPR_DIFFICULTY_HARD
};

enum mcpr_chat_position
{
    MCPR_CHAT_POSITION_CHAT,
    MCPR_CHAT_POSITION_SYSTEM,
    MCPR_CHAT_POSITION_HOTBAR
};

struct mcpr_multi_block_change
{
    uint8_t horizontal_position_x;
    uint8_t horizontal_position_z;
    uint8_t y_coordinate;
    int32_t block_id;
};

struct mcpr_explosion_record
{
    int8_t x, y, z;
};

enum mcpr_map_icon
{
    MCPR_MAP_ICON_WHITE_ARROW,
    MCPR_MAP_ICON_GREEN_ARROW,
    MCPR_MAP_ICON_RED_ARROW,
    MCPR_MAP_ICON_BLUE_ARROW,
    MCPR_MAP_ICON_WHITE_CROSS,
    MCPR_MAP_ICON_RED_POINTER,
    MCPR_MAP_ICON_WHITE_CIRCLE,
    MCPR_MAP_ICON_SMALL_WHITE_CIRCLE,
    MCPR_MAP_ICON_MANSION,
    MCPR_MAP_ICON_TEMPLE,
};

struct mcpr_map_icon
{
    uint8_t direction;
    enum mcpr_map_icon type;
    int8_t x, z;
};

enum mcpr_combat_event
{
    MCPR_COMBAT_EVENT_ENTER_COMBAT,
    MCPR_COMBAT_EVENT_END_COMBAT,
    MCPR_COMBAT_EVENT_ENTITY_DEAD
};

struct mcpr_packet
{
    int8_t id;
    union
    {
        struct // handshake
        {
            union // handshake - serverbound
            {
                struct
                {
                    int32_t protocol_version;
                    char *server_address;
                    uint16_t server_port;
                    enum mcpr_state next_state;
                } handshake;
            } serverbound;

            union // handshake - clientbound
            {

            } clientbound;
        } handshake;

        struct // login
        {
            union // login - serverbound
            {
                struct
                {
                    char *name;
                } login_start;

                struct
                {
                    int32_t shared_secret_length;
                    void *shared_secret;
                    int32_t verify_token_length;
                    void *verify_token;
                } encryption_response;
            } serverbound;

            union // login - clientbound
            {
                struct
                {
                    struct mcpr_chat_message reason;
                } disconnect;

                struct
                {
                    char *server_id;
                    int32_t public_key_length;
                    void *public_key;
                    int32_t verify_token_length;
                    void *verify_token;
                } encryption_request;

                struct
                {
                    struct mcpr_uuid uuid;
                    char *username;
                } login_success;

                struct
                {
                    int32_t threshold;
                } set_compression;
            } clientbound;
        } login;

        struct // status
        {
            union // status - serverbound
            {
                struct
                {

                } request;

                struct
                {
                    int64_t payload;
                } ping;
            } serverbound;

            union // status - clientbound
            {
                struct
                {
                int64_t payload;
                } pong;

                struct
                {
                    json_t json_response;
                } response;
            } clientbound;
        } status;

        struct { // play
            union // play - serverbound
            {

            } serverbound;

            union // play - clientbound
            {
                struct
                {
                    int32_t entity_id;
                    struct mcpr_uuid uuid;
                    enum mcpr_object type;
                    double x, y, z;
                    uint8_t pitch;
                    uint8_t yaw;
                    int32_t data;<commit_msg>Add all play - serverbound packets<commit_after>#ifndef MCPR_PACKET_H
#define MCPR_PACKET_H

#include <stdbool.h>
#include <stdint.h>

#include <jansson/jansson.h>

#include "mcpr.h"

#define MCPR_PKT_HS_SB_HANDSHAKE 0x00;

enum mcpr_resource_pack_result
{
    MCPR_RESOURCE_PACK_RESULT_SUCCESS,
    MCPR_RESOURCE_PACK_RESULT_DECLINED,
    MCPR_RESOURCE_PACK_RESULT_FAILED,
    MCPR_RESOURCE_PACK_RESULT_ACCEPTED
};

enum mcpr_entity_action
{
    MCPR_ENTITY_ACTION_START_SNEAKING,
    MCPR_ENTITY_ACTION_STOP_SNEAKING,
    MCPR_ENTITY_ACTION_LEAVE_BED,
    MCPR_ENTITY_ACTION_START_SPRINTING,
    MCPR_ENTITY_ACTION_STOP_SPRINTING,
    MCPR_ENTITY_ACTION_START_HORSE_JUMP,
    MCPR_ENTITY_ACTION_STOP_HORSE_JUMP,
    MCPR_ENTITY_ACTION_OPEN_HORSE_INVENTORY,
    MCPR_ENTITY_ACTION_START_ELYTRA_FLYING
};

enum mcpr_player_digging_status
{
    MCPR_PLAYER_DIGGING_STATUS_STARTED,
    MCPR_PLAYER_DIGGING_STATUS_CANCELLED,
    MCPR_PLAYER_DIGGING_STATUS_FINISHED,
    MCPR_PLAYER_DIGGING_STATUS_DROP_ITEM_STACK,
    MCPR_PLAYER_DIGGING_STATUS_DROP_ITEM,
    MCPR_PLAYER_DIGGING_STATUS_SHOOT_ARROW_FINISH_EATING,
    MCPR_PLAYER_DIGGING_STATUS_SWAP_ITEM_IN_HAND
};

enum mcpr_block_face
{
    MCPR_BLOCK_FACE_TOP,
    MCPR_BLOCK_FACE_BOTTOM,
    MCPR_BLOCK_FACE_NORTH,
    MCPR_BLOCK_FACE_SOUTH,
    MCPR_BLOCK_FACE_WEST,
    MCPR_BLOCK_FACE_EAST,
    MCPR_BLOCK_FACE_SPECIAL
};

enum mcpr_side_based_hand
{
    MCPR_HAND_RIGHT,
    MCPR_HAND_LEFT
};

enum mcpr_hand
{
    MCPR_HAND_MAIN,
    MCPR_HAND_OFFHAND,
};

enum mcpr_chat_mode
{
    MCPR_CHAT_MODE_ENABLED,
    MCPR_CHAT_MODE_COMMANDS_ONLY,
    MCPR_CHAT_MODE_HIDDEN
};

enum mcpr_client_status_action
{
    MCPR_CLIENT_STATUS_ACTION_PERFORM_RESPAWN,
    MCPR_CLIENT_STATUS_ACTION_REQUEST_STATS,
    MCPR_CLIENT_STATUS_ACTION_OPEN_INVENTORY
};

enum mcpr_entity_property_modifier_operation
{
    MCPR_ENTITY_PROPERTY_MODIFIER_OPERATION_ADD_SUBTRACT,
    MCPR_ENTITY_PROPERTY_MODIFIER_OPERATION_ADD_SUBTRACT_PERCENT,
    MCPR_ENTITY_PROPERTY_MODIFIER_OPERATION_MULTIPLY_PERCENT
};

struct mcpr_entity_property_modifier
{
    struct mcpr_uuid uuid;
    double amount;
    enum mcpr_entity_property_modifier_operation operation;
};

struct mcpr_entity_property
{
    enum mcpr_entity_property_key key;
    double value;
    int32_t number_of_modifiers;
    struct mcpr_entity_property_modifier *modifiers;
};

enum mcpr_sound_category
{
    MCPR_SOUND_CATEGORY_MASTER,
    MCPR_SOUND_CATEGORY_MUSIC,
    MCPR_SOUND_CATEGORY_RECORD,
    MCPR_SOUND_CATEGORY_WEATHER,
    MCPR_SOUND_CATEGORY_BLOCK,
    MCPR_SOUND_CATEGORY_HOSTILE,
    MCPR_SOUND_CATEGORY_NEUTRAL,
    MCPR_SOUND_CATEGORY_PLAYER,
    MCPR_SOUND_CATEGORY_AMBIENT,
    MCPR_SOUND_CATEGORY_VOICE
};

enum mcpr_title_action
{
    MCPR_TITLE_ACTION_SET_TITLE,
    MCPR_TITLE_ACTION_SET_SUBTITLE,
    MCPR_TITLE_ACTION_SET_ACTION_BAR,
    MCPR_TITLE_ACTION_SET_TIMES_AND_DISPLAY,
    MCPR_TITLE_ACTION_HIDE,
    MCPR_TITLE_ACTION_RESET
};

enum mcpr_update_score_action
{
    MCPR_UPDATE_SCORE_ACTION_REMOVE,
    MCPR_UPDATE_SCORE_ACTION_UPDATE
};

enum mcpr_teams_action
{
    MCPR_TEAMS_ACTION_CREATE,
    MCPR_TEAMS_ACTION_UPDATE_INFO,
    MCPR_TEAMS_ACTION_ADD_PLAYERS,
    MCPR_TEAMS_ACTION_REMOVE_PLAYERS
};

enum mcpr_scoreboard_objective_mode
{
    MCPR_SCOREBOARD_OBJECTIVE_MODE_CREATE,
    MCPR_SCOREBOARD_OBJECTIVE_MODE_REMOVE,
    MCPR_SCOREBOARD_OBJECTIVE_MODE_UPDATE
};

enum mcpr_scoreboard_position
{
    MCPR_SCOREBOARD_POSITION_LIST,
    MCPR_SCOREBOARD_POSITION_SIDEBAR,
    MCPR_SCOREBOARD_POSITION_BELOW_NAME
};

enum mcpr_world_border_action
{
    MCPR_WORLD_BORDER_ACTION_SET_SIZE,
    MCPR_WORLD_BORDER_ACTION_LERP_SIZE,
    MCPR_WORLD_BORDER_ACTION_SET_CENTER,
    MCPR_WORLD_BORDER_ACTION_INITIALIZE,
    MCPR_WORLD_BORDER_ACTION_SET_WARNING_TIME,
    MCPR_WORLD_BORDER_ACTION_SET_WARNING_BLOCKS,
};


enum mcpr_gamemode
{
    MCPR_GAMEMODE_SURVIVAL,
    MCPR_GAMEMODE_CREATIVE,
    MCPR_GAMEMODE_ADVENTURE,
    MCPR_GAMEMODE_SPECTATOR,
};

enum mcpr_level
{
    MCPR_LEVEL_DEFAULT,
    MCPR_LEVEL_FLAT,
    MCPR_LEVEL_LARGE_BIOMES,
    MCPR_LEVEL_AMPLIFIED,
    MCPR_LEVEL_DEFAULT_1_1
};

enum mcpr_player_list_item_action
{
    MCPR_PLAYER_LIST_ITEM_ACTION_ADD_PLAYER,
    MCPR_PLAYER_LIST_ITEM_ACTION_UPDATE_GAMEMODE,
    MCPR_PLAYER_LIST_ITEM_ACTION_UPDATE_LATENCY,
    MCPR_PLAYER_LIST_ITEM_ACTION_UPDATE_DISPLAY_NAME,
    MCPR_PLAYER_LIST_ITEM_ACTION_REMOVE_PLAYER
};

struct mcpr_player_list_item_property
{
    char *name;
    char *value;
    bool is_signed;
    char *signature; // Optional, only if is_signed is true
};

struct mcpr_player_list_item_player
{
    struct mcpr_uuid uuid;

    struct
    {
        char *name;
        int32_t number_of_properties;
        struct mcpr_player_list_item_property *properties;
    } action_add_player;

    struct
    {
        enum mcpr_gamemode gamemode;
    } action_update_gamemode;

    struct
    {
        int32_t ping;
    } action_update_latency;

    struct
    {
        bool has_display_name;
        json_t display_name; // Optional, only if has_display_name is true.
    } action_update_display_name;
};

enum mcpr_effect
{
    MCPR_EFFECT_DISPENSER_DISPENSE,
    MCPR_EFFECT_DISPENSER_DISPENSE_FAILED,
    MCPR_EFFECT_DISPENSER_SHOOT,
    MCPR_EFFECT_ENDER_EYE_LAUNCH,
    MCPR_EFFECT_FIREWORK_SHOT,
    MCPR_EFFECT_IRON_DOOR_OPEN,
    MCPR_EFFECT_WOODEN_DOOR_OPEN,
    MCPR_EFFECT_WOODEN_TRAPDOOR_OPEN,
    MCPR_EFFECT_FENCE_GATE_OPEN,
    MCPR_EFFECT_FIRE_EXTINGUISH,
    MCPR_EFFECT_PLAY_RECORD,
    MCPR_EFFECT_IRON_DOOR_CLOSE,
    MCPR_EFFECT_WOODEN_DOOR_CLOSE,
    MCPR_EFFECT_WOODEN_TRAPDOOR_CLOSE,
    MCPR_EFFECT_FENCE_GATE_CLOSE,
    MCPR_EFFECT_GHAST_WARN,
    MCPR_EFFECT_GHAST_SHOOT,
    MCPR_EFFECT_ENDERDRAGON_SHOOT,
    MCPR_EFFECT_BLAZE_SHOOT,
    MCPR_EFFECT_ZOMBIE_ATTACK_WOOD_DOOR,
    MCPR_EFFECT_ZOMBIE_ATTACK_IRON_DOOR,
    MCPR_EFFECT_ZOMBIE_BREAK_WOOD_DOOR,
    MCPR_EFFECT_WITHER_BREAK_BLOCK,
    MCPR_EFFECT_WITHER_SPAWN,
    MCPR_EFFECT_WITHER_SHOOT,
    MCPR_EFFECT_BAT_TAKEOFF,
    MCPR_EFFECT_ZOMBIE_INFECT,
    MCPR_EFFECT_ZOMBIE_VILLAGER_CONVERT,
    MCPR_EFFECT_ENDERDRAGON_DEATH,
    MCPR_EFFECT_ANVIL_DESTROY,
    MCPR_EFFECT_ANVIL_USE,
    MCPR_EFFECT_ANVIL_LAND,
    MCPR_EFFECT_PORTAL_TRAVEL,
    MCPR_EFFECT_CHORUS_FLOWER_GROW,
    MCPR_EFFECT_CHORUS_FLOWER_DIE,
    MCPR_EFFECT_BREWING_STAND_BREW,
    MCPR_EFFECT_IRON_TRAPDOOR_OPEN,
    MCPR_EFFECT_IRON_TRAPDOOR_CLOSE,
    MCPR_EFFECT_SPAWN_10_SMOKE_PARTICLES, // For example for fires.
    MCPR_EFFECT_BLOCK_BREAK,
    MCPR_EFFECT_SPLASH_POTION,
    MCPR_EFFECT_EYE_OF_ENDER_BREAK,
    MCPR_EFFECT_MOB_SPAWN_PARTICLE,
    MCPR_EFFECT_BONEMEAL_PARTICLES,
    MCPR_EFFECT_DRAGON_BREATH,
    MCPR_EFFECT_END_GATEWAY_SPAWN,
    MCPR_EFFECT_ENDERDRAGON_GROWL
};

enum mcpr_particle
{
    MCPR_PARTICLE_EXPLODE,
    MCPR_PARTICLE_LARGE_EXPLOSION,
    MCPR_PARTICLE_HUGE_EXPLOSION,
    MCPR_PARTICLE_FIREWORKS_SPARK,
    MCPR_PARTICLE_BUBBLE,
    MCPR_PARTICLE_SPLASH,
    MCPR_PARTICLE_WAKE,
    MCPR_PARTICLE_SUSPENDED,
    MCPR_PARTICLE_DEPTH_SUSPEND,
    MCPR_PARTICLE_CRIT,
    MCPR_PARTICLE_MAGIC_CRIT,
    MCPR_PARTICLE_SMOKE,
    MCPR_PARTICLE_LARGE_SMOKE,
    MCPR_PARTICLE_SPELL,
    MCPR_PARTICLE_INSTANT_SPELL,
    MCPR_PARTICLE_MOB_SPELL,
    MCPR_PARTICLE_MOB_SPELL_AMBIENT,
    MCPR_PARTICLE_WITCH_MAGIC,
    MCPR_PARTICLE_DRIP_WATER,
    MCPR_PARTICLE_DRIP_LAVA,
    MCPR_PARTICLE_ANGRY_VILLAGER,
    MCPR_PARTICLE_HAPPY_VILLAGER,
    MCPR_PARTICLE_TOWN_AURA,
    MCPR_PARTICLE_NOTE,
    MCPR_PARTICLE_PORTAL,
    MCPR_PARTICLE_ENCHANTMENT_TABLE,
    MCPR_PARTICLE_FLAME,
    MCPR_PARTICLE_LAVA,
    MCPR_PARTICLE_FOOTSTEP,
    MCPR_PARTICLE_CLOUD,
    MCPR_PARTICLE_RED_DUST,
    MCPR_PARTICLE_SNOWBALL_PROOF,
    MCPR_PARTICLE_SNOW_SHOVEL,
    MCPR_PARTICLE_SLIME,
    MCPR_PARTICLE_HEART,
    MCPR_PARTICLE_BARRIER,
    MCPR_PARTICLE_IRON_CRACK,
    MCPR_PARTICLE_BLOCK_CRACK,
    MCPR_PARTICLE_BLOCK_DUST,
    MCPR_PARTICLE_DROPLET,
    MCPR_PARTICLE_TAKE,
    MCPR_PARTICLE_MOB_APPEARANCE,
    MCPR_PARTICLE_DRAGON_BREATH,
    MCPR_PARTICLE_END_ROD,
    MCPR_PARTICLE_DAMAGE_INDICATOR,
    MCPR_PARTICLE_SWEEP_ATTACK,
    MCPR_PARTICLE_FALING_DUST
};

enum mcpr_difficulty
{
    MCPR_DIFFICULTY_PEACEFUL,
    MCPR_DIFFICULTY_EASY,
    MCPR_DIFFICULTY_NORMAL,
    MCPR_DIFFICULTY_HARD
};

enum mcpr_chat_position
{
    MCPR_CHAT_POSITION_CHAT,
    MCPR_CHAT_POSITION_SYSTEM,
    MCPR_CHAT_POSITION_HOTBAR
};

struct mcpr_multi_block_change
{
    uint8_t horizontal_position_x;
    uint8_t horizontal_position_z;
    uint8_t y_coordinate;
    int32_t block_id;
};

struct mcpr_explosion_record
{
    int8_t x, y, z;
};

enum mcpr_map_icon
{
    MCPR_MAP_ICON_WHITE_ARROW,
    MCPR_MAP_ICON_GREEN_ARROW,
    MCPR_MAP_ICON_RED_ARROW,
    MCPR_MAP_ICON_BLUE_ARROW,
    MCPR_MAP_ICON_WHITE_CROSS,
    MCPR_MAP_ICON_RED_POINTER,
    MCPR_MAP_ICON_WHITE_CIRCLE,
    MCPR_MAP_ICON_SMALL_WHITE_CIRCLE,
    MCPR_MAP_ICON_MANSION,
    MCPR_MAP_ICON_TEMPLE,
};

struct mcpr_map_icon
{
    uint8_t direction;
    enum mcpr_map_icon type;
    int8_t x, z;
};

enum mcpr_combat_event
{
    MCPR_COMBAT_EVENT_ENTER_COMBAT,
    MCPR_COMBAT_EVENT_END_COMBAT,
    MCPR_COMBAT_EVENT_ENTITY_DEAD
};

struct mcpr_packet
{
    int8_t id;
    union
    {
        struct // handshake
        {
            union // handshake - serverbound
            {
                struct
                {
                    int32_t protocol_version;
                    char *server_address;
                    uint16_t server_port;
                    enum mcpr_state next_state;
                } handshake;
            } serverbound;

            union // handshake - clientbound
            {

            } clientbound;
        } handshake;

        struct // login
        {
            union // login - serverbound
            {
                struct
                {
                    char *name;
                } login_start;

                struct
                {
                    int32_t shared_secret_length;
                    void *shared_secret;
                    int32_t verify_token_length;
                    void *verify_token;
                } encryption_response;
            } serverbound;

            union // login - clientbound
            {
                struct
                {
                    struct mcpr_chat_message reason;
                } disconnect;

                struct
                {
                    char *server_id;
                    int32_t public_key_length;
                    void *public_key;
                    int32_t verify_token_length;
                    void *verify_token;
                } encryption_request;

                struct
                {
                    struct mcpr_uuid uuid;
                    char *username;
                } login_success;

                struct
                {
                    int32_t threshold;
                } set_compression;
            } clientbound;
        } login;

        struct // status
        {
            union // status - serverbound
            {
                struct
                {

                } request;

                struct
                {
                    int64_t payload;
                } ping;
            } serverbound;

            union // status - clientbound
            {
                struct
                {
                int64_t payload;
                } pong;

                struct
                {
                    json_t json_response;
                } response;
            } clientbound;
        } status;

        struct
        { // play
            union // play - serverbound
            {
                struct
                {
                    int32_t teleport_id;
                } teleport_confirm;

                struct
                {
                    char *text;
                    bool assume_command;
                    bool has_position;
                    struct mcpr_position looked_at_block; // Optional, only if has_position is true.
                } tab_complete;

                struct
                {
                    char *message;
                } chat_message;

                struct
                {
                    enum mcpr_client_status_action action;
                } client_status;

                struct
                {
                    char *locale;
                    int8_t view_distance;
                    enum mcpr_chat_mode chat_mode;
                    bool chat_colors;

                    struct
                    {
                        bool cape_enabled;
                        bool jacket_enabled;
                        bool left_sleeve_enabled, right_sleeve_enabled;
                        bool left_pants_enabled, right_pants_enabled;
                        bool hat_enabled;
                    } displayed_skin_parts;

                    enum mcpr_side_based_hand main_hand;
                } client_settings;

                struct
                {
                    int8_t window_id;
                    int16_t action_number;
                    bool accepted;
                } confirm_transaction;

                struct
                {
                    int8_t window_id;
                    int8_t enchantment;
                } enchant_item;

                struct
                {
                    uint8_t window_id;
                    int16_t slot;
                    int8_t button;
                    int16_t action_number;
                    int32_t mode;
                    struct mcpr_slot clicked_item;
                } click_window;

                struct
                {
                    uint8_t window_id;
                } close_window;

                struct
                {
                    char *channel;
                    size_t data_length;
                    void *data;
                } plugin_message;

                struct
                {
                    int32_t target;
                    enum mcpr_use_entity_type type;
                    float target_x, target_y, target_z; // Optional, only if type is MCPR_USE_ENTITY_TYPE_INTERACT_AT
                    enum mcpr_hand hand; // Optional, only if type is MCPR_USE_ENTITY_TYPE_INTERACT_AT
                } use_entity;

                struct
                {
                    int32_t keep_alive_id;
                } keep_alive;

                struct
                {
                    double x, feet_y, z;
                    bool on_ground;
                } player_position;

                struct
                {
                    double x, feet_y, z;
                    float yaw, pitch;
                    bool on_ground;
                } player_position_and_look;

                struct
                {
                    float yaw, pitch;
                    bool on_ground;
                } player_look;

                struct
                {
                    bool on_ground;
                } player;

                struct
                {
                    double x, y ,z;
                    float yaw, pitch;
                } vehicle_move;

                struct
                {
                    bool right_paddle_turning, left_paddle_turning;
                } steer_boat;

                struct
                {
                    bool invulnerable;
                    bool can_fly;
                    bool is_flying;
                    bool is_creative;
                    float flying_speed;
                    float walking_speed;
                } player_abilities;

                struct
                {
                    enum mcpr_player_digging_status status;
                    struct mcpr_position block_position;
                    enum mcpr_block_face face;
                } player_digging;

                struct
                {
                    int32_t entity_id;
                    enum mcpr_entity_action action;
                    int32_t jump_boost;
                } entity_action;

                struct
                {
                    float sideways, forward;
                    bool jump;
                    bool unmount;
                } steer_vehicle;

                struct
                {
                    enum mcpr_resource_pack_result result;
                } resource_pack_status;

                struct
                {
                    int16_t slot;
                } held_item_change;

                struct
                {
                    int16_t slot;
                    struct mcpr_slot clicked_item;
                } creative_inventory_action;

                struct
                {
                    struct mcpr_position sign_location;
                    char *line_1, line_2, line_3, line_4;
                } update_sign;

                struct
                {
                    enum mcpr_hand hand;
                } animation;

                struct
                {
                    struct  mcpr_uuid target_player;
                } spectate;

                struct
                {
                    struct mcpr_position block_position;
                    enum mcpr_block_face face;
                    enum mcpr_hand hand;
                    float cursor_position_x, cursor_position_y, cursor_position_z;
                } player_block_placement;

                struct
                {
                    enum mcpr_hand hand;
                } use_item;
            } serverbound;

            union // play - clientbound
            {
                struct
                {
                    int32_t entity_id;
                    struct mcpr_uuid uuid;
                    enum mcpr_object type;
                    double x, y, z;
                    uint8_t pitch;
                    uint8_t yaw;
                    int32_t data;
{'fraction_non_alphanumeric': 0.0404225352112676, 'fraction_numerical': 0.0044014084507042256, 'mean_word_length': 1.9428038545228474, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5958470', 'n_tokens_mistral': 10975, 'n_tokens_neox': 10197, 'n_words': 1228}