update README.mc

This commit is contained in:
Tnze
2019-05-26 14:59:32 +08:00
parent 837bb0b213
commit 2407b4f0ed
3 changed files with 10 additions and 5 deletions

View File

@ -9,9 +9,11 @@ There's some library in Go support you to create your Minecraft client or server
这是一些Golang库用于帮助你编写自己的Minecraft客户端或服务器 这是一些Golang库用于帮助你编写自己的Minecraft客户端或服务器
- [x] Mojang authenticate - [x] Mojang authenticate
- [x] Minecraft network protocal - [x] Minecraft network protocal
- [x] Parse chat message - [x] Chat
- [x] Simple MC robot lib - [x] Simple MC robot lib
- [x] Parse NBT - [x] Parse NBT
- [x] Use item
- [x] Swing arm
> 由于仍在开发中部分API在未来版本中可能会变动 > 由于仍在开发中部分API在未来版本中可能会变动

View File

@ -148,7 +148,9 @@ func (c *Client) JoinServer(addr string, port int) (err error) {
} }
c.conn.SetThreshold(int(threshold)) c.conn.SetThreshold(int(threshold))
case 0x04: //Login Plugin Request case 0x04: //Login Plugin Request
// fmt.Println("Waring Login Plugin Request")//TODO: handle plugin request if err := handlePluginPacket(c, pack); err != nil {
return fmt.Errorf("bot: handle plugin packet fail: %v", err)
}
} }
} }
} }

View File

@ -1,13 +1,14 @@
package bot package bot
import ( import (
"fmt" "errors"
"github.com/Tnze/go-mc/data" "github.com/Tnze/go-mc/data"
pk "github.com/Tnze/go-mc/net/packet" pk "github.com/Tnze/go-mc/net/packet"
) )
//SwingArm swing player's arm. //SwingArm swing player's arm.
//hand could be one of 0: main hand, 1: off hand //hand could be one of 0: main hand, 1: off hand.
//It's just animation.
func (c *Client) SwingArm(hand int) error { func (c *Client) SwingArm(hand int) error {
return c.conn.WritePacket(pk.Marshal( return c.conn.WritePacket(pk.Marshal(
data.AnimationServerbound, data.AnimationServerbound,
@ -35,7 +36,7 @@ func (c *Client) UseItem(hand int) error {
//Chat send chat as chat message or command at textbox. //Chat send chat as chat message or command at textbox.
func (c *Client) Chat(msg string) error { func (c *Client) Chat(msg string) error {
if len(msg) > 256 { if len(msg) > 256 {
return fmt.Errorf("message too long") return errors.New("message too long")
} }
return c.conn.WritePacket(pk.Marshal( return c.conn.WritePacket(pk.Marshal(