Fix login for 1.19.3
This commit is contained in:
10
bot/mcbot.go
10
bot/mcbot.go
@ -20,7 +20,7 @@ import (
|
|||||||
|
|
||||||
// ProtocolVersion is the protocol version number of minecraft net protocol
|
// ProtocolVersion is the protocol version number of minecraft net protocol
|
||||||
const (
|
const (
|
||||||
ProtocolVersion = 760
|
ProtocolVersion = 761
|
||||||
DefaultPort = mcnet.DefaultPort
|
DefaultPort = mcnet.DefaultPort
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -98,21 +98,16 @@ func (c *Client) join(addr string, options JoinOptions) error {
|
|||||||
pk.VarInt(ProtocolVersion), // Protocol version
|
pk.VarInt(ProtocolVersion), // Protocol version
|
||||||
pk.String(host), // Host
|
pk.String(host), // Host
|
||||||
pk.UnsignedShort(port), // Port
|
pk.UnsignedShort(port), // Port
|
||||||
pk.Byte(2),
|
pk.VarInt(2),
|
||||||
))
|
))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return LoginErr{"handshake", err}
|
return LoginErr{"handshake", err}
|
||||||
}
|
}
|
||||||
// Login Start
|
// Login Start
|
||||||
var KeyPair pk.OptionEncoder[*user.KeyPairResp]
|
|
||||||
if c.Auth.AsTk != "" && !options.NoPublicKey {
|
if c.Auth.AsTk != "" && !options.NoPublicKey {
|
||||||
if options.KeyPair != nil {
|
if options.KeyPair != nil {
|
||||||
KeyPair.Has = true
|
|
||||||
KeyPair.Val = options.KeyPair
|
|
||||||
c.KeyPair = options.KeyPair
|
c.KeyPair = options.KeyPair
|
||||||
} else if KeyPairResp, err := user.GetOrFetchKeyPair(c.Auth.AsTk); err == nil {
|
} else if KeyPairResp, err := user.GetOrFetchKeyPair(c.Auth.AsTk); err == nil {
|
||||||
KeyPair.Has = true
|
|
||||||
KeyPair.Val = &KeyPairResp
|
|
||||||
c.KeyPair = &KeyPairResp
|
c.KeyPair = &KeyPairResp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,7 +119,6 @@ func (c *Client) join(addr string, options JoinOptions) error {
|
|||||||
err = c.Conn.WritePacket(pk.Marshal(
|
err = c.Conn.WritePacket(pk.Marshal(
|
||||||
packetid.LoginStart,
|
packetid.LoginStart,
|
||||||
pk.String(c.Auth.Name),
|
pk.String(c.Auth.Name),
|
||||||
KeyPair,
|
|
||||||
PlayerUUID,
|
PlayerUUID,
|
||||||
))
|
))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -38,8 +38,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ProtocolName = "1.19.2"
|
ProtocolName = "1.19.3"
|
||||||
ProtocolVersion = 760
|
ProtocolVersion = 761
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
Reference in New Issue
Block a user