Fix bugs in packet.Packet.Pack()
This commit is contained in:
@ -35,7 +35,7 @@ First, you might have a try of the simple examples. It's a good start.
|
||||
### Run Examples
|
||||
|
||||
- Run `go run github.com/Tnze/go-mc/cmd/mcping localhost` to ping and list the localhost mc server.
|
||||
- Run `go run github.com/Tnze/go-mc/cmd/daze` to join the local server at *localhost:25565* as Steve on the offline mode.
|
||||
- Run `go run github.com/Tnze/go-mc/cmd/daze` to join the local server at *localhost:25565* as player named Daze on the offline mode.
|
||||
|
||||
### Basic Usage
|
||||
|
||||
|
@ -121,6 +121,6 @@ func (d DisconnectErr) Error() string {
|
||||
}
|
||||
|
||||
func onDisconnect(reason chat.Message) error {
|
||||
// return a error value so that we can stop main loop
|
||||
// return an error value so that we can stop main loop
|
||||
return DisconnectErr{Reason: reason}
|
||||
}
|
||||
|
@ -121,6 +121,7 @@ func (p *Packet) packWithCompression(w io.Writer, threshold int) error {
|
||||
|
||||
dataLength := bufPool.Get().(*bytes.Buffer)
|
||||
defer bufPool.Put(dataLength)
|
||||
dataLength.Reset()
|
||||
n3, err := VarInt(int(n1) + n2).WriteTo(dataLength)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user