/
structure.go
73 lines (66 loc) · 2.44 KB
/
structure.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
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
package protocol
import (
"github.com/go-gl/mathgl/mgl32"
)
const (
StructureMirrorNone = iota
StructureMirrorXAxis
StructureMirrorZAxis
StructureMirrorBothAxes
)
const (
StructureRotationNone = iota
StructureRotationRotate90
StructureRotationRotate180
StructureRotationRotate270
)
// StructureSettings is a struct holding settings of a structure block. Its fields may be changed using the
// in-game UI on the client-side.
type StructureSettings struct {
// PaletteName is the name of the palette used in the structure. Currently, it seems that this field is
// always 'default'.
PaletteName string
// IgnoreEntities specifies if the structure should ignore entities or include them. If set to false,
// entities will also show up in the exported structure.
IgnoreEntities bool
// IgnoreBlocks specifies if the structure should ignore blocks or include them. If set to false, blocks
// will show up in the exported structure.
IgnoreBlocks bool
// Size is the size of the area that is about to be exported. The area exported will start at the
// Position + Offset, and will extend as far as Size specifies.
Size BlockPos
// Offset is the offset position that was set in the structure block. The area exported is offset by this
// position.
Offset BlockPos
// LastEditingPlayerUniqueID is the unique ID of the player that last edited the structure block that
// these settings concern.
LastEditingPlayerUniqueID int64
// Rotation is the rotation that the structure block should obtain. See the constants above for available
// options.
Rotation byte
// Mirror specifies the way the structure should be mirrored. It is either no mirror at all, mirror on the
// x/z axis or both.
Mirror byte
// Integrity is usually 1, but may be set to a number between 0 and 1 to omit blocks randomly, using
// the Seed that follows.
Integrity float32
// Seed is the seed used to omit blocks if Integrity is not equal to one. If the Seed is 0, a random
// seed is selected to omit blocks.
Seed uint32
// Pivot is the pivot around which the structure may be rotated.
Pivot mgl32.Vec3
}
// StructSettings reads/writes StructureSettings x using IO r.
func StructSettings(r IO, x *StructureSettings) {
r.String(&x.PaletteName)
r.Bool(&x.IgnoreEntities)
r.Bool(&x.IgnoreBlocks)
r.UBlockPos(&x.Size)
r.UBlockPos(&x.Offset)
r.Varint64(&x.LastEditingPlayerUniqueID)
r.Uint8(&x.Rotation)
r.Uint8(&x.Mirror)
r.Float32(&x.Integrity)
r.Uint32(&x.Seed)
r.Vec3(&x.Pivot)
}