/
structure_template_data_export_request.go
45 lines (40 loc) · 1.55 KB
/
structure_template_data_export_request.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
package packet
import (
"bytes"
"encoding/binary"
"github.com/sandertv/gophertunnel/minecraft/protocol"
)
// StructureTemplateDataExportRequest is sent by the client to request data of a structure. It is currently
// unused: The client never sends this packet.
type StructureTemplateDataExportRequest struct {
// StructureName is the name of the structure that was set in the structure block's UI. This is the name
// used to export the structure to a file.
StructureName string
// Position is the position of the structure block that has its template data requested.
Position protocol.BlockPos
// Settings is a struct of settings that should be used for exporting the structure. These settings are
// identical to the last sent in the StructureBlockUpdate packet by the client.
Settings protocol.StructureSettings
// Byte1 ...
Byte1 byte
}
// ID ...
func (pk *StructureTemplateDataExportRequest) ID() uint32 {
return IDStructureTemplateDataExportRequest
}
// Marshal ...
func (pk *StructureTemplateDataExportRequest) Marshal(buf *bytes.Buffer) {
_ = protocol.WriteString(buf, pk.StructureName)
_ = protocol.WriteUBlockPosition(buf, pk.Position)
_ = protocol.WriteStructSettings(buf, pk.Settings)
_ = binary.Write(buf, binary.LittleEndian, pk.Byte1)
}
// Unmarshal ...
func (pk *StructureTemplateDataExportRequest) Unmarshal(buf *bytes.Buffer) error {
return chainErr(
protocol.String(buf, &pk.StructureName),
protocol.UBlockPosition(buf, &pk.Position),
protocol.StructSettings(buf, &pk.Settings),
binary.Read(buf, binary.LittleEndian, &pk.Byte1),
)
}