Add 1.21.20

This commit is contained in:
AkmalFairuz
2025-01-01 12:34:03 +07:00
parent 93821ab4c6
commit 9677eef999
19 changed files with 7267 additions and 60 deletions

View File

@@ -38,6 +38,20 @@ type TexturePackInfo struct {
DownloadURL string
}
func (x *TexturePackInfo) FromLatest(y protocol.TexturePackInfo) TexturePackInfo {
x.UUID = y.UUID
x.Version = y.Version
x.Size = y.Size
x.ContentKey = y.ContentKey
x.SubPackName = y.SubPackName
x.ContentIdentity = y.ContentIdentity
x.HasScripts = y.HasScripts
x.AddonPack = y.AddonPack
x.RTXEnabled = y.RTXEnabled
x.DownloadURL = y.DownloadURL
return *x
}
func (x *TexturePackInfo) ToLatest() protocol.TexturePackInfo {
return protocol.TexturePackInfo{
UUID: x.UUID,
@@ -79,3 +93,42 @@ func (x *TexturePackInfo) Marshal(r protocol.IO) {
r.String(&x.DownloadURL)
}
}
// BehaviourPackInfo represents a behaviour pack's info sent over network. It holds information about the
// behaviour pack such as its name, description and version.
type BehaviourPackInfo struct {
// UUID is the UUID of the behaviour pack. Each behaviour pack downloaded must have a different UUID in
// order for the client to be able to handle them properly.
UUID string
// Version is the version of the behaviour pack. The client will cache behaviour packs sent by the server as
// long as they carry the same version. Sending a behaviour pack with a different version than previously
// will force the client to re-download it.
Version string
// Size is the total size in bytes that the behaviour pack occupies. This is the size of the compressed
// archive (zip) of the behaviour pack.
Size uint64
// ContentKey is the key used to decrypt the behaviour pack if it is encrypted. This is generally the case
// for marketplace behaviour packs.
ContentKey string
// SubPackName ...
SubPackName string
// ContentIdentity ...
ContentIdentity string
// HasScripts specifies if the behaviour packs has any scripts in it. A client will only download the
// behaviour pack if it supports scripts, which, up to 1.11, only includes Windows 10.
HasScripts bool
// AddonPack specifies if the texture pack is from an addon.
AddonPack bool
}
// Marshal encodes/decodes a BehaviourPackInfo.
func (x *BehaviourPackInfo) Marshal(r protocol.IO) {
r.String(&x.UUID)
r.String(&x.Version)
r.Uint64(&x.Size)
r.String(&x.ContentKey)
r.String(&x.SubPackName)
r.String(&x.ContentIdentity)
r.Bool(&x.HasScripts)
r.Bool(&x.AddonPack)
}