Add 1.21.20
This commit is contained in:
24
legacyver/legacypacket/container_registry_cleanup.go
Normal file
24
legacyver/legacypacket/container_registry_cleanup.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package legacypacket
|
||||
|
||||
import (
|
||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
||||
)
|
||||
|
||||
// ContainerRegistryCleanup is sent by the server to trigger a client-side cleanup of the dynamic container
|
||||
// registry.
|
||||
type ContainerRegistryCleanup struct {
|
||||
// RemovedContainers is a list of protocol.FullContainerName's that should be removed from the client-side
|
||||
// container registry.
|
||||
RemovedContainers []proto.FullContainerName
|
||||
}
|
||||
|
||||
// ID ...
|
||||
func (*ContainerRegistryCleanup) ID() uint32 {
|
||||
return packet.IDContainerRegistryCleanup
|
||||
}
|
||||
|
||||
func (pk *ContainerRegistryCleanup) Marshal(io protocol.IO) {
|
||||
protocol.Slice(io, &pk.RemovedContainers)
|
||||
}
|
||||
49
legacyver/legacypacket/emote_packet.go
Normal file
49
legacyver/legacypacket/emote_packet.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package legacypacket
|
||||
|
||||
import (
|
||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
||||
)
|
||||
|
||||
const (
|
||||
EmoteFlagServerSide = 1 << iota
|
||||
EmoteFlagMuteChat
|
||||
)
|
||||
|
||||
// Emote is sent by both the server and the client. When the client sends an emote, it sends this packet to
|
||||
// the server, after which the server will broadcast the packet to other players online.
|
||||
type Emote struct {
|
||||
// EntityRuntimeID is the entity that sent the emote. When a player sends this packet, it has this field
|
||||
// set as its own entity runtime ID.
|
||||
EntityRuntimeID uint64
|
||||
// EmoteLength is the number of ticks that the emote lasts for.
|
||||
EmoteLength uint32
|
||||
// EmoteID is the ID of the emote to send.
|
||||
EmoteID string
|
||||
// XUID is the Xbox User ID of the player that sent the emote. It is only set when the emote is used by a player that
|
||||
// is authenticated with Xbox Live.
|
||||
XUID string
|
||||
// PlatformID is an identifier only set for particular platforms when using an emote (presumably only for Nintendo
|
||||
// Switch). It is otherwise an empty string, and is used to decide which players are able to emote with each other.
|
||||
PlatformID string
|
||||
// Flags is a combination of flags that change the way the Emote packet operates. When the server sends
|
||||
// this packet to other players, EmoteFlagServerSide must be present.
|
||||
Flags byte
|
||||
}
|
||||
|
||||
// ID ...
|
||||
func (*Emote) ID() uint32 {
|
||||
return packet.IDEmote
|
||||
}
|
||||
|
||||
func (pk *Emote) Marshal(io protocol.IO) {
|
||||
io.Varuint64(&pk.EntityRuntimeID)
|
||||
io.String(&pk.EmoteID)
|
||||
if proto.IsProtoGTE(io, proto.ID729) {
|
||||
io.Varuint32(&pk.EmoteLength)
|
||||
}
|
||||
io.String(&pk.XUID)
|
||||
io.String(&pk.PlatformID)
|
||||
io.Uint8(&pk.Flags)
|
||||
}
|
||||
@@ -17,7 +17,7 @@ type InventoryContent struct {
|
||||
// the inventory window updated.
|
||||
Content []protocol.ItemInstance
|
||||
// Container is the protocol.FullContainerName that describes the container that the content is for.
|
||||
Container protocol.FullContainerName
|
||||
Container proto.FullContainerName
|
||||
// DynamicContainerSize ...
|
||||
DynamicContainerSize uint32
|
||||
// StorageItem is the item that is acting as the storage container for the inventory. If the inventory is
|
||||
@@ -34,7 +34,9 @@ func (*InventoryContent) ID() uint32 {
|
||||
func (pk *InventoryContent) Marshal(io protocol.IO) {
|
||||
io.Varuint32(&pk.WindowID)
|
||||
protocol.FuncSlice(io, &pk.Content, io.ItemInstance)
|
||||
protocol.Single(io, &pk.Container)
|
||||
if proto.IsProtoGTE(io, proto.ID729) {
|
||||
protocol.Single(io, &pk.Container)
|
||||
}
|
||||
if proto.IsProtoGTE(io, proto.ID748) {
|
||||
io.ItemInstance(&pk.StorageItem)
|
||||
} else {
|
||||
|
||||
@@ -17,7 +17,7 @@ type InventorySlot struct {
|
||||
// index.
|
||||
Slot uint32
|
||||
// Container is the protocol.FullContainerName that describes the container that the content is for.
|
||||
Container protocol.FullContainerName
|
||||
Container proto.FullContainerName
|
||||
// DynamicContainerSize ...
|
||||
DynamicContainerSize uint32
|
||||
// StorageItem is the item that is acting as the storage container for the inventory. If the inventory is
|
||||
@@ -37,7 +37,9 @@ func (*InventorySlot) ID() uint32 {
|
||||
func (pk *InventorySlot) Marshal(io protocol.IO) {
|
||||
io.Varuint32(&pk.WindowID)
|
||||
io.Varuint32(&pk.Slot)
|
||||
protocol.Single(io, &pk.Container)
|
||||
if proto.IsProtoGTE(io, proto.ID729) {
|
||||
protocol.Single(io, &pk.Container)
|
||||
}
|
||||
if proto.IsProtoGTE(io, proto.ID748) {
|
||||
io.ItemInstance(&pk.StorageItem)
|
||||
} else {
|
||||
|
||||
@@ -27,6 +27,10 @@ type ResourcePacksInfo struct {
|
||||
// WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
||||
// the world was not generated from a template, this field is empty.
|
||||
WorldTemplateVersion string
|
||||
// ForcingServerPacks ...
|
||||
ForcingServerPacks bool
|
||||
// BehaviourPacks ...
|
||||
BehaviourPacks []proto.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.
|
||||
@@ -49,6 +53,12 @@ func (pk *ResourcePacksInfo) Marshal(io protocol.IO) {
|
||||
io.UUID(&pk.WorldTemplateUUID)
|
||||
io.String(&pk.WorldTemplateVersion)
|
||||
}
|
||||
if proto.IsProtoLT(io, proto.ID729) {
|
||||
io.Bool(&pk.ForcingServerPacks)
|
||||
protocol.SliceUint16Length(io, &pk.BehaviourPacks)
|
||||
} else {
|
||||
proto.EmptySlice(io, &pk.BehaviourPacks)
|
||||
}
|
||||
protocol.SliceUint16Length(io, &pk.TexturePacks)
|
||||
if proto.IsProtoLT(io, proto.ID748) {
|
||||
protocol.Slice(io, &pk.PackURLs)
|
||||
|
||||
31
legacyver/legacypacket/transfer.go
Normal file
31
legacyver/legacypacket/transfer.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package legacypacket
|
||||
|
||||
import (
|
||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
||||
)
|
||||
|
||||
// Transfer is sent by the server to transfer a player from the current server to another. Doing so will
|
||||
// fully disconnect the client, bring it back to the main menu and make it connect to the next server.
|
||||
type Transfer struct {
|
||||
// Address is the address of the new server, which might be either a hostname or an actual IP address.
|
||||
Address string
|
||||
// Port is the UDP port of the new server.
|
||||
Port uint16
|
||||
// ReloadWorld currently has an unknown usage.
|
||||
ReloadWorld bool
|
||||
}
|
||||
|
||||
// ID ...
|
||||
func (*Transfer) ID() uint32 {
|
||||
return packet.IDTransfer
|
||||
}
|
||||
|
||||
func (pk *Transfer) Marshal(io protocol.IO) {
|
||||
io.String(&pk.Address)
|
||||
io.Uint16(&pk.Port)
|
||||
if proto.IsProtoGTE(io, proto.ID729) {
|
||||
io.Bool(&pk.ReloadWorld)
|
||||
}
|
||||
}
|
||||
32
legacyver/legacypacket/update_attributes.go
Normal file
32
legacyver/legacypacket/update_attributes.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package legacypacket
|
||||
|
||||
import (
|
||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
||||
)
|
||||
|
||||
// UpdateAttributes is sent by the server to update an amount of attributes of any entity in the world. These
|
||||
// attributes include ones such as the health or the movement speed of the entity.
|
||||
type UpdateAttributes struct {
|
||||
// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
|
||||
// entities are generally identified in packets using this runtime ID.
|
||||
EntityRuntimeID uint64
|
||||
// Attributes is a slice of new attributes that the entity gets. It includes attributes such as its
|
||||
// health, movement speed, etc. Note that only changed attributes have to be sent in this packet. It is
|
||||
// not required to send attributes that did not have their values changed.
|
||||
Attributes []proto.Attribute
|
||||
// Tick is the server tick at which the packet was sent. It is used in relation to CorrectPlayerMovePrediction.
|
||||
Tick uint64
|
||||
}
|
||||
|
||||
// ID ...
|
||||
func (*UpdateAttributes) ID() uint32 {
|
||||
return packet.IDUpdateAttributes
|
||||
}
|
||||
|
||||
func (pk *UpdateAttributes) Marshal(io protocol.IO) {
|
||||
io.Varuint64(&pk.EntityRuntimeID)
|
||||
protocol.Slice(io, &pk.Attributes)
|
||||
io.Varuint64(&pk.Tick)
|
||||
}
|
||||
Reference in New Issue
Block a user