summaryrefslogtreecommitdiffstats
path: root/world.h
blob: 65b187d7b523aae69c9136823d52d0d0d85d405a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//
//  world.h
//  mcc
//
//  Created by Finn Behrens on 28.02.21.
//

#ifndef world_h
#define world_h

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <errno.h>

#include <cNBT/nbt.h>

/**
 * Config of a world dimension
 *
 * @field piglin_safe Whether piglins shake and transform to zombified piglins.
 *
 * @field natural When false, compasses spin randomly. When true, nether portals can spawn zombified piglins.
 *
 * @field ambient_light How much light the dimension has. (0.0..1.0
 *
 * @field fixed_time If set, the time of the day is the specified value. (0..24000)
 *
 * @field infiniburn A resource location defining what block tag to use for infiniburn.
 *
 * @field respawn_anchor_works Whether players can charge and use respawn anchors.
 *
 * @field has_skylight Whether the dimension has skylight access or not.
 *
 * @field bed_works Whether players can use a bed to sleep.
 *
 * @field effects ? ("minecraft:overworld", "minecraft:the_nether", "minecraft:the_end" or something else.)
 *
 * @field has_raids Whether players with the Bad Omen effect can cause a raid.
 *
 * @field logical_height The maximum height to which chorus fruits and nether portals can bring players within this dimension. (0-256.(??))
 *
 * @field coordinate_scale The multiplier applied to coordinates when traveling to the dimension.
 *
 * @field ultrawarm Whether the dimensions behaves like the nether (water evaporates and sponges dry) or not. Also causes lava to spread thinner.
 *
 * @field has_ceiling Whether the dimension has a bedrock ceiling or not. When true, causes lava to spread faster.
 */
typedef struct mc_dimension_element {
    bool piglin_safe;
    bool natural;
    float ambient_light;
    long fixed_time;
    char *infiniburn;
    bool respawn_anchor_works;
    bool has_skylight;
    bool bed_works;
    char *effects;
    bool has_raids;
    int logical_height;
    float coordinate_scale;
    bool ultrawarm;
    bool has_ceiling;
} mc_dimension_element_t;

mc_dimension_element_t *mc_dim_element_default_overworld();
nbt_node *mc_dimension_element_to_nbt(mc_dimension_element_t *codec);

typedef struct mc_dimension_registry_element {
    char *name;
    int id; // has to match context
    mc_dimension_element_t *element;
} mc_dimension_registry_element_t;

mc_dimension_registry_element_t *mc_dim_registry_element_default_overworld();
nbt_node *mc_dimension_registry_element_to_nbt(mc_dimension_registry_element_t *el);

typedef struct mc_dimension_registry {
    
} mc_dimension_registry_t;

typedef struct mc_dimension {
    int protocol_id;
    
    mc_dimension_element_t *codec;
} mc_dimension_t;

typedef struct mc_world {
    int max_players;
    
    int curr_players;
    
} mc_world_t;

extern mc_world_t *world;

int init_world();

#endif /* world_h */