From ca33185f205dc15dd10e14b0310b0fe14792585c Mon Sep 17 00:00:00 2001 From: adman Date: Fri, 27 Mar 2026 12:59:10 +0100 Subject: [PATCH] fix LookupPacketInfoByType for undecoable --- proto/connection.go | 2 ++ proto/packet_lookup.go | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/proto/connection.go b/proto/connection.go index a292b1b..6e348b1 100644 --- a/proto/connection.go +++ b/proto/connection.go @@ -80,6 +80,7 @@ func (c *Conn) OnLoginTick(_ LoginTick) (err error) { if err != nil { return } + slog.Debug("logintick recv", "actor", c.Actor, "packet", fmt.Sprintf("%#v", packet)) err = c.Fire(packet) return } @@ -135,6 +136,7 @@ func (c *Conn) ActivateReceiveRoutine() (chSending <-chan any) { ch <- err return } + slog.Debug("recv", "actor", c.Actor, "packet", fmt.Sprintf("%#v", packet)) ch <- packet } } diff --git a/proto/packet_lookup.go b/proto/packet_lookup.go index a29682d..f0a1c11 100644 --- a/proto/packet_lookup.go +++ b/proto/packet_lookup.go @@ -41,6 +41,13 @@ func LookUpTypeByPacketInfoAndCopyType(direction proto_base.Direction, state pro } func LookupPacketInfoByType(packet proto_base.EncodeDecodeAble) (p proto_base.PacketInfo, ok bool) { + undecodedPacket, isUndecoable := packet.(*UnCodablePacket) + if isUndecoable { + p = proto_base.PacketInfo{Type: &UnCodablePacket{}, Name: "un_codable", Direction: undecodedPacket.Direction, State: proto_base.Handshaking, PacketId: -1, ProtocolVersion: -1} + ok = true + return + } + for _, p := range proto_generated.Packets { if reflect.TypeOf(p.Type) == reflect.TypeOf(packet) { return p, true