trans README

This commit is contained in:
JunDao
2019-05-03 09:53:26 +08:00
parent 603ab9b09d
commit e3e10e5eee
3 changed files with 8 additions and 4 deletions

View File

@ -5,6 +5,7 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/Tnze/go-mc)](https://goreportcard.com/report/github.com/Tnze/go-mc)
There's some library in Go support you to create your Minecraft client or server.
这是一些Golang库用于帮助你编写自己的Minecraft客户端或服务器
- [x] Mojang authenticate
- [x] Minecraft network protocal
- [x] Parse chat message
@ -12,6 +13,7 @@ There's some library in Go support you to create your Minecraft client or server
- [ ] Parse NBT
Some examples are at `/cmd` folder.
有一些例子在cmd目录下
> `1.13.2` version is at [gomcbot](https://github.com/Tnze/gomcbot).

View File

@ -1,5 +1,7 @@
package authenticate
//Simple yggdrasil-minecraft-login method.
import (
"bytes"
"encoding/json"

View File

@ -31,9 +31,9 @@ type jsonChat struct {
//UnmarshalJSON decode json to Message
func (m *Message) UnmarshalJSON(jsonMsg []byte) (err error) {
if jsonMsg[0] == '"' {
err = json.Unmarshal(jsonMsg, &m.Text)
err = json.Unmarshal(jsonMsg, &m.Text) //Unmarshal as jsonString
} else {
err = json.Unmarshal(jsonMsg, (*jsonChat)(m))
err = json.Unmarshal(jsonMsg, (*jsonChat)(m)) //Unmarshal as jsonChat
}
return
}