测试并改正放置、挖掘方块的API

This commit is contained in:
Tnze
2019-06-08 14:17:26 +08:00
parent d53f77dbae
commit f909ed405e
2 changed files with 18 additions and 14 deletions

View File

@ -3,7 +3,6 @@ package bot
import (
"bytes"
"errors"
"io"
"io/ioutil"
// "math"
@ -200,13 +199,13 @@ func handleSetSlotPacket(c *Client, p pk.Packet) error {
switch int8(windowID) {
case 0: //if window ID is 0, it will only change the hotbar
if slotI < 32 || slotI > 44 {
return errors.New("server set slot error")
if slotI < 36 || slotI > 45 {
return fmt.Errorf("slot %d out of range for window %d", slotI, windowID)
}
fallthrough
case -2: //or if it's -2, server can change any slot without animation
if slotI < 0 || slotI > 45 {
return errors.New("server set slot out of range")
return fmt.Errorf("slot %d out of range for window %d", slotI, windowID)
}
c.Inventory[slotI] = slot
}