1.21.8 data
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled
Go / Test (1.22) (push) Has been cancelled
Go / Test (^1.22) (push) Has been cancelled

This commit is contained in:
2025-08-22 06:17:33 +08:00
parent 133e3fab4a
commit 0958972953
173 changed files with 13782 additions and 406 deletions

39
bot/screen/chest.go Normal file
View File

@ -0,0 +1,39 @@
package screen
import (
"errors"
"github.com/Tnze/go-mc/chat"
"github.com/Tnze/go-mc/data/inventory"
)
type Chest struct {
Type inventory.InventoryID
Title chat.Message
Slots []Slot
Rows int
}
func (c *Chest) onSetSlot(i int, slot Slot) error {
if i < 0 || i >= len(c.Slots) {
return errors.New("slot index out of bounds")
}
c.Slots[i] = slot
return nil
}
func (c *Chest) onClose() error {
return nil
}
func (c *Chest) Container() []Slot {
return c.Slots[0 : c.Rows*9]
}
func (c *Chest) Main() []Slot {
return c.Slots[c.Rows*9 : c.Rows*9+27]
}
func (c *Chest) Hotbar() []Slot {
return c.Slots[c.Rows*9+27 : (c.Rows+4)*9]
}