Refactoring package go-mc/bot

This commit is contained in:
Tnze
2021-02-27 01:06:07 +08:00
parent e864580903
commit 3da9321f59
44 changed files with 564 additions and 3715 deletions

18
bot/basic/keepalive.go Normal file
View File

@ -0,0 +1,18 @@
package basic
import (
"github.com/Tnze/go-mc/data/packetid"
pk "github.com/Tnze/go-mc/net/packet"
)
func (p Player) handleKeepAlivePacket(packet pk.Packet) error {
var KeepAliveID pk.Long
if err := packet.Scan(&KeepAliveID); err != nil {
return err
}
// Response
return p.c.Conn.WritePacket(pk.Marshal(
packetid.KeepAliveServerbound,
KeepAliveID,
))
}