Update legacy protocol support to v1.21.90

This commit is contained in:
AkmalFairuz
2025-06-18 23:54:54 +07:00
parent 8a209b75bf
commit fd5e43eea7
13 changed files with 9376 additions and 9 deletions

View File

@@ -20,6 +20,9 @@ type ResourcePacksInfo struct {
// 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
// ForceDisableVibrantVisuals specifies if the vibrant visuals feature should be forcibly disabled on the server.Add commentMore actions
// If set to true, the server will ensure that vibrant visuals are not enabled, regardless of the client's settings.
ForceDisableVibrantVisuals bool
// WorldTemplateUUID is the UUID of the template that has been used to generate the world. Templates can
// be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not generated
// from a template, this field is empty.
@@ -52,6 +55,9 @@ func (pk *ResourcePacksInfo) Marshal(io protocol.IO) {
}
io.Bool(&pk.HasScripts)
if proto.IsProtoGTE(io, proto.ID766) {
if proto.IsProtoGTE(io, proto.ID818) {
io.Bool(&pk.ForceDisableVibrantVisuals)
}
io.UUID(&pk.WorldTemplateUUID)
io.String(&pk.WorldTemplateVersion)
}

View File

@@ -232,6 +232,8 @@ type StartGame struct {
WorldID string
// ScenarioID is always empty in vanilla and its usage is currently unknown.
ScenarioID string
// OwnerID is always empty in vanilla and its usage is currently unknown.
OwnerID string
// UseBlockNetworkIDHashes is true if the client should use the hash of a block's name as its network ID rather than
// its index in the expected block palette. This is useful for servers that wish to support multiple protocol versions
// and custom blocks, but it will result in extra bytes being written for every block in a sub chunk palette.
@@ -309,6 +311,9 @@ func (pk *StartGame) Marshal(io protocol.IO) {
io.String(&pk.ServerID)
io.String(&pk.WorldID)
io.String(&pk.ScenarioID)
if proto.IsProtoGTE(io, proto.ID818) {
io.String(&pk.OwnerID)
}
}
io.String(&pk.LevelID)
io.String(&pk.WorldName)

View File

@@ -0,0 +1,35 @@
package legacypacket
import (
"github.com/akmalfairuz/legacy-version/legacyver/proto"
"github.com/sandertv/gophertunnel/minecraft/protocol"
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)
// SubChunk sends data about multiple sub-chunks around a center point.
type SubChunk struct {
// CacheEnabled is whether the sub-chunk caching is enabled or not.
CacheEnabled bool
// Dimension is the dimension the sub-chunks are in.
Dimension int32
// Position is an absolute sub-chunk center point that every SubChunkRequest uses as a reference.
Position protocol.SubChunkPos
// SubChunkEntries contains sub-chunk entries relative to the center point.
SubChunkEntries []proto.SubChunkEntry
}
// ID ...
func (*SubChunk) ID() uint32 {
return packet.IDSubChunk
}
func (pk *SubChunk) Marshal(io protocol.IO) {
io.Bool(&pk.CacheEnabled)
io.Varint32(&pk.Dimension)
io.SubChunkPos(&pk.Position)
if pk.CacheEnabled {
protocol.SliceUint32Length(io, &pk.SubChunkEntries)
} else {
protocol.FuncIOSliceUint32Length(io, &pk.SubChunkEntries, proto.SubChunkEntryNoCache)
}
}