monorepo fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package bot
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
+19
-19
@@ -7,8 +7,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/admin-else/queser"
|
"github.com/admin-else/strom/proto_base"
|
||||||
"github.com/admin-else/queser/generated"
|
"github.com/admin-else/strom/proto_generated"
|
||||||
)
|
)
|
||||||
|
|
||||||
var BadPacketTypeError = errors.New("bad packet type")
|
var BadPacketTypeError = errors.New("bad packet type")
|
||||||
@@ -27,23 +27,23 @@ const (
|
|||||||
Client
|
Client
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a Actor) SendDirection() queser.Direction {
|
func (a Actor) SendDirection() proto_base.Direction {
|
||||||
switch a {
|
switch a {
|
||||||
case Server:
|
case Server:
|
||||||
return queser.ToClient
|
return proto_base.ToClient
|
||||||
case Client:
|
case Client:
|
||||||
return queser.ToServer
|
return proto_base.ToServer
|
||||||
default:
|
default:
|
||||||
panic("invalid actor")
|
panic("invalid actor")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a Actor) ReceiveDirection() queser.Direction {
|
func (a Actor) ReceiveDirection() proto_base.Direction {
|
||||||
switch a {
|
switch a {
|
||||||
case Server:
|
case Server:
|
||||||
return queser.ToServer
|
return proto_base.ToServer
|
||||||
case Client:
|
case Client:
|
||||||
return queser.ToClient
|
return proto_base.ToClient
|
||||||
default:
|
default:
|
||||||
panic("invalid actor")
|
panic("invalid actor")
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ type Conn struct {
|
|||||||
R io.Reader
|
R io.Reader
|
||||||
W io.Writer
|
W io.Writer
|
||||||
CompressionThreshold int32
|
CompressionThreshold int32
|
||||||
State queser.State
|
State proto_base.State
|
||||||
Actor Actor
|
Actor Actor
|
||||||
Version string
|
Version string
|
||||||
}
|
}
|
||||||
@@ -65,13 +65,13 @@ func (c *Conn) Send(packet any) (err error) {
|
|||||||
case UnCodablePacket:
|
case UnCodablePacket:
|
||||||
rawPacketBytes = packet.Data
|
rawPacketBytes = packet.Data
|
||||||
default:
|
default:
|
||||||
packetIdentifier := generated.TypeToPacketIdentifier(c.Version, c.Actor.SendDirection(), c.State, packet)
|
packetIdentifier := proto_generated.TypeToPacketIdentifier(c.Version, c.Actor.SendDirection(), c.State, packet)
|
||||||
if packetIdentifier == "" {
|
if packetIdentifier == "" {
|
||||||
err = BadPacketTypeError
|
err = BadPacketTypeError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
rawPacketBuffer := bytes.NewBuffer(nil)
|
rawPacketBuffer := bytes.NewBuffer(nil)
|
||||||
err = generated.EncodePacket(c.Version, c.Actor.SendDirection(), c.State, packetIdentifier, packet, rawPacketBuffer)
|
err = proto_generated.EncodePacket(c.Version, c.Actor.SendDirection(), c.State, packetIdentifier, packet, rawPacketBuffer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ func (c *Conn) Send(packet any) (err error) {
|
|||||||
if c.CompressionThreshold > 0 {
|
if c.CompressionThreshold > 0 {
|
||||||
packetBuffer := bytes.NewBuffer(nil)
|
packetBuffer := bytes.NewBuffer(nil)
|
||||||
if int32(len(packetBytes)) >= c.CompressionThreshold {
|
if int32(len(packetBytes)) >= c.CompressionThreshold {
|
||||||
err = queser.VarInt(len(packetBytes)).Encode(packetBuffer)
|
err = proto_base.VarInt(len(packetBytes)).Encode(packetBuffer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ func (c *Conn) Send(packet any) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = queser.VarInt(0).Encode(packetBuffer)
|
err = proto_base.VarInt(0).Encode(packetBuffer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ func (c *Conn) Send(packet any) (err error) {
|
|||||||
} else {
|
} else {
|
||||||
packetBytes = rawPacketBytes
|
packetBytes = rawPacketBytes
|
||||||
}
|
}
|
||||||
err = queser.VarInt(len(packetBytes)).Encode(c.W)
|
err = proto_base.VarInt(len(packetBytes)).Encode(c.W)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ func (c *Conn) Send(packet any) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Conn) Receive() (packet any, err error) {
|
func (c *Conn) Receive() (packet any, err error) {
|
||||||
var rawPacketLen queser.VarInt
|
var rawPacketLen proto_base.VarInt
|
||||||
rawPacketLen, err = rawPacketLen.Decode(c.R)
|
rawPacketLen, err = rawPacketLen.Decode(c.R)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -124,7 +124,7 @@ func (c *Conn) Receive() (packet any, err error) {
|
|||||||
rawPacketBuffer := bytes.NewBuffer(rawPacketBytes)
|
rawPacketBuffer := bytes.NewBuffer(rawPacketBytes)
|
||||||
var packetBytes []byte
|
var packetBytes []byte
|
||||||
if c.CompressionThreshold > 0 {
|
if c.CompressionThreshold > 0 {
|
||||||
var packetLen queser.VarInt
|
var packetLen proto_base.VarInt
|
||||||
packetLen, err = packetLen.Decode(rawPacketBuffer)
|
packetLen, err = packetLen.Decode(rawPacketBuffer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -147,7 +147,7 @@ func (c *Conn) Receive() (packet any, err error) {
|
|||||||
packetBytes = rawPacketBytes
|
packetBytes = rawPacketBytes
|
||||||
}
|
}
|
||||||
packetBuff := bytes.NewBuffer(packetBytes)
|
packetBuff := bytes.NewBuffer(packetBytes)
|
||||||
packet, err = generated.DecodePacket(c.Version, c.Actor.ReceiveDirection(), c.State, packetBuff)
|
packet, err = proto_generated.DecodePacket(c.Version, c.Actor.ReceiveDirection(), c.State, packetBuff)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
packet = UnCodablePacket{Err: err, Data: packetBytes, Partial: packet}
|
packet = UnCodablePacket{Err: err, Data: packetBytes, Partial: packet}
|
||||||
err = nil
|
err = nil
|
||||||
@@ -158,7 +158,7 @@ func (c *Conn) Receive() (packet any, err error) {
|
|||||||
func Connect(addr string) (ret *Conn, err error) {
|
func Connect(addr string) (ret *Conn, err error) {
|
||||||
ret = &Conn{}
|
ret = &Conn{}
|
||||||
ret.Version = "1.21.8"
|
ret.Version = "1.21.8"
|
||||||
ret.State = queser.Handshaking
|
ret.State = proto_base.Handshaking
|
||||||
ret.CompressionThreshold = -1
|
ret.CompressionThreshold = -1
|
||||||
ret.Actor = Client
|
ret.Actor = Client
|
||||||
ret.Conn, err = net.Dial("tcp", addr)
|
ret.Conn, err = net.Dial("tcp", addr)
|
||||||
@@ -173,7 +173,7 @@ func Connect(addr string) (ret *Conn, err error) {
|
|||||||
func Servee(c net.Conn) (ret *Conn) {
|
func Servee(c net.Conn) (ret *Conn) {
|
||||||
ret = &Conn{}
|
ret = &Conn{}
|
||||||
ret.Version = "1.21.8"
|
ret.Version = "1.21.8"
|
||||||
ret.State = queser.Handshaking
|
ret.State = proto_base.Handshaking
|
||||||
ret.CompressionThreshold = -1
|
ret.CompressionThreshold = -1
|
||||||
ret.Actor = Server
|
ret.Actor = Server
|
||||||
ret.Conn = c
|
ret.Conn = c
|
||||||
|
|||||||
@@ -4,14 +4,13 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/admin-else/strom"
|
"github.com/admin-else/strom/bot"
|
||||||
|
"github.com/admin-else/strom/proto_base"
|
||||||
"github.com/admin-else/queser"
|
"github.com/admin-else/strom/proto_generated/v1_21_8"
|
||||||
"github.com/admin-else/queser/generated/v1_21_8"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConfigIgnorer struct {
|
type ConfigIgnorer struct {
|
||||||
*strom.Conn
|
*bot.Conn
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConfigIgnorer) Default(event any) (err error) {
|
func (c *ConfigIgnorer) Default(event any) (err error) {
|
||||||
@@ -23,13 +22,13 @@ func (c *ConfigIgnorer) OnKnownPacks(packet v1_21_8.PacketCommonSelectKnownPacks
|
|||||||
return c.Send(packet)
|
return c.Send(packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConfigIgnorer) OnFinish(packet v1_21_8.ConfigurationToClientPacketFinishConfiguration) (err error) {
|
func (c *ConfigIgnorer) OnFinish(_ v1_21_8.ConfigurationToClientPacketFinishConfiguration) (err error) {
|
||||||
err = c.Send(v1_21_8.ConfigurationToServerPacketFinishConfiguration{})
|
err = c.Send(v1_21_8.ConfigurationToServerPacketFinishConfiguration{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.State = queser.Play
|
c.State = proto_base.Play
|
||||||
err = strom.HandlerDone
|
err = bot.HandlerDone
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ func (c *ConfigIgnorer) OnKeepAlive(packet v1_21_8.ConfigurationToClientPacketKe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func IgnoreConfig(c *strom.Conn) (err error) {
|
func IgnoreConfig(c *bot.Conn) (err error) {
|
||||||
err = c.Start(&ConfigIgnorer{c})
|
err = c.Start(&ConfigIgnorer{c})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = errors.Join(err, errors.New("failed to ignore config"))
|
err = errors.Join(err, errors.New("failed to ignore config"))
|
||||||
@@ -5,25 +5,24 @@ import (
|
|||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"crypto/sha1"
|
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/hex"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/admin-else/strom"
|
"github.com/admin-else/strom/api"
|
||||||
|
"github.com/admin-else/strom/bot"
|
||||||
|
"github.com/admin-else/strom/crypto"
|
||||||
|
"github.com/admin-else/strom/proto_base"
|
||||||
|
|
||||||
"github.com/admin-else/queser"
|
"github.com/admin-else/strom/data"
|
||||||
"github.com/admin-else/queser/data"
|
"github.com/admin-else/strom/proto_generated/v1_21_8"
|
||||||
"github.com/admin-else/queser/generated/v1_21_8"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type LoginClient struct {
|
type LoginClient struct {
|
||||||
*strom.Conn
|
*bot.Conn
|
||||||
Account strom.Account
|
Account api.Account
|
||||||
|
|
||||||
GivenAccount v1_21_8.LoginToClientPacketSuccess
|
GivenAccount v1_21_8.LoginToClientPacketSuccess
|
||||||
}
|
}
|
||||||
@@ -33,11 +32,11 @@ func (s *LoginClient) Default(event any) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *LoginClient) OnCycle(_ strom.OnLoopCycle) (err error) {
|
func (s *LoginClient) OnCycle(_ bot.OnLoopCycle) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *LoginClient) OnStart(_ strom.OnStart) (err error) {
|
func (s *LoginClient) OnStart(_ bot.OnStart) (err error) {
|
||||||
host, portStr, err := net.SplitHostPort(s.RemoteAddr().String())
|
host, portStr, err := net.SplitHostPort(s.RemoteAddr().String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -51,15 +50,15 @@ func (s *LoginClient) OnStart(_ strom.OnStart) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = s.Send(v1_21_8.HandshakingToServerPacketSetProtocol{
|
err = s.Send(v1_21_8.HandshakingToServerPacketSetProtocol{
|
||||||
ProtocolVersion: queser.VarInt(versionData.Version),
|
ProtocolVersion: proto_base.VarInt(versionData.Version),
|
||||||
ServerHost: host,
|
ServerHost: host,
|
||||||
ServerPort: uint16(port),
|
ServerPort: uint16(port),
|
||||||
NextState: queser.VarInt(queser.Login),
|
NextState: proto_base.VarInt(proto_base.Login),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.State = queser.Login
|
s.State = proto_base.Login
|
||||||
err = s.Send(v1_21_8.LoginToServerPacketLoginStart{Username: s.Account.Name, PlayerUUID: s.Account.Uuid})
|
err = s.Send(v1_21_8.LoginToServerPacketLoginStart{Username: s.Account.Name, PlayerUUID: s.Account.Uuid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -69,39 +68,6 @@ func (s *LoginClient) OnCompress(compress v1_21_8.LoginToClientPacketCompress) (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func twosComplement(p []byte) []byte {
|
|
||||||
carry := true
|
|
||||||
for i := len(p) - 1; i >= 0; i-- {
|
|
||||||
p[i] = byte(^p[i])
|
|
||||||
if carry {
|
|
||||||
carry = p[i] == 0xff
|
|
||||||
p[i]++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
|
|
||||||
// AuthDigest stolen from https://gist.github.com/toqueteos/5372776
|
|
||||||
func AuthDigest(elems ...[]byte) string {
|
|
||||||
h := sha1.New()
|
|
||||||
for _, elem := range elems {
|
|
||||||
h.Write(elem)
|
|
||||||
}
|
|
||||||
hash := h.Sum(nil)
|
|
||||||
|
|
||||||
negative := (hash[0] & 0x80) == 0x80
|
|
||||||
if negative {
|
|
||||||
hash = twosComplement(hash)
|
|
||||||
}
|
|
||||||
|
|
||||||
res := strings.TrimLeft(hex.EncodeToString(hash), "0")
|
|
||||||
if negative {
|
|
||||||
res = "-" + res
|
|
||||||
}
|
|
||||||
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *LoginClient) OnEncrypt(packet v1_21_8.LoginToClientPacketEncryptionBegin) (err error) {
|
func (s *LoginClient) OnEncrypt(packet v1_21_8.LoginToClientPacketEncryptionBegin) (err error) {
|
||||||
sharedSecret := make([]byte, 16)
|
sharedSecret := make([]byte, 16)
|
||||||
_, _ = rand.Read(sharedSecret) //never fails
|
_, _ = rand.Read(sharedSecret) //never fails
|
||||||
@@ -111,7 +77,7 @@ func (s *LoginClient) OnEncrypt(packet v1_21_8.LoginToClientPacketEncryptionBegi
|
|||||||
err = fmt.Errorf("the account has no token so we cant join online servers")
|
err = fmt.Errorf("the account has no token so we cant join online servers")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
serverId := AuthDigest([]byte(packet.ServerId), sharedSecret, packet.PublicKey)
|
serverId := crypto.AuthDigest([]byte(packet.ServerId), sharedSecret, packet.PublicKey)
|
||||||
err = s.Account.JoinServer(serverId)
|
err = s.Account.JoinServer(serverId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -147,11 +113,11 @@ func (s *LoginClient) OnEncrypt(packet v1_21_8.LoginToClientPacketEncryptionBegi
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.R = cipher.StreamReader{
|
s.R = cipher.StreamReader{
|
||||||
S: strom.NewCFB8Decrypt(b, sharedSecret),
|
S: crypto.NewCFB8Decrypt(b, sharedSecret),
|
||||||
R: s.Conn,
|
R: s.Conn,
|
||||||
}
|
}
|
||||||
s.W = cipher.StreamWriter{
|
s.W = cipher.StreamWriter{
|
||||||
S: strom.NewCFB8Encrypt(b, sharedSecret),
|
S: crypto.NewCFB8Encrypt(b, sharedSecret),
|
||||||
W: s.Conn,
|
W: s.Conn,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -164,12 +130,12 @@ func (s *LoginClient) OnSuccess(success v1_21_8.LoginToClientPacketSuccess) (err
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.State = queser.Configuration
|
s.State = proto_base.Configuration
|
||||||
err = strom.HandlerDone
|
err = bot.HandlerDone
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func Login(c *strom.Conn, account strom.Account) (err error) {
|
func Login(c *bot.Conn, account api.Account) (err error) {
|
||||||
err = c.Start(&LoginClient{
|
err = c.Start(&LoginClient{
|
||||||
Conn: c,
|
Conn: c,
|
||||||
Account: account,
|
Account: account,
|
||||||
@@ -5,15 +5,15 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/admin-else/strom"
|
"github.com/admin-else/strom/bot"
|
||||||
|
"github.com/admin-else/strom/proto_base"
|
||||||
|
|
||||||
"github.com/admin-else/queser"
|
"github.com/admin-else/strom/data"
|
||||||
"github.com/admin-else/queser/data"
|
"github.com/admin-else/strom/proto_generated/v1_21_8"
|
||||||
"github.com/admin-else/queser/generated/v1_21_8"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type StatusClient struct {
|
type StatusClient struct {
|
||||||
*strom.Conn
|
*bot.Conn
|
||||||
Status string
|
Status string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ func (s *StatusClient) Default(event any) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StatusClient) OnStart(_ strom.OnStart) (err error) {
|
func (s *StatusClient) OnStart(_ bot.OnStart) (err error) {
|
||||||
parts := strings.Split(s.RemoteAddr().String(), ":")
|
parts := strings.Split(s.RemoteAddr().String(), ":")
|
||||||
versionData, err := data.LookUpProtocolVersionByName(s.Version)
|
versionData, err := data.LookUpProtocolVersionByName(s.Version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -33,21 +33,21 @@ func (s *StatusClient) OnStart(_ strom.OnStart) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = s.Send(v1_21_8.HandshakingToServerPacketSetProtocol{
|
err = s.Send(v1_21_8.HandshakingToServerPacketSetProtocol{
|
||||||
ProtocolVersion: queser.VarInt(versionData.Version),
|
ProtocolVersion: proto_base.VarInt(versionData.Version),
|
||||||
ServerHost: parts[0],
|
ServerHost: parts[0],
|
||||||
ServerPort: uint16(port),
|
ServerPort: uint16(port),
|
||||||
NextState: queser.VarInt(queser.Status),
|
NextState: proto_base.VarInt(proto_base.Status),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.State = queser.Status
|
s.State = proto_base.Status
|
||||||
err = s.Send(v1_21_8.StatusToServerPacketPingStart{})
|
err = s.Send(v1_21_8.StatusToServerPacketPingStart{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StatusClient) OnStatus(p v1_21_8.StatusToClientPacketServerInfo) (err error) {
|
func (s *StatusClient) OnStatus(p v1_21_8.StatusToClientPacketServerInfo) (err error) {
|
||||||
s.Status = p.Response
|
s.Status = p.Response
|
||||||
err = strom.HandlerDone
|
err = bot.HandlerDone
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
+4
-3
@@ -5,17 +5,18 @@ import (
|
|||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
|
|
||||||
|
"github.com/admin-else/strom/api"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SecureChatSession struct {
|
type SecureChatSession struct {
|
||||||
Account *Account
|
Account *api.Account
|
||||||
PlayerKeys PlayerKeys
|
PlayerKeys api.PlayerKeys
|
||||||
Private *rsa.PrivateKey
|
Private *rsa.PrivateKey
|
||||||
SessionId uuid.UUID
|
SessionId uuid.UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSecureChat(a *Account) (s *SecureChatSession, err error) {
|
func NewSecureChat(a *api.Account) (s *SecureChatSession, err error) {
|
||||||
s = &SecureChatSession{Account: a}
|
s = &SecureChatSession{Account: a}
|
||||||
s.PlayerKeys, err = a.FetchKeys()
|
s.PlayerKeys, err = a.FetchKeys()
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package crypto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/sha1"
|
||||||
|
"encoding/hex"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func twosComplement(p []byte) []byte {
|
||||||
|
carry := true
|
||||||
|
for i := len(p) - 1; i >= 0; i-- {
|
||||||
|
p[i] = byte(^p[i])
|
||||||
|
if carry {
|
||||||
|
carry = p[i] == 0xff
|
||||||
|
p[i]++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
// AuthDigest stolen from https://gist.github.com/toqueteos/5372776
|
||||||
|
func AuthDigest(elems ...[]byte) string {
|
||||||
|
h := sha1.New()
|
||||||
|
for _, elem := range elems {
|
||||||
|
h.Write(elem)
|
||||||
|
}
|
||||||
|
hash := h.Sum(nil)
|
||||||
|
|
||||||
|
negative := (hash[0] & 0x80) == 0x80
|
||||||
|
if negative {
|
||||||
|
hash = twosComplement(hash)
|
||||||
|
}
|
||||||
|
|
||||||
|
res := strings.TrimLeft(hex.EncodeToString(hash), "0")
|
||||||
|
if negative {
|
||||||
|
res = "-" + res
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package bot
|
package crypto
|
||||||
|
|
||||||
// https://github.com/Tnze/go-mc/blob/master/net/CFB8/cfb8.go
|
// https://github.com/Tnze/go-mc/blob/master/net/CFB8/cfb8.go
|
||||||
// Package CFB8 implements CFB8 block cipher mode of operation used by Minecraft protocol.
|
// Package CFB8 implements CFB8 block cipher mode of operation used by Minecraft protocol.
|
||||||
+1
-1
@@ -3,7 +3,7 @@ package data_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/admin-else/queser/data"
|
"github.com/admin-else/strom/data"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLookupBiomeById(t *testing.T) {
|
func TestLookupBiomeById(t *testing.T) {
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/admin-else/queser/data"
|
"github.com/admin-else/strom/data"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLookupBlockByStateId(t *testing.T) {
|
func TestLookupBlockByStateId(t *testing.T) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ async function handle (ourPR, genPullNo, version, artifactURL, shouldPull) {
|
|||||||
|
|
||||||
if (ourPR.body) {
|
if (ourPR.body) {
|
||||||
await github.updateIssue(ourPR.number, {
|
await github.updateIssue(ourPR.number, {
|
||||||
body: ourPR.body.replace('<!--minecraft-data-generator-placeholder-->', `- https://github.com/PrismarineJS/minecraft-data-generator/pull/${genPullNo}`)
|
body: ourPR.body.replace('<!--minecraft-data-proto_generator-placeholder-->', `- https://github.com/PrismarineJS/minecraft-data-generator/pull/${genPullNo}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ async function main (versions, genPullNo, artifactUrl, createPR) {
|
|||||||
console.log('PR', details)
|
console.log('PR', details)
|
||||||
await handle(details, genPullNo, version, artifactUrl, true)
|
await handle(details, genPullNo, version, artifactUrl, true)
|
||||||
} else if (createPR) {
|
} else if (createPR) {
|
||||||
const pr = await createInitialPR('pc', '(This issue was created for a minecraft-data-generator PR)', {
|
const pr = await createInitialPR('pc', '(This issue was created for a minecraft-data-proto_generator PR)', {
|
||||||
version,
|
version,
|
||||||
protocolVersion: null
|
protocolVersion: null
|
||||||
})
|
})
|
||||||
|
|||||||
+2
-2
@@ -166,10 +166,10 @@ async function openIssueAndDispatch (title, versionJson, latestVersionData, late
|
|||||||
protocolVersion: versionJson.protocol_version
|
protocolVersion: versionJson.protocol_version
|
||||||
})
|
})
|
||||||
console.log('Created PR', pr)
|
console.log('Created PR', pr)
|
||||||
// Ask minecraft-data-generator to handle new update
|
// Ask minecraft-data-proto_generator to handle new update
|
||||||
const dispatchPayload = {
|
const dispatchPayload = {
|
||||||
owner: 'PrismarineJS',
|
owner: 'PrismarineJS',
|
||||||
repo: 'minecraft-data-generator',
|
repo: 'minecraft-data-proto_generator',
|
||||||
workflow: 'handle-mcdata-update.yml',
|
workflow: 'handle-mcdata-update.yml',
|
||||||
branch: 'main',
|
branch: 'main',
|
||||||
inputs: {
|
inputs: {
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
name: handle-mcpc-generator
|
name: handle-mcpc-proto_generator
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
versions:
|
versions:
|
||||||
description: 'JSON stringified list of known versions in generator (last is expected to be latest)'
|
description: 'JSON stringified list of known versions in proto_generator (last is expected to be latest)'
|
||||||
required: true
|
required: true
|
||||||
default: '["1.21.6"]'
|
default: '["1.21.6"]'
|
||||||
mergedArtifactURL:
|
mergedArtifactURL:
|
||||||
description: 'Merged artifact download URL'
|
description: 'Merged artifact download URL'
|
||||||
required: true
|
required: true
|
||||||
prNumber:
|
prNumber:
|
||||||
description: 'Relevant minecraft-data-generator PR #'
|
description: 'Relevant minecraft-data-proto_generator PR #'
|
||||||
required: false
|
required: false
|
||||||
createPr:
|
createPr:
|
||||||
description: 'Whether to create a new PR if none exists'
|
description: 'Whether to create a new PR if none exists'
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ packet_start_game:
|
|||||||
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
||||||
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
||||||
dimension: zigzag32
|
dimension: zigzag32
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ packet_start_game:
|
|||||||
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
||||||
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
||||||
dimension: zigzag32
|
dimension: zigzag32
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ packet_start_game:
|
|||||||
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
||||||
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
||||||
dimension: zigzag32
|
dimension: zigzag32
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -236,7 +236,7 @@ packet_start_game:
|
|||||||
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
||||||
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
||||||
dimension: zigzag32
|
dimension: zigzag32
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -238,7 +238,7 @@ packet_start_game:
|
|||||||
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
||||||
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
||||||
dimension: zigzag32
|
dimension: zigzag32
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -238,7 +238,7 @@ packet_start_game:
|
|||||||
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
||||||
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
||||||
dimension: zigzag32
|
dimension: zigzag32
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -238,7 +238,7 @@ packet_start_game:
|
|||||||
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
||||||
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
||||||
dimension: zigzag32
|
dimension: zigzag32
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -238,7 +238,7 @@ packet_start_game:
|
|||||||
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
||||||
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
||||||
dimension: zigzag32
|
dimension: zigzag32
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -238,7 +238,7 @@ packet_start_game:
|
|||||||
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
# Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2,
|
||||||
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
# with 0 being the overworld, 1 being the nether and 2 being the end.
|
||||||
dimension: zigzag32
|
dimension: zigzag32
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -241,7 +241,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -241,7 +241,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -245,7 +245,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -245,7 +245,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -245,7 +245,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -246,7 +246,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -246,7 +246,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -246,7 +246,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -246,7 +246,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -246,7 +246,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -246,7 +246,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -246,7 +246,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -246,7 +246,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -246,7 +246,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -251,7 +251,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -254,7 +254,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -254,7 +254,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -254,7 +254,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -257,7 +257,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -258,7 +258,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -259,7 +259,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -149,11 +149,11 @@ packet_resource_packs_info:
|
|||||||
disable_vibrant_visuals: bool
|
disable_vibrant_visuals: bool
|
||||||
world_template:
|
world_template:
|
||||||
# WorldTemplateUUID is teh UUID of the template that has been used to generate the world. Templates can
|
# WorldTemplateUUID is teh 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
|
# be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not proto_generated
|
||||||
# from a template, this field is empty.
|
# from a template, this field is empty.
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
# WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
# 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.
|
# the world was not proto_generated from a template, this field is empty.
|
||||||
version: string
|
version: string
|
||||||
# A list of resource packs that the client needs to download before joining the server.
|
# A list of resource packs that the client needs to download before joining the server.
|
||||||
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
||||||
@@ -274,7 +274,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -149,11 +149,11 @@ packet_resource_packs_info:
|
|||||||
disable_vibrant_visuals: bool
|
disable_vibrant_visuals: bool
|
||||||
world_template:
|
world_template:
|
||||||
# WorldTemplateUUID is teh UUID of the template that has been used to generate the world. Templates can
|
# WorldTemplateUUID is teh 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
|
# be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not proto_generated
|
||||||
# from a template, this field is empty.
|
# from a template, this field is empty.
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
# WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
# 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.
|
# the world was not proto_generated from a template, this field is empty.
|
||||||
version: string
|
version: string
|
||||||
# A list of resource packs that the client needs to download before joining the server.
|
# A list of resource packs that the client needs to download before joining the server.
|
||||||
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
||||||
@@ -274,7 +274,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -149,11 +149,11 @@ packet_resource_packs_info:
|
|||||||
disable_vibrant_visuals: bool
|
disable_vibrant_visuals: bool
|
||||||
world_template:
|
world_template:
|
||||||
# WorldTemplateUUID is teh UUID of the template that has been used to generate the world. Templates can
|
# WorldTemplateUUID is teh 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
|
# be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not proto_generated
|
||||||
# from a template, this field is empty.
|
# from a template, this field is empty.
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
# WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
# 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.
|
# the world was not proto_generated from a template, this field is empty.
|
||||||
version: string
|
version: string
|
||||||
# A list of resource packs that the client needs to download before joining the server.
|
# A list of resource packs that the client needs to download before joining the server.
|
||||||
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
||||||
@@ -274,7 +274,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -259,7 +259,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -263,7 +263,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -258,7 +258,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -257,7 +257,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -140,11 +140,11 @@ packet_resource_packs_info:
|
|||||||
has_scripts: bool
|
has_scripts: bool
|
||||||
world_template:
|
world_template:
|
||||||
# WorldTemplateUUID is teh UUID of the template that has been used to generate the world. Templates can
|
# WorldTemplateUUID is teh 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
|
# be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not proto_generated
|
||||||
# from a template, this field is empty.
|
# from a template, this field is empty.
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
# WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
# 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.
|
# the world was not proto_generated from a template, this field is empty.
|
||||||
version: string
|
version: string
|
||||||
# A list of resource packs that the client needs to download before joining the server.
|
# A list of resource packs that the client needs to download before joining the server.
|
||||||
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
||||||
@@ -265,7 +265,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -141,11 +141,11 @@ packet_resource_packs_info:
|
|||||||
has_scripts: bool
|
has_scripts: bool
|
||||||
world_template:
|
world_template:
|
||||||
# WorldTemplateUUID is teh UUID of the template that has been used to generate the world. Templates can
|
# WorldTemplateUUID is teh 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
|
# be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not proto_generated
|
||||||
# from a template, this field is empty.
|
# from a template, this field is empty.
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
# WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
# 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.
|
# the world was not proto_generated from a template, this field is empty.
|
||||||
version: string
|
version: string
|
||||||
# A list of resource packs that the client needs to download before joining the server.
|
# A list of resource packs that the client needs to download before joining the server.
|
||||||
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
||||||
@@ -266,7 +266,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -141,11 +141,11 @@ packet_resource_packs_info:
|
|||||||
has_scripts: bool
|
has_scripts: bool
|
||||||
world_template:
|
world_template:
|
||||||
# WorldTemplateUUID is teh UUID of the template that has been used to generate the world. Templates can
|
# WorldTemplateUUID is teh 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
|
# be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not proto_generated
|
||||||
# from a template, this field is empty.
|
# from a template, this field is empty.
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
# WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
# 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.
|
# the world was not proto_generated from a template, this field is empty.
|
||||||
version: string
|
version: string
|
||||||
# A list of resource packs that the client needs to download before joining the server.
|
# A list of resource packs that the client needs to download before joining the server.
|
||||||
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
||||||
@@ -266,7 +266,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -141,11 +141,11 @@ packet_resource_packs_info:
|
|||||||
has_scripts: bool
|
has_scripts: bool
|
||||||
world_template:
|
world_template:
|
||||||
# WorldTemplateUUID is teh UUID of the template that has been used to generate the world. Templates can
|
# WorldTemplateUUID is teh 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
|
# be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not proto_generated
|
||||||
# from a template, this field is empty.
|
# from a template, this field is empty.
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
# WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
# 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.
|
# the world was not proto_generated from a template, this field is empty.
|
||||||
version: string
|
version: string
|
||||||
# A list of resource packs that the client needs to download before joining the server.
|
# A list of resource packs that the client needs to download before joining the server.
|
||||||
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
||||||
@@ -266,7 +266,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -149,11 +149,11 @@ packet_resource_packs_info:
|
|||||||
disable_vibrant_visuals: bool
|
disable_vibrant_visuals: bool
|
||||||
world_template:
|
world_template:
|
||||||
# WorldTemplateUUID is teh UUID of the template that has been used to generate the world. Templates can
|
# WorldTemplateUUID is teh 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
|
# be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not proto_generated
|
||||||
# from a template, this field is empty.
|
# from a template, this field is empty.
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
# WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
# 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.
|
# the world was not proto_generated from a template, this field is empty.
|
||||||
version: string
|
version: string
|
||||||
# A list of resource packs that the client needs to download before joining the server.
|
# A list of resource packs that the client needs to download before joining the server.
|
||||||
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
||||||
@@ -274,7 +274,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -149,11 +149,11 @@ packet_resource_packs_info:
|
|||||||
disable_vibrant_visuals: bool
|
disable_vibrant_visuals: bool
|
||||||
world_template:
|
world_template:
|
||||||
# WorldTemplateUUID is teh UUID of the template that has been used to generate the world. Templates can
|
# WorldTemplateUUID is teh 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
|
# be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not proto_generated
|
||||||
# from a template, this field is empty.
|
# from a template, this field is empty.
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
# WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
# 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.
|
# the world was not proto_generated from a template, this field is empty.
|
||||||
version: string
|
version: string
|
||||||
# A list of resource packs that the client needs to download before joining the server.
|
# A list of resource packs that the client needs to download before joining the server.
|
||||||
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
||||||
@@ -274,7 +274,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ nbtLoop: native
|
|||||||
enum_size_based_on_values_len: native # Packet-specific custom logic
|
enum_size_based_on_values_len: native # Packet-specific custom logic
|
||||||
MapInfo: native
|
MapInfo: native
|
||||||
|
|
||||||
# load the packet map file (auto-generated)
|
# load the packet map file (auto-proto_generated)
|
||||||
!import: packet_map.yml
|
!import: packet_map.yml
|
||||||
|
|
||||||
!StartDocs: Packets
|
!StartDocs: Packets
|
||||||
@@ -149,11 +149,11 @@ packet_resource_packs_info:
|
|||||||
disable_vibrant_visuals: bool
|
disable_vibrant_visuals: bool
|
||||||
world_template:
|
world_template:
|
||||||
# WorldTemplateUUID is teh UUID of the template that has been used to generate the world. Templates can
|
# WorldTemplateUUID is teh 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
|
# be downloaded from the marketplace or installed via '.mctemplate' files. If the world was not proto_generated
|
||||||
# from a template, this field is empty.
|
# from a template, this field is empty.
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
# WorldTemplateVersion is the version of the world template that has been used to generate the world. If
|
# 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.
|
# the world was not proto_generated from a template, this field is empty.
|
||||||
version: string
|
version: string
|
||||||
# A list of resource packs that the client needs to download before joining the server.
|
# A list of resource packs that the client needs to download before joining the server.
|
||||||
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
# The order of these resource packs is not relevant in this packet. It is however important in the Resource Pack Stack packet.
|
||||||
@@ -274,7 +274,7 @@ packet_start_game:
|
|||||||
0: overworld
|
0: overworld
|
||||||
1: nether
|
1: nether
|
||||||
2: end
|
2: end
|
||||||
# Generator is the generator used for the world. It is a value from 0-4, with 0 being old
|
# Generator is the proto_generator used for the world. It is a value from 0-4, with 0 being old
|
||||||
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
# limited worlds, 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and
|
||||||
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
# 4 being end worlds. A value of 0 will actually make the client stop rendering chunks you
|
||||||
# send beyond the world limit.
|
# send beyond the world limit.
|
||||||
|
|||||||
@@ -555,7 +555,7 @@
|
|||||||
|
|
||||||
# This represents a single component within an UntrustedSlot.
|
# This represents a single component within an UntrustedSlot.
|
||||||
# The 'data' field is a varint-prefixed byte array that contains the actual component data.
|
# The 'data' field is a varint-prefixed byte array that contains the actual component data.
|
||||||
# The code generator will need to know that it should read a varint for length, then the bytes.
|
# The code proto_generator will need to know that it should read a varint for length, then the bytes.
|
||||||
UntrustedSlotComponent:
|
UntrustedSlotComponent:
|
||||||
type: SlotComponentType
|
type: SlotComponentType
|
||||||
data: ByteArray
|
data: ByteArray
|
||||||
|
|||||||
@@ -558,7 +558,7 @@
|
|||||||
|
|
||||||
# This represents a single component within an UntrustedSlot.
|
# This represents a single component within an UntrustedSlot.
|
||||||
# The 'data' field is a varint-prefixed byte array that contains the actual component data.
|
# The 'data' field is a varint-prefixed byte array that contains the actual component data.
|
||||||
# The code generator will need to know that it should read a varint for length, then the bytes.
|
# The code proto_generator will need to know that it should read a varint for length, then the bytes.
|
||||||
UntrustedSlotComponent:
|
UntrustedSlotComponent:
|
||||||
type: SlotComponentType
|
type: SlotComponentType
|
||||||
data: ByteArray
|
data: ByteArray
|
||||||
|
|||||||
@@ -558,7 +558,7 @@
|
|||||||
|
|
||||||
# This represents a single component within an UntrustedSlot.
|
# This represents a single component within an UntrustedSlot.
|
||||||
# The 'data' field is a varint-prefixed byte array that contains the actual component data.
|
# The 'data' field is a varint-prefixed byte array that contains the actual component data.
|
||||||
# The code generator will need to know that it should read a varint for length, then the bytes.
|
# The code proto_generator will need to know that it should read a varint for length, then the bytes.
|
||||||
UntrustedSlotComponent:
|
UntrustedSlotComponent:
|
||||||
type: SlotComponentType
|
type: SlotComponentType
|
||||||
data: ByteArray
|
data: ByteArray
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ function validate (edition, ver, path) {
|
|||||||
? JSON.stringify({ types: json }, visitor, 2)
|
? JSON.stringify({ types: json }, visitor, 2)
|
||||||
: JSON.stringify(json, visitor, 2)
|
: JSON.stringify(json, visitor, 2)
|
||||||
|
|
||||||
// If you crash here, no protocol.json was generated - run `npm run build`
|
// If you crash here, no protocol.json was proto_generated - run `npm run build`
|
||||||
const actual = JSON.stringify(getJSON(`../${version}/protocol.json`), null, 2)
|
const actual = JSON.stringify(getJSON(`../${version}/protocol.json`), null, 2)
|
||||||
|
|
||||||
// Make sure the protocol_expected.json file equals the protocol.json file; otherwise the JSON must be rebuilt
|
// Make sure the protocol_expected.json file equals the protocol.json file; otherwise the JSON must be rebuilt
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package data_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/admin-else/queser/data"
|
"github.com/admin-else/strom/data"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLookUpProtocolVersion(t *testing.T) {
|
func TestLookUpProtocolVersion(t *testing.T) {
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
package generated
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"github.com/admin-else/queser"
|
|
||||||
"github.com/admin-else/queser/generated/v1_21_8"
|
|
||||||
)
|
|
||||||
|
|
||||||
func PacketIdentifierToType(v string, d queser.Direction, s queser.State, i string) (t any) {
|
|
||||||
switch v {
|
|
||||||
case "1.21.8":
|
|
||||||
t = v1_21_8.PacketIdentifierToType(d, s, i)
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
func TypeToPacketIdentifier(v string, d queser.Direction, s queser.State, t any) (i string) {
|
|
||||||
switch v {
|
|
||||||
case "1.21.8":
|
|
||||||
i = v1_21_8.TypeToPacketIdentifier(d, s, t)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
func DecodePacket(v string, d queser.Direction, s queser.State, r io.Reader) (packet any, err error) {
|
|
||||||
switch v {
|
|
||||||
case "1.21.8":
|
|
||||||
packet, err = v1_21_8.DecodePacket(d, s, r)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
func EncodePacket(v string, d queser.Direction, s queser.State, i string, p any, w io.Writer) (err error) {
|
|
||||||
switch v {
|
|
||||||
case "1.21.8":
|
|
||||||
err = v1_21_8.EncodePacket(d, s, i, p, w)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
@@ -3,3 +3,8 @@ module github.com/admin-else/strom
|
|||||||
go 1.24
|
go 1.24
|
||||||
|
|
||||||
require github.com/google/uuid v1.6.0
|
require github.com/google/uuid v1.6.0
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
|
||||||
|
github.com/google/go-cmp v0.7.0 // indirect
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
github.com/admin-else/queser v0.0.0-20251204142744-84a884c09415 h1:79NZpiedySnmgHDh/SebJ6qIenijozOOmiVys8P1y9Q=
|
||||||
|
github.com/admin-else/queser v0.0.0-20251204142744-84a884c09415/go.mod h1:yDPy6zf+PgSaggT3ongNpb6JSgNFt6Z8ryomGEbLNmE=
|
||||||
|
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
|
||||||
|
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package proto_base_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"math"
|
||||||
|
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/admin-else/strom/nbt"
|
||||||
|
"github.com/admin-else/strom/proto_base"
|
||||||
|
"github.com/admin-else/strom/proto_generated/v1_21_8"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
|
||||||
|
"github.com/google/go-cmp/cmp"
|
||||||
|
)
|
||||||
|
|
||||||
|
var nanIgnorer32 = cmp.Comparer(func(x, y float32) bool {
|
||||||
|
return (math.IsNaN(float64(x)) && math.IsNaN(float64(y))) || x == y
|
||||||
|
})
|
||||||
|
|
||||||
|
var nanIgnorer64 = cmp.Comparer(func(x, y float64) bool {
|
||||||
|
return (math.IsNaN(x) && math.IsNaN(y)) || x == y
|
||||||
|
})
|
||||||
|
|
||||||
|
func TestChat(t *testing.T) {
|
||||||
|
//p := v1_21_8.PlayToServerPacketChatMessage{Message: "dfs", Timestamp: 1764153707364, Salt: -5634100397920314628, Signature: (*[256]uint8)(nil), Offset: 0, Acknowledged: [3]uint8{0x0, 0x0, 0x0}, Checksum: 0x1}
|
||||||
|
p := v1_21_8.PlayToClientPacketPlayerChat{GlobalIndex: 0, SenderUuid: uuid.UUID{0x1d, 0xc5, 0x57, 0x82, 0x3c, 0x0, 0x3e, 0xd4, 0xbf, 0x8b, 0x76, 0xd4, 0xc6, 0xd9, 0xcc, 0x47}, Index: 0, Signature: (*[256]uint8)(nil), PlainMessage: "csdf", Timestamp: 1764153823132, Salt: 0, PreviousMessages: v1_21_8.PreviousMessages{Val: []struct {
|
||||||
|
Id proto_base.VarInt
|
||||||
|
Signature interface{}
|
||||||
|
}{}}, UnsignedChatContent: (*nbt.Anon)(nil), FilterType: 0, FilterTypeMask: proto_base.Void{}, Type: v1_21_8.PlayToClientChatTypesHolder{Val: proto_base.VarInt(1)}, NetworkName: nbt.Anon{Value: map[string]interface{}{"click_event": map[string]interface{}{"action": "suggest_command", "command": "/tell Player659 "}, "hover_event": map[string]interface{}{"action": "show_entity", "id": "minecraft:player", "name": "Player659", "uuid": []int32{499472258, 1006649044, -1081379116, -958804921}}, "insertion": "Player659", "text": "Player659"}}, NetworkTargetName: (*nbt.Anon)(nil)}
|
||||||
|
b := bytes.NewBuffer(nil)
|
||||||
|
err := p.Encode(b)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Logf("%q", b.Bytes())
|
||||||
|
}
|
||||||
|
|
||||||
|
func FuzzPlayPackets(f *testing.F) {
|
||||||
|
f.Fuzz(func(t *testing.T, b []byte) {
|
||||||
|
t.Logf("Fuzz data %q\n", b)
|
||||||
|
p := v1_21_8.PlayToClientPacket{}
|
||||||
|
b1 := bytes.NewBuffer(b)
|
||||||
|
p, err := p.Decode(b1)
|
||||||
|
if err != nil {
|
||||||
|
t.Skipf("failed to decode %q because %v (partial %v)", b, err, p)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if b1.Len() != 0 {
|
||||||
|
t.Skipf("there are %d bytes left it should be read entirely", b1.Len())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Logf("decoded %#v\n", p)
|
||||||
|
b2 := bytes.NewBuffer(nil)
|
||||||
|
err = p.Encode(b2)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("failed to encode %q because %v", b, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Logf("encoded %q\n", b2.Bytes())
|
||||||
|
p2 := v1_21_8.PlayToClientPacket{}
|
||||||
|
p2, err = p2.Decode(b2)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("failed to decode encoded data: %v (partial %#v)", err, p2)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !cmp.Equal(p, p2, nanIgnorer32, nanIgnorer64) {
|
||||||
|
t.Errorf("decoded and encoded decoded data are not equal: %#v", p2)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
package proto_base
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/binary"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Direction int
|
||||||
|
|
||||||
|
const (
|
||||||
|
ToServer Direction = iota
|
||||||
|
ToClient
|
||||||
|
)
|
||||||
|
|
||||||
|
type State int
|
||||||
|
|
||||||
|
const (
|
||||||
|
Handshaking State = iota
|
||||||
|
Status
|
||||||
|
Login
|
||||||
|
Configuration
|
||||||
|
Play
|
||||||
|
)
|
||||||
|
|
||||||
|
type PacketIdentifier struct {
|
||||||
|
Direction Direction
|
||||||
|
State State
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
type (
|
||||||
|
VarInt int32
|
||||||
|
ToDo struct{}
|
||||||
|
Void struct{}
|
||||||
|
RestBuffer []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
func (v Void) Encode(_ io.Writer) (err error) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v Void) Decode(_ io.Reader) (ret Void, err error) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var ToDoError = errors.New("to do")
|
||||||
|
var BadTypeError = errors.New("bad type")
|
||||||
|
|
||||||
|
func (r RestBuffer) Encode(w io.Writer) (err error) {
|
||||||
|
_, err = w.Write(r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (RestBuffer) Decode(r io.Reader) (ret RestBuffer, err error) {
|
||||||
|
b, err := io.ReadAll(r)
|
||||||
|
ret = b
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func EncodeString(w io.Writer, s string) (err error) {
|
||||||
|
err = VarInt(len(s)).Encode(w)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, err = w.Write([]byte(s))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func DecodeString(r io.Reader) (ret string, err error) {
|
||||||
|
var l VarInt
|
||||||
|
l, err = l.Decode(r)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rawString, err := io.ReadAll(io.LimitReader(r, int64(l)))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(rawString) != int(l) {
|
||||||
|
err = errors.New("bad string length")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return string(rawString), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t ToDo) Encode(_ io.Writer) (err error) {
|
||||||
|
err = ToDoError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t ToDo) Decode(_ io.Reader) (ret ToDo, err error) {
|
||||||
|
err = ToDoError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v VarInt) Encode(w io.Writer) (err error) {
|
||||||
|
uv := uint32(v)
|
||||||
|
for {
|
||||||
|
b := uint8(uv & 0x7F)
|
||||||
|
uv >>= 7
|
||||||
|
if uv != 0 {
|
||||||
|
b |= 0x80
|
||||||
|
}
|
||||||
|
err := binary.Write(w, binary.BigEndian, b)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if uv == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v VarInt) Decode(r io.Reader) (ret VarInt, err error) {
|
||||||
|
for i := range 5 { // 32/7
|
||||||
|
var b uint8 = 0
|
||||||
|
err = binary.Read(r, binary.BigEndian, &b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ret |= VarInt(uint32(b&0x7F) << (7 * uint32(i)))
|
||||||
|
if b&0x80 == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = errors.New("VarInt too long")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func ErroringIndex[K comparable, V any, M map[K]V](m M, i K) (v V, err error) {
|
||||||
|
var ok bool
|
||||||
|
v, ok = m[i]
|
||||||
|
if !ok {
|
||||||
|
err = errors.New("index not found")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type EncodeDecodeAble[Self any] interface {
|
||||||
|
Encode(w io.Writer) (err error)
|
||||||
|
Decode(r io.Reader) (ret Self, err error)
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package v1_21_8
|
package v1_21_8
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/admin-else/strom/proto_base"
|
||||||
"io"
|
"io"
|
||||||
"github.com/admin-else/queser"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func HandshakingToServerPacketIdentifierToType(s string) (t any) {
|
func HandshakingToServerPacketIdentifierToType(s string) (t any) {
|
||||||
@@ -582,7 +582,7 @@ func PlayToClientPacketIdentifierToType(s string) (t any) {
|
|||||||
case "boss_bar":
|
case "boss_bar":
|
||||||
t = PlayToClientPacketBossBar{}
|
t = PlayToClientPacketBossBar{}
|
||||||
case "bundle_delimiter":
|
case "bundle_delimiter":
|
||||||
t = queser.Void{}
|
t = proto_base.Void{}
|
||||||
case "camera":
|
case "camera":
|
||||||
t = PlayToClientPacketCamera{}
|
t = PlayToClientPacketCamera{}
|
||||||
case "chat_suggestions":
|
case "chat_suggestions":
|
||||||
@@ -1100,109 +1100,109 @@ func PlayToClientTypeToPacketIdentifier(t any) (s string) {
|
|||||||
s = "world_event"
|
s = "world_event"
|
||||||
case PlayToClientPacketWorldParticles:
|
case PlayToClientPacketWorldParticles:
|
||||||
s = "world_particles"
|
s = "world_particles"
|
||||||
case queser.Void:
|
case proto_base.Void:
|
||||||
s = "bundle_delimiter"
|
s = "bundle_delimiter"
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func TypeToPacketIdentifier(d queser.Direction, s queser.State, t any) (i string) {
|
func TypeToPacketIdentifier(d proto_base.Direction, s proto_base.State, t any) (i string) {
|
||||||
switch d {
|
switch d {
|
||||||
case queser.ToServer:
|
case proto_base.ToServer:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
i = HandshakingToServerTypeToPacketIdentifier(t)
|
i = HandshakingToServerTypeToPacketIdentifier(t)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
i = StatusToServerTypeToPacketIdentifier(t)
|
i = StatusToServerTypeToPacketIdentifier(t)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
i = LoginToServerTypeToPacketIdentifier(t)
|
i = LoginToServerTypeToPacketIdentifier(t)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
i = ConfigurationToServerTypeToPacketIdentifier(t)
|
i = ConfigurationToServerTypeToPacketIdentifier(t)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
i = PlayToServerTypeToPacketIdentifier(t)
|
i = PlayToServerTypeToPacketIdentifier(t)
|
||||||
}
|
}
|
||||||
case queser.ToClient:
|
case proto_base.ToClient:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
i = HandshakingToClientTypeToPacketIdentifier(t)
|
i = HandshakingToClientTypeToPacketIdentifier(t)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
i = StatusToClientTypeToPacketIdentifier(t)
|
i = StatusToClientTypeToPacketIdentifier(t)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
i = LoginToClientTypeToPacketIdentifier(t)
|
i = LoginToClientTypeToPacketIdentifier(t)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
i = ConfigurationToClientTypeToPacketIdentifier(t)
|
i = ConfigurationToClientTypeToPacketIdentifier(t)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
i = PlayToClientTypeToPacketIdentifier(t)
|
i = PlayToClientTypeToPacketIdentifier(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func PacketIdentifierToType(d queser.Direction, s queser.State, i string) (t any) {
|
func PacketIdentifierToType(d proto_base.Direction, s proto_base.State, i string) (t any) {
|
||||||
switch d {
|
switch d {
|
||||||
case queser.ToServer:
|
case proto_base.ToServer:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
t = HandshakingToServerPacketIdentifierToType(i)
|
t = HandshakingToServerPacketIdentifierToType(i)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
t = StatusToServerPacketIdentifierToType(i)
|
t = StatusToServerPacketIdentifierToType(i)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
t = LoginToServerPacketIdentifierToType(i)
|
t = LoginToServerPacketIdentifierToType(i)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
t = ConfigurationToServerPacketIdentifierToType(i)
|
t = ConfigurationToServerPacketIdentifierToType(i)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
t = PlayToServerPacketIdentifierToType(i)
|
t = PlayToServerPacketIdentifierToType(i)
|
||||||
}
|
}
|
||||||
case queser.ToClient:
|
case proto_base.ToClient:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
t = HandshakingToClientPacketIdentifierToType(i)
|
t = HandshakingToClientPacketIdentifierToType(i)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
t = StatusToClientPacketIdentifierToType(i)
|
t = StatusToClientPacketIdentifierToType(i)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
t = LoginToClientPacketIdentifierToType(i)
|
t = LoginToClientPacketIdentifierToType(i)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
t = ConfigurationToClientPacketIdentifierToType(i)
|
t = ConfigurationToClientPacketIdentifierToType(i)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
t = PlayToClientPacketIdentifierToType(i)
|
t = PlayToClientPacketIdentifierToType(i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func DecodePacket(d queser.Direction, s queser.State, r io.Reader) (params any, err error) {
|
func DecodePacket(d proto_base.Direction, s proto_base.State, r io.Reader) (params any, err error) {
|
||||||
switch d {
|
switch d {
|
||||||
case queser.ToServer:
|
case proto_base.ToServer:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
var packet HandshakingToServerPacket
|
var packet HandshakingToServerPacket
|
||||||
packet, err = HandshakingToServerPacket{}.Decode(r)
|
packet, err = HandshakingToServerPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
var packet StatusToServerPacket
|
var packet StatusToServerPacket
|
||||||
packet, err = StatusToServerPacket{}.Decode(r)
|
packet, err = StatusToServerPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
var packet LoginToServerPacket
|
var packet LoginToServerPacket
|
||||||
packet, err = LoginToServerPacket{}.Decode(r)
|
packet, err = LoginToServerPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
var packet ConfigurationToServerPacket
|
var packet ConfigurationToServerPacket
|
||||||
packet, err = ConfigurationToServerPacket{}.Decode(r)
|
packet, err = ConfigurationToServerPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
var packet PlayToServerPacket
|
var packet PlayToServerPacket
|
||||||
packet, err = PlayToServerPacket{}.Decode(r)
|
packet, err = PlayToServerPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1210,37 +1210,37 @@ func DecodePacket(d queser.Direction, s queser.State, r io.Reader) (params any,
|
|||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
}
|
}
|
||||||
case queser.ToClient:
|
case proto_base.ToClient:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
var packet HandshakingToClientPacket
|
var packet HandshakingToClientPacket
|
||||||
packet, err = HandshakingToClientPacket{}.Decode(r)
|
packet, err = HandshakingToClientPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
var packet StatusToClientPacket
|
var packet StatusToClientPacket
|
||||||
packet, err = StatusToClientPacket{}.Decode(r)
|
packet, err = StatusToClientPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
var packet LoginToClientPacket
|
var packet LoginToClientPacket
|
||||||
packet, err = LoginToClientPacket{}.Decode(r)
|
packet, err = LoginToClientPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
var packet ConfigurationToClientPacket
|
var packet ConfigurationToClientPacket
|
||||||
packet, err = ConfigurationToClientPacket{}.Decode(r)
|
packet, err = ConfigurationToClientPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
var packet PlayToClientPacket
|
var packet PlayToClientPacket
|
||||||
packet, err = PlayToClientPacket{}.Decode(r)
|
packet, err = PlayToClientPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1252,32 +1252,32 @@ func DecodePacket(d queser.Direction, s queser.State, r io.Reader) (params any,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func EncodePacket(d queser.Direction, s queser.State, i string, p any, w io.Writer) (err error) {
|
func EncodePacket(d proto_base.Direction, s proto_base.State, i string, p any, w io.Writer) (err error) {
|
||||||
switch d {
|
switch d {
|
||||||
case queser.ToServer:
|
case proto_base.ToServer:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
err = HandshakingToServerPacket{i, p}.Encode(w)
|
err = HandshakingToServerPacket{i, p}.Encode(w)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
err = StatusToServerPacket{i, p}.Encode(w)
|
err = StatusToServerPacket{i, p}.Encode(w)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
err = LoginToServerPacket{i, p}.Encode(w)
|
err = LoginToServerPacket{i, p}.Encode(w)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
err = ConfigurationToServerPacket{i, p}.Encode(w)
|
err = ConfigurationToServerPacket{i, p}.Encode(w)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
err = PlayToServerPacket{i, p}.Encode(w)
|
err = PlayToServerPacket{i, p}.Encode(w)
|
||||||
}
|
}
|
||||||
case queser.ToClient:
|
case proto_base.ToClient:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
err = HandshakingToClientPacket{i, p}.Encode(w)
|
err = HandshakingToClientPacket{i, p}.Encode(w)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
err = StatusToClientPacket{i, p}.Encode(w)
|
err = StatusToClientPacket{i, p}.Encode(w)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
err = LoginToClientPacket{i, p}.Encode(w)
|
err = LoginToClientPacket{i, p}.Encode(w)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
err = ConfigurationToClientPacket{i, p}.Encode(w)
|
err = ConfigurationToClientPacket{i, p}.Encode(w)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
err = PlayToClientPacket{i, p}.Encode(w)
|
err = PlayToClientPacket{i, p}.Encode(w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
|||||||
|
package proto_generated
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/admin-else/strom/proto_base"
|
||||||
|
"github.com/admin-else/strom/proto_generated/v1_21_8"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PacketIdentifierToType(v string, d proto_base.Direction, s proto_base.State, i string) (t any) {
|
||||||
|
switch v {
|
||||||
|
case "1.21.8":
|
||||||
|
t = v1_21_8.PacketIdentifierToType(d, s, i)
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func TypeToPacketIdentifier(v string, d proto_base.Direction, s proto_base.State, t any) (i string) {
|
||||||
|
switch v {
|
||||||
|
case "1.21.8":
|
||||||
|
i = v1_21_8.TypeToPacketIdentifier(d, s, t)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func DecodePacket(v string, d proto_base.Direction, s proto_base.State, r io.Reader) (packet any, err error) {
|
||||||
|
switch v {
|
||||||
|
case "1.21.8":
|
||||||
|
packet, err = v1_21_8.DecodePacket(d, s, r)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func EncodePacket(v string, d proto_base.Direction, s proto_base.State, i string, p any, w io.Writer) (err error) {
|
||||||
|
switch v {
|
||||||
|
case "1.21.8":
|
||||||
|
err = v1_21_8.EncodePacket(d, s, i, p, w)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
@@ -1,101 +1,101 @@
|
|||||||
|
|
||||||
func TypeToPacketIdentifier(d queser.Direction, s queser.State, t any) (i string) {
|
func TypeToPacketIdentifier(d proto_base.Direction, s proto_base.State, t any) (i string) {
|
||||||
switch d {
|
switch d {
|
||||||
case queser.ToServer:
|
case proto_base.ToServer:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
i = HandshakingToServerTypeToPacketIdentifier(t)
|
i = HandshakingToServerTypeToPacketIdentifier(t)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
i = StatusToServerTypeToPacketIdentifier(t)
|
i = StatusToServerTypeToPacketIdentifier(t)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
i = LoginToServerTypeToPacketIdentifier(t)
|
i = LoginToServerTypeToPacketIdentifier(t)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
i = ConfigurationToServerTypeToPacketIdentifier(t)
|
i = ConfigurationToServerTypeToPacketIdentifier(t)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
i = PlayToServerTypeToPacketIdentifier(t)
|
i = PlayToServerTypeToPacketIdentifier(t)
|
||||||
}
|
}
|
||||||
case queser.ToClient:
|
case proto_base.ToClient:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
i = HandshakingToClientTypeToPacketIdentifier(t)
|
i = HandshakingToClientTypeToPacketIdentifier(t)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
i = StatusToClientTypeToPacketIdentifier(t)
|
i = StatusToClientTypeToPacketIdentifier(t)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
i = LoginToClientTypeToPacketIdentifier(t)
|
i = LoginToClientTypeToPacketIdentifier(t)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
i = ConfigurationToClientTypeToPacketIdentifier(t)
|
i = ConfigurationToClientTypeToPacketIdentifier(t)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
i = PlayToClientTypeToPacketIdentifier(t)
|
i = PlayToClientTypeToPacketIdentifier(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func PacketIdentifierToType(d queser.Direction, s queser.State, i string) (t any) {
|
func PacketIdentifierToType(d proto_base.Direction, s proto_base.State, i string) (t any) {
|
||||||
switch d {
|
switch d {
|
||||||
case queser.ToServer:
|
case proto_base.ToServer:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
t = HandshakingToServerPacketIdentifierToType(i)
|
t = HandshakingToServerPacketIdentifierToType(i)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
t = StatusToServerPacketIdentifierToType(i)
|
t = StatusToServerPacketIdentifierToType(i)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
t = LoginToServerPacketIdentifierToType(i)
|
t = LoginToServerPacketIdentifierToType(i)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
t = ConfigurationToServerPacketIdentifierToType(i)
|
t = ConfigurationToServerPacketIdentifierToType(i)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
t = PlayToServerPacketIdentifierToType(i)
|
t = PlayToServerPacketIdentifierToType(i)
|
||||||
}
|
}
|
||||||
case queser.ToClient:
|
case proto_base.ToClient:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
t = HandshakingToClientPacketIdentifierToType(i)
|
t = HandshakingToClientPacketIdentifierToType(i)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
t = StatusToClientPacketIdentifierToType(i)
|
t = StatusToClientPacketIdentifierToType(i)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
t = LoginToClientPacketIdentifierToType(i)
|
t = LoginToClientPacketIdentifierToType(i)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
t = ConfigurationToClientPacketIdentifierToType(i)
|
t = ConfigurationToClientPacketIdentifierToType(i)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
t = PlayToClientPacketIdentifierToType(i)
|
t = PlayToClientPacketIdentifierToType(i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func DecodePacket(d queser.Direction, s queser.State, r io.Reader) (params any, err error) {
|
func DecodePacket(d proto_base.Direction, s proto_base.State, r io.Reader) (params any, err error) {
|
||||||
switch d {
|
switch d {
|
||||||
case queser.ToServer:
|
case proto_base.ToServer:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
var packet HandshakingToServerPacket
|
var packet HandshakingToServerPacket
|
||||||
packet, err = HandshakingToServerPacket{}.Decode(r)
|
packet, err = HandshakingToServerPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
var packet StatusToServerPacket
|
var packet StatusToServerPacket
|
||||||
packet, err = StatusToServerPacket{}.Decode(r)
|
packet, err = StatusToServerPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
var packet LoginToServerPacket
|
var packet LoginToServerPacket
|
||||||
packet, err = LoginToServerPacket{}.Decode(r)
|
packet, err = LoginToServerPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
var packet ConfigurationToServerPacket
|
var packet ConfigurationToServerPacket
|
||||||
packet, err = ConfigurationToServerPacket{}.Decode(r)
|
packet, err = ConfigurationToServerPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
var packet PlayToServerPacket
|
var packet PlayToServerPacket
|
||||||
packet, err = PlayToServerPacket{}.Decode(r)
|
packet, err = PlayToServerPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -103,37 +103,37 @@ func DecodePacket(d queser.Direction, s queser.State, r io.Reader) (params any,
|
|||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
}
|
}
|
||||||
case queser.ToClient:
|
case proto_base.ToClient:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
var packet HandshakingToClientPacket
|
var packet HandshakingToClientPacket
|
||||||
packet, err = HandshakingToClientPacket{}.Decode(r)
|
packet, err = HandshakingToClientPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
var packet StatusToClientPacket
|
var packet StatusToClientPacket
|
||||||
packet, err = StatusToClientPacket{}.Decode(r)
|
packet, err = StatusToClientPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
var packet LoginToClientPacket
|
var packet LoginToClientPacket
|
||||||
packet, err = LoginToClientPacket{}.Decode(r)
|
packet, err = LoginToClientPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
var packet ConfigurationToClientPacket
|
var packet ConfigurationToClientPacket
|
||||||
packet, err = ConfigurationToClientPacket{}.Decode(r)
|
packet, err = ConfigurationToClientPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
params = packet.Params
|
params = packet.Params
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
var packet PlayToClientPacket
|
var packet PlayToClientPacket
|
||||||
packet, err = PlayToClientPacket{}.Decode(r)
|
packet, err = PlayToClientPacket{}.Decode(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -145,32 +145,32 @@ func DecodePacket(d queser.Direction, s queser.State, r io.Reader) (params any,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func EncodePacket(d queser.Direction, s queser.State, i string, p any, w io.Writer) (err error) {
|
func EncodePacket(d proto_base.Direction, s proto_base.State, i string, p any, w io.Writer) (err error) {
|
||||||
switch d {
|
switch d {
|
||||||
case queser.ToServer:
|
case proto_base.ToServer:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
err = HandshakingToServerPacket{i, p}.Encode(w)
|
err = HandshakingToServerPacket{i, p}.Encode(w)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
err = StatusToServerPacket{i, p}.Encode(w)
|
err = StatusToServerPacket{i, p}.Encode(w)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
err = LoginToServerPacket{i, p}.Encode(w)
|
err = LoginToServerPacket{i, p}.Encode(w)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
err = ConfigurationToServerPacket{i, p}.Encode(w)
|
err = ConfigurationToServerPacket{i, p}.Encode(w)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
err = PlayToServerPacket{i, p}.Encode(w)
|
err = PlayToServerPacket{i, p}.Encode(w)
|
||||||
}
|
}
|
||||||
case queser.ToClient:
|
case proto_base.ToClient:
|
||||||
switch s {
|
switch s {
|
||||||
case queser.Handshaking:
|
case proto_base.Handshaking:
|
||||||
err = HandshakingToClientPacket{i, p}.Encode(w)
|
err = HandshakingToClientPacket{i, p}.Encode(w)
|
||||||
case queser.Status:
|
case proto_base.Status:
|
||||||
err = StatusToClientPacket{i, p}.Encode(w)
|
err = StatusToClientPacket{i, p}.Encode(w)
|
||||||
case queser.Login:
|
case proto_base.Login:
|
||||||
err = LoginToClientPacket{i, p}.Encode(w)
|
err = LoginToClientPacket{i, p}.Encode(w)
|
||||||
case queser.Configuration:
|
case proto_base.Configuration:
|
||||||
err = ConfigurationToClientPacket{i, p}.Encode(w)
|
err = ConfigurationToClientPacket{i, p}.Encode(w)
|
||||||
case queser.Play:
|
case proto_base.Play:
|
||||||
err = PlayToClientPacket{i, p}.Encode(w)
|
err = PlayToClientPacket{i, p}.Encode(w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/admin-else/queser/data"
|
"github.com/admin-else/strom/data"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed helper_append.txt
|
//go:embed helper_append.txt
|
||||||
@@ -25,7 +25,7 @@ func GenerateHelperTypes(t Types, prefix string, f *ast.File) (err error) {
|
|||||||
if strings.HasPrefix(v2, "packet_common") {
|
if strings.HasPrefix(v2, "packet_common") {
|
||||||
m[k2] = CamelCase(v2)
|
m[k2] = CamelCase(v2)
|
||||||
} else if v2 == "void" {
|
} else if v2 == "void" {
|
||||||
m[k2] = "queser.Void"
|
m[k2] = "proto_base.Void"
|
||||||
} else {
|
} else {
|
||||||
m[k2] = prefix + CamelCase(v2)
|
m[k2] = prefix + CamelCase(v2)
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ func GenerateHelpers(version string, w io.Writer) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
f := NewFile("v" + strings.ReplaceAll(version, ".", "_"))
|
f := NewFile("v" + strings.ReplaceAll(version, ".", "_"))
|
||||||
AppendDecl(f, Import("io", "github.com/admin-else/queser"))
|
AppendDecl(f, Import("io", "github.com/admin-else/strom/proto_base"))
|
||||||
err = GenerateHelperProtocol(protocol, f)
|
err = GenerateHelperProtocol(protocol, f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/admin-else/queser/data"
|
"github.com/admin-else/strom/data"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ToDoError = errors.New("to do")
|
var ToDoError = errors.New("to do")
|
||||||
@@ -208,7 +208,7 @@ func (g *Generator) GenerateTypes(prefix string, types Types) error {
|
|||||||
g.Depth = 0
|
g.Depth = 0
|
||||||
e, err := g.VisitType(v)
|
e, err := g.VisitType(v)
|
||||||
if errors.Is(err, ToDoError) {
|
if errors.Is(err, ToDoError) {
|
||||||
e = Selector("queser", "ToDo")
|
e = Selector("proto_base", "ToDo")
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -303,7 +303,7 @@ func Generate(version string, w io.Writer) (err error) {
|
|||||||
g.Settings.ReplaceWithTodoNames = []string{"packet_scoreboard_score", "packet_advancements"}
|
g.Settings.ReplaceWithTodoNames = []string{"packet_scoreboard_score", "packet_advancements"}
|
||||||
|
|
||||||
g.File = NewFile("v" + strings.ReplaceAll(version, ".", "_"))
|
g.File = NewFile("v" + strings.ReplaceAll(version, ".", "_"))
|
||||||
AppendDecl(g.File, Import("encoding/binary", "io", "github.com/admin-else/queser", "github.com/admin-else/queser/nbt", "github.com/google/uuid"))
|
AppendDecl(g.File, Import("encoding/binary", "io", "github.com/admin-else/strom/proto_base", "github.com/admin-else/strom/nbt", "github.com/google/uuid"))
|
||||||
g.RegisterNatives()
|
g.RegisterNatives()
|
||||||
g.RegisterDecoderNatives()
|
g.RegisterDecoderNatives()
|
||||||
g.RegisterEncoderNatives()
|
g.RegisterEncoderNatives()
|
||||||
@@ -317,11 +317,11 @@ func Generate(version string, w io.Writer) (err error) {
|
|||||||
|
|
||||||
func generateVersion(v string) (err error) {
|
func generateVersion(v string) (err error) {
|
||||||
vUnderscore := strings.ReplaceAll(v, ".", "_")
|
vUnderscore := strings.ReplaceAll(v, ".", "_")
|
||||||
err = os.MkdirAll("generated/v"+vUnderscore, 0755)
|
err = os.MkdirAll("proto_generated/v"+vUnderscore, 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f, err := os.Create("generated/v" + vUnderscore + "/proto.go")
|
f, err := os.Create("proto_generated/v" + vUnderscore + "/proto.go")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ func generateVersion(v string) (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
helperF, err := os.Create("generated/v" + vUnderscore + "/helpers.go")
|
helperF, err := os.Create("proto_generated/v" + vUnderscore + "/helpers.go")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -340,15 +340,15 @@ func generateVersion(v string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GenerateVersions(versions []string) (err error) {
|
func GenerateVersions(versions []string) (err error) {
|
||||||
err = os.RemoveAll("generated/")
|
err = os.RemoveAll("proto_generated/")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = os.MkdirAll("generated/", 0755)
|
err = os.MkdirAll("proto_generated/", 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f, err := os.Create("generated/version_switcher.go")
|
f, err := os.Create("proto_generated/version_switcher.go")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ func SimpleTypeDecoder(_ *Generator, varToSet ast.Expr, _ any, _ string) (s []as
|
|||||||
|
|
||||||
func StringDecoder(_ *Generator, varToSet ast.Expr, _ any, _ string) (s []ast.Stmt, err error) {
|
func StringDecoder(_ *Generator, varToSet ast.Expr, _ any, _ string) (s []ast.Stmt, err error) {
|
||||||
s = Stmts(
|
s = Stmts(
|
||||||
Assign(Exprs(varToSet, Ident("err")), Exprs(Call(Selector("queser", "DecodeString"), Ident("r")))),
|
Assign(Exprs(varToSet, Ident("err")), Exprs(Call(Selector("proto_base", "DecodeString"), Ident("r")))),
|
||||||
IfErrNil(),
|
IfErrNil(),
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@@ -276,7 +276,7 @@ func SwitchDecoder(g *Generator, varToSet ast.Expr, dataRaw any, name string) (s
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var ToDoStmts = Stmts(Assign121(Ident("err"), Selector("queser", "ToDoError")))
|
var ToDoStmts = Stmts(Assign121(Ident("err"), Selector("proto_base", "ToDoError")))
|
||||||
|
|
||||||
func ToDoDecoder(_ *Generator, _ ast.Expr, _ any, _ string) (s []ast.Stmt, err error) {
|
func ToDoDecoder(_ *Generator, _ ast.Expr, _ any, _ string) (s []ast.Stmt, err error) {
|
||||||
err = ToDoError
|
err = ToDoError
|
||||||
@@ -311,7 +311,7 @@ func MapperDecoder(g *Generator, varToSet ast.Expr, dataRaw any, name string) (s
|
|||||||
expressions = append(expressions, KeyValueExpr(NumLitStr(k), StrLit(v)))
|
expressions = append(expressions, KeyValueExpr(NumLitStr(k), StrLit(v)))
|
||||||
}
|
}
|
||||||
g.Decl(mName, token.VAR, CompLit(MapType(kType, Ident("string")), expressions))
|
g.Decl(mName, token.VAR, CompLit(MapType(kType, Ident("string")), expressions))
|
||||||
s3 := Assign(Exprs(varToSet, Ident("err")), Exprs(Call(Selector("queser", "ErroringIndex"), Ident(mName), Ident(kName))))
|
s3 := Assign(Exprs(varToSet, Ident("err")), Exprs(Call(Selector("proto_base", "ErroringIndex"), Ident(mName), Ident(kName))))
|
||||||
s = append(s, s1)
|
s = append(s, s1)
|
||||||
s = append(s, s2...)
|
s = append(s, s2...)
|
||||||
s = append(s, s3)
|
s = append(s, s3)
|
||||||
@@ -453,7 +453,7 @@ func RegistryEntryHolderDecoder(g *Generator, varToSet ast.Expr, dataRaw any, na
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
idName := name + "Id"
|
idName := name + "Id"
|
||||||
IdVar := VarStmt(idName, Selector("queser", "VarInt"))
|
IdVar := VarStmt(idName, Selector("proto_base", "VarInt"))
|
||||||
idDecodeStatements, err := g.VisitDecoder(Ident(idName), "varint", name)
|
idDecodeStatements, err := g.VisitDecoder(Ident(idName), "varint", name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -191,7 +191,7 @@ func SwitchEncoder(g *Generator, varToSet ast.Expr, dataRaw any, name string) (s
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
s1 := Define(Exprs(Ident(name), Ident("ok")), Exprs(TypeAssert(varToSet, tType)))
|
s1 := Define(Exprs(Ident(name), Ident("ok")), Exprs(TypeAssert(varToSet, tType)))
|
||||||
s2 := If(Not(Ident("ok")), NewBlockEllipsis(Assign121(Ident("err"), Selector("queser", "BadTypeError")), Return()))
|
s2 := If(Not(Ident("ok")), NewBlockEllipsis(Assign121(Ident("err"), Selector("proto_base", "BadTypeError")), Return()))
|
||||||
var caseDecodeValueStmts []ast.Stmt
|
var caseDecodeValueStmts []ast.Stmt
|
||||||
caseDecodeValueStmts, err = g.VisitEncoder(Ident(name), fType, name)
|
caseDecodeValueStmts, err = g.VisitEncoder(Ident(name), fType, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -210,7 +210,7 @@ func SwitchEncoder(g *Generator, varToSet ast.Expr, dataRaw any, name string) (s
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
s1 := Define(Exprs(Ident("_"), Ident("ok")), Exprs(TypeAssert(varToSet, tType)))
|
s1 := Define(Exprs(Ident("_"), Ident("ok")), Exprs(TypeAssert(varToSet, tType)))
|
||||||
s2 := If(Not(Ident("ok")), NewBlockEllipsis(Assign121(Ident("err"), Selector("queser", "BadTypeError")), Return()))
|
s2 := If(Not(Ident("ok")), NewBlockEllipsis(Assign121(Ident("err"), Selector("proto_base", "BadTypeError")), Return()))
|
||||||
defaultStmts := []ast.Stmt{s1, s2}
|
defaultStmts := []ast.Stmt{s1, s2}
|
||||||
var defaultEncodingStmts []ast.Stmt
|
var defaultEncodingStmts []ast.Stmt
|
||||||
defaultEncodingStmts, err = g.VisitEncoder(TypeAssert(varToSet, tType), data.Default, name)
|
defaultEncodingStmts, err = g.VisitEncoder(TypeAssert(varToSet, tType), data.Default, name)
|
||||||
@@ -262,7 +262,7 @@ func MapperEncoder(g *Generator, varToSet ast.Expr, dataRaw any, name string) (s
|
|||||||
|
|
||||||
vName := "v" + name
|
vName := "v" + name
|
||||||
s1 := VarStmt(vName, kType)
|
s1 := VarStmt(vName, kType)
|
||||||
s2 := Assign(Exprs(Ident(vName), Ident("err")), Exprs(Call(Selector("queser", "ErroringIndex"), Ident(mName), varToSet)))
|
s2 := Assign(Exprs(Ident(vName), Ident("err")), Exprs(Call(Selector("proto_base", "ErroringIndex"), Ident(mName), varToSet)))
|
||||||
s3 := IfErrNil()
|
s3 := IfErrNil()
|
||||||
s4, err := g.VisitEncoder(Ident(vName), data.Type, name)
|
s4, err := g.VisitEncoder(Ident(vName), data.Type, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -278,7 +278,7 @@ func MapperEncoder(g *Generator, varToSet ast.Expr, dataRaw any, name string) (s
|
|||||||
|
|
||||||
func StringEncoder(_ *Generator, varToSet ast.Expr, _ any, _ string) (s []ast.Stmt, err error) {
|
func StringEncoder(_ *Generator, varToSet ast.Expr, _ any, _ string) (s []ast.Stmt, err error) {
|
||||||
s = Stmts(
|
s = Stmts(
|
||||||
Assign121(Ident("err"), Call(Selector("queser", "EncodeString"), Ident("w"), varToSet)), IfErrNil())
|
Assign121(Ident("err"), Call(Selector("proto_base", "EncodeString"), Ident("w"), varToSet)), IfErrNil())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,7 +310,7 @@ func RegistryEntryHolderEncoder(g *Generator, varToSet ast.Expr, dataRaw any, na
|
|||||||
statements := Stmts()
|
statements := Stmts()
|
||||||
statements = append(statements, Case(Exprs(baseType), baseEncodeStatements))
|
statements = append(statements, Case(Exprs(baseType), baseEncodeStatements))
|
||||||
statements = append(statements, Case(Exprs(otherwiseType), otherwiseEncodeStatements))
|
statements = append(statements, Case(Exprs(otherwiseType), otherwiseEncodeStatements))
|
||||||
statements = append(statements, Case(nil, Stmts(Assign121(Ident("err"), Selector("queser", "BadTypeError")))))
|
statements = append(statements, Case(nil, Stmts(Assign121(Ident("err"), Selector("proto_base", "BadTypeError")))))
|
||||||
|
|
||||||
s = Stmts(TypeSwitch(Define121(Ident(knownTypeName), TypeAssert(varToSet, Ident("type"))), NewBlock(statements)))
|
s = Stmts(TypeSwitch(Define121(Ident(knownTypeName), TypeAssert(varToSet, Ident("type"))), NewBlock(statements)))
|
||||||
return
|
return
|
||||||
@@ -157,13 +157,13 @@ func (g *Generator) RegisterNatives() {
|
|||||||
g.Natives = map[string]ExprGeneratorFunc{
|
g.Natives = map[string]ExprGeneratorFunc{
|
||||||
"container": VisitContainerType,
|
"container": VisitContainerType,
|
||||||
"buffer": VisitBufferType,
|
"buffer": VisitBufferType,
|
||||||
"varint": MakeSelectorVisitor("queser", "VarInt"),
|
"varint": MakeSelectorVisitor("proto_base", "VarInt"),
|
||||||
"array": VisitArrayTypeVisitorType,
|
"array": VisitArrayTypeVisitorType,
|
||||||
"mapper": MakeIdentVisitor("string"),
|
"mapper": MakeIdentVisitor("string"),
|
||||||
"native": VisitDontGenerateType,
|
"native": VisitDontGenerateType,
|
||||||
"anonymousNbt": MakeSelectorVisitor("nbt", "Anon"),
|
"anonymousNbt": MakeSelectorVisitor("nbt", "Anon"),
|
||||||
"anonOptionalNbt": MakeSelectorVisitor("nbt", "Anon"), // I have no idea what the difference is between these two
|
"anonOptionalNbt": MakeSelectorVisitor("nbt", "Anon"), // I have no idea what the difference is between these two
|
||||||
"void": MakeSelectorVisitor("queser", "Void"),
|
"void": MakeSelectorVisitor("proto_base", "Void"),
|
||||||
"bool": MakeIdentVisitor("bool"),
|
"bool": MakeIdentVisitor("bool"),
|
||||||
"u8": MakeIdentVisitor("uint8"),
|
"u8": MakeIdentVisitor("uint8"),
|
||||||
"u16": MakeIdentVisitor("uint16"),
|
"u16": MakeIdentVisitor("uint16"),
|
||||||
@@ -184,7 +184,7 @@ func (g *Generator) RegisterNatives() {
|
|||||||
"bitfield": VisitBitFieldType,
|
"bitfield": VisitBitFieldType,
|
||||||
"pstring": VisitDontGenerateType,
|
"pstring": VisitDontGenerateType,
|
||||||
"string": MakeIdentVisitor("string"),
|
"string": MakeIdentVisitor("string"),
|
||||||
"restBuffer": MakeSelectorVisitor("queser", "RestBuffer"),
|
"restBuffer": MakeSelectorVisitor("proto_base", "RestBuffer"),
|
||||||
"bitflags": VisitBitFlagsType,
|
"bitflags": VisitBitFlagsType,
|
||||||
"topBitSetTerminatedArray": VisitToDoType,
|
"topBitSetTerminatedArray": VisitToDoType,
|
||||||
"todo": VisitToDoType,
|
"todo": VisitToDoType,
|
||||||
@@ -16,8 +16,8 @@ func GeneratePacketIdentifierToType(versions []string) (decl ast.Decl) {
|
|||||||
s = append(s, Case(nil, Stmts()))
|
s = append(s, Case(nil, Stmts()))
|
||||||
fn := NewFunc("PacketIdentifierToType", []NameAndType{
|
fn := NewFunc("PacketIdentifierToType", []NameAndType{
|
||||||
{"v", Ident("string")},
|
{"v", Ident("string")},
|
||||||
{"d", Ident("queser.Direction")},
|
{"d", Ident("proto_base.Direction")},
|
||||||
{"s", Ident("queser.State")},
|
{"s", Ident("proto_base.State")},
|
||||||
{"i", Ident("string")},
|
{"i", Ident("string")},
|
||||||
}, []NameAndType{
|
}, []NameAndType{
|
||||||
{"t", Ident("any")},
|
{"t", Ident("any")},
|
||||||
@@ -28,7 +28,7 @@ func GeneratePacketIdentifierToType(versions []string) (decl ast.Decl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
func PacketIdentifierToType(v string, d queser.Direction, s queser.State, i string) (t any) {
|
func PacketIdentifierToType(v string, d proto_base.Direction, s proto_base.State, i string) (t any) {
|
||||||
switch v {
|
switch v {
|
||||||
case "1.21.8":
|
case "1.21.8":
|
||||||
t = v1_21_8.PacketIdentifierToType(d, s, i)
|
t = v1_21_8.PacketIdentifierToType(d, s, i)
|
||||||
@@ -38,7 +38,7 @@ func PacketIdentifierToType(v string, d queser.Direction, s queser.State, i stri
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func TypeToPacketIdentifier(v string, d queser.Direction, s queser.State, t any) (i string) {
|
func TypeToPacketIdentifier(v string, d proto_base.Direction, s proto_base.State, t any) (i string) {
|
||||||
switch v {
|
switch v {
|
||||||
case "1.21.8":
|
case "1.21.8":
|
||||||
i = v1_21_8.TypeToPacketIdentifier(d, s, t)
|
i = v1_21_8.TypeToPacketIdentifier(d, s, t)
|
||||||
@@ -46,7 +46,7 @@ func TypeToPacketIdentifier(v string, d queser.Direction, s queser.State, t any)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func DecodePacket(v string, d queser.Direction, s queser.State, r io.Reader) (packet any, err error) {
|
func DecodePacket(v string, d proto_base.Direction, s proto_base.State, r io.Reader) (packet any, err error) {
|
||||||
switch v {
|
switch v {
|
||||||
case "1.21.8":
|
case "1.21.8":
|
||||||
packet, err = v1_21_8.DecodePacket(d, s, r)
|
packet, err = v1_21_8.DecodePacket(d, s, r)
|
||||||
@@ -54,7 +54,7 @@ func DecodePacket(v string, d queser.Direction, s queser.State, r io.Reader) (pa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func EncodePacket(v string, d queser.Direction, s queser.State, i string, p any, w io.Writer) (err error) {
|
func EncodePacket(v string, d proto_base.Direction, s proto_base.State, i string, p any, w io.Writer) (err error) {
|
||||||
switch v {
|
switch v {
|
||||||
case "1.21.8":
|
case "1.21.8":
|
||||||
err = v1_21_8.EncodePacket(d, s, i, p, w)
|
err = v1_21_8.EncodePacket(d, s, i, p, w)
|
||||||
@@ -74,8 +74,8 @@ func GenerateTypeToPacketIdentifier(versions []string) (decl ast.Decl) {
|
|||||||
}
|
}
|
||||||
fn := NewFunc("TypeToPacketIdentifier", []NameAndType{
|
fn := NewFunc("TypeToPacketIdentifier", []NameAndType{
|
||||||
{"v", Ident("string")},
|
{"v", Ident("string")},
|
||||||
{"d", Ident("queser.Direction")},
|
{"d", Ident("proto_base.Direction")},
|
||||||
{"s", Ident("queser.State")},
|
{"s", Ident("proto_base.State")},
|
||||||
{"t", Ident("any")},
|
{"t", Ident("any")},
|
||||||
}, []NameAndType{
|
}, []NameAndType{
|
||||||
{"i", Ident("string")},
|
{"i", Ident("string")},
|
||||||
@@ -94,8 +94,8 @@ func GenerateDecodePacket(versions []string) (decl ast.Decl) {
|
|||||||
}
|
}
|
||||||
fn := NewFunc("DecodePacket", []NameAndType{
|
fn := NewFunc("DecodePacket", []NameAndType{
|
||||||
{"v", Ident("string")},
|
{"v", Ident("string")},
|
||||||
{"d", Ident("queser.Direction")},
|
{"d", Ident("proto_base.Direction")},
|
||||||
{"s", Ident("queser.State")},
|
{"s", Ident("proto_base.State")},
|
||||||
{"r", Ident("io.Reader")},
|
{"r", Ident("io.Reader")},
|
||||||
}, []NameAndType{
|
}, []NameAndType{
|
||||||
{"packet", Ident("any")},
|
{"packet", Ident("any")},
|
||||||
@@ -115,8 +115,8 @@ func GenerateEncodePacket(versions []string) (decl ast.Decl) {
|
|||||||
}
|
}
|
||||||
fn := NewFunc("EncodePacket", []NameAndType{
|
fn := NewFunc("EncodePacket", []NameAndType{
|
||||||
{"v", Ident("string")},
|
{"v", Ident("string")},
|
||||||
{"d", Ident("queser.Direction")},
|
{"d", Ident("proto_base.Direction")},
|
||||||
{"s", Ident("queser.State")},
|
{"s", Ident("proto_base.State")},
|
||||||
{"i", Ident("string")},
|
{"i", Ident("string")},
|
||||||
{"p", Ident("any")},
|
{"p", Ident("any")},
|
||||||
{"w", Ident("io.Writer")},
|
{"w", Ident("io.Writer")},
|
||||||
@@ -129,11 +129,12 @@ func GenerateEncodePacket(versions []string) (decl ast.Decl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GenerateVersionSwitcher(versions []string, printTo io.Writer) (err error) {
|
func GenerateVersionSwitcher(versions []string, printTo io.Writer) (err error) {
|
||||||
f := NewFile("generated")
|
f := NewFile("proto_generated")
|
||||||
AppendDecl(f, Import(
|
importPaths := []string{"io", "github.com/admin-else/strom/proto_base"}
|
||||||
"io",
|
for _, version := range versions {
|
||||||
"github.com/admin-else/queser",
|
importPaths = append(importPaths, "github.com/admin-else/strom/proto_generated/v"+strings.ReplaceAll(version, ".", "_"))
|
||||||
"github.com/admin-else/queser/generated/v1_21_8"))
|
}
|
||||||
|
AppendDecl(f, Import(importPaths...))
|
||||||
AppendDecl(f, GeneratePacketIdentifierToType(versions))
|
AppendDecl(f, GeneratePacketIdentifierToType(versions))
|
||||||
AppendDecl(f, GenerateTypeToPacketIdentifier(versions))
|
AppendDecl(f, GenerateTypeToPacketIdentifier(versions))
|
||||||
AppendDecl(f, GenerateDecodePacket(versions))
|
AppendDecl(f, GenerateDecodePacket(versions))
|
||||||
Reference in New Issue
Block a user