-
Notifications
You must be signed in to change notification settings - Fork 2
/
resource_packs_info.go
executable file
·44 lines (40 loc) · 1.95 KB
/
resource_packs_info.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 packet
import (
"github.com/sandertv/gophertunnel/minecraft/protocol"
gtpacket "github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)
// ResourcePacksInfo is sent by the server to inform the client on what resource packs the server has. It
// sends a list of the resource packs it has and basic information on them like the version and description.
type ResourcePacksInfo struct {
// TexturePackRequired specifies if the client must accept the texture packs the server has in order to
// join the server. If set to true, the client gets the option to either download the resource packs and
// join, or quit entirely. Behaviour packs never have to be downloaded.
TexturePackRequired bool
// HasScripts specifies if any of the resource packs contain scripts in them. If set to true, only clients
// that support scripts will be able to download them.
HasScripts bool
// BehaviourPack is a list of behaviour packs that the client needs to download before joining the server.
// All of these behaviour packs will be applied together.
BehaviourPacks []protocol.BehaviourPackInfo
// TexturePacks is a list of texture packs that the client needs to download before joining the server.
// The order of these texture packs is not relevant in this packet. It is however important in the
// ResourcePackStack packet.
TexturePacks []protocol.TexturePackInfo
// ForcingServerPacks is currently an unclear field.
ForcingServerPacks bool
// PackURLs is a list of URLs that the client can use to download a resource pack instead of downloading
// it the usual way.
PackURLs []protocol.PackURL
}
// ID ...
func (*ResourcePacksInfo) ID() uint32 {
return gtpacket.IDResourcePacksInfo
}
func (pk *ResourcePacksInfo) Marshal(io protocol.IO) {
io.Bool(&pk.TexturePackRequired)
io.Bool(&pk.HasScripts)
io.Bool(&pk.ForcingServerPacks)
protocol.SliceUint16Length(io, &pk.BehaviourPacks)
protocol.SliceUint16Length(io, &pk.TexturePacks)
protocol.Slice(io, &pk.PackURLs)
}