Update legacy protocol support to v1.21.90
This commit is contained in:
35
legacyver/legacypacket/sub_chunk.go
Normal file
35
legacyver/legacypacket/sub_chunk.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user