Skip to content

Commit

Permalink
Fix bot screen item counts
Browse files Browse the repository at this point in the history
  • Loading branch information
Tnze committed Jul 28, 2024
1 parent 330d7e6 commit 966f50e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bot/screen/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (m *Manager) onSetSlot(p pk.Packet) (err error) {

type Slot struct {
ID pk.VarInt
Count pk.Byte
Count pk.VarInt
NBT nbt.RawMessage
}

Expand All @@ -208,12 +208,15 @@ func (s *Slot) WriteTo(w io.Writer) (n int64, err error) {
}

func (s *Slot) ReadFrom(r io.Reader) (n int64, err error) {
var present pk.Boolean
var componentsAdd, componentsRemove pk.VarInt
return pk.Tuple{
&present, pk.Opt{
Has: &present,
&s.Count, pk.Opt{
Has: func() bool { return s.Count > 0 },
Field: pk.Tuple{
&s.ID, &s.Count, pk.NBT(&s.NBT),
&s.ID,
&componentsAdd,
&componentsRemove,
// TODO: Components Ignored
},
},
}.ReadFrom(r)
Expand Down

0 comments on commit 966f50e

Please sign in to comment.