forked from Sandertv/gophertunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
world.go
44 lines (39 loc) · 1.43 KB
/
world.go
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
package protocol
const (
GeneratorLegacy = 0
GeneratorOverworld = 1
GeneratorFlat = 2
GeneratorNether = 3
GeneratorEnd = 4
GeneratorVoid = 5
)
// DimensionDefinition contains information specifying dimension-specific properties, used for data-driven dimensions.
// These include the range (the height min/max), generator variant, and more.
type DimensionDefinition struct {
// Name specifies the name of the dimension.
Name string
// Range is the height range of the dimension, where the first value is the minimum and the second is the maximum.
Range [2]int32
// Generator is the variant of generator that exists in the provided dimension. These can be one of the constants
// defined above. If this is set to GeneratorLegacy, the legacy horizontal world limits will be enforced.
Generator int32
}
// Marshal encodes/decodes a DimensionDefinition.
func (x *DimensionDefinition) Marshal(r IO) {
r.String(&x.Name)
r.Varint32(&x.Range[0])
r.Varint32(&x.Range[1])
r.Varint32(&x.Generator)
}
// GenerationFeature represents a world generation feature, used when encoding the FeatureRegistry to the client.
type GenerationFeature struct {
// Name is the name of the feature.
Name string
// JSON is the encoded JSON data instructing the client on how to generate the feature.
JSON []byte
}
// Marshal encodes/decodes a GenerationFeature.
func (x *GenerationFeature) Marshal(r IO) {
r.String(&x.Name)
r.ByteSlice(&x.JSON)
}