First support 1.21.130

This commit is contained in:
AkmalFairuz
2025-12-10 23:05:46 +07:00
parent 2b6358ea51
commit 65693b1e85
22 changed files with 10348 additions and 40 deletions

View File

@@ -0,0 +1,43 @@
package legacypacket
import (
"github.com/akmalfairuz/legacy-version/internal/typeconf"
"github.com/akmalfairuz/legacy-version/legacyver/proto"
"github.com/sandertv/gophertunnel/minecraft/protocol"
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)
// CommandRequest is sent by the client to request the execution of a server-side command. Although some
// servers support sending commands using the Text packet, this packet is guaranteed to have the correct
// result.
type CommandRequest struct {
// CommandLine is the raw entered command line. The client does no parsing of the command line by itself
// (unlike it did in the early stages), but lets the server do that.
CommandLine string
// CommandOrigin is the data specifying the origin of the command. In other words, the source that the
// command was from, such as the player itself or a websocket server.
CommandOrigin protocol.CommandOrigin
// Internal specifies if the command request internal. Setting it to false seems to work and the usage of
// this field is not known.
Internal bool
// Version is the version of the command that is being executed. This field currently has no purpose or functionality.
Version string
}
// ID ...
func (*CommandRequest) ID() uint32 {
return packet.IDCommandRequest
}
func (pk *CommandRequest) Marshal(io protocol.IO) {
io.String(&pk.CommandLine)
protocol.CommandOriginData(io, &pk.CommandOrigin)
io.Bool(&pk.Internal)
if proto.IsProtoGTE(io, proto.ID898) {
io.String(&pk.Version)
} else {
v := typeconf.StringToInt[int32](pk.Version, 0)
io.Varint32(&v)
pk.Version = typeconf.IntToString[int32](v, "")
}
}