1#ifndef WORLD_H
2#define WORLD_H
3
4#include "net/mc_chunk.h"
5#include "world/chunk.h"
6
7#define CLIENT_WORLD_MAX_CHUNKS 2048
8
9typedef struct {
10 Chunk chunks[CLIENT_WORLD_MAX_CHUNKS];
11} ClientWorld;
12
13/* initialise world with 0 */
14void world_init(ClientWorld* world);
15
16/* destroy world (frees all chunks) */
17void world_destroy(ClientWorld* world);
18
19/* remove chunk from world (clears data, marks unsued) */
20void world_remove_chunk(ClientWorld* world, i32 x, i32 z);
21
22/* rebuild all loaded chunk meshes with world-aware face culling */
23i8 world_mesh_create(ClientWorld* world);
24
25/* update chunk with data from server
26 returns 1 on success, 0 on failure */
27i8 world_update_chunk(ClientWorld* world, const MCChunkUpdate* update, const u8* data);
28
29#endif /* WORLD_H */