diff --git a/minecraft/dial.go b/minecraft/dial.go index e978d8e6..7af393f2 100644 --- a/minecraft/dial.go +++ b/minecraft/dial.go @@ -142,7 +142,7 @@ func (d Dialer) DialContext(ctx context.Context, network, address string) (conn d.ErrorLog = log.New(os.Stderr, "", log.LstdFlags) } if d.Protocol == nil { - d.Protocol = proto{} + d.Protocol = DefaultProtocol } if d.FlushRate == 0 { d.FlushRate = time.Second / 20 diff --git a/minecraft/protocol.go b/minecraft/protocol.go index d648551a..d48b43b5 100644 --- a/minecraft/protocol.go +++ b/minecraft/protocol.go @@ -41,3 +41,7 @@ func (p proto) ConvertToLatest(pk packet.Packet, _ *Conn) []packet.Packet { retu func (p proto) ConvertFromLatest(pk packet.Packet, _ *Conn) []packet.Packet { return []packet.Packet{pk} } + +// DefaultProtocol is the Protocol implementation using as default, In default it is current protocol, version and packet +// pool and does not convert any packets, as they are already of the right type. +var DefaultProtocol = proto{}