Skip to content

Commit

Permalink
session/world.go: Do not track opened lectern "containers"
Browse files Browse the repository at this point in the history
  • Loading branch information
DaPigGuy committed Nov 24, 2024
1 parent 98302be commit 8d4e5ac
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions server/session/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,24 +987,26 @@ func (s *Session) ViewEntityAnimation(e world.Entity, animationName string) {

// OpenBlockContainer ...
func (s *Session) OpenBlockContainer(pos cube.Pos, tx *world.Tx) {
b := tx.Block(pos)
_, lectern := b.(block.Lectern) // The client does not send a ContainerClose packet for lecterns.

if !lectern && s.containerOpened.Load() && *s.openedPos.Load() == pos {
if s.containerOpened.Load() && *s.openedPos.Load() == pos {
return
}
s.closeCurrentContainer(tx)

b := tx.Block(pos)
if container, ok := b.(block.Container); ok {
s.openNormalContainer(container, pos, tx)
return
}
// We hit a special kind of window like beacons, which are not actually opened server-side.
nextID := s.nextWindowID()
s.containerOpened.Store(true)
inv := inventory.New(1, nil)
s.openedWindow.Store(inv)
s.openedPos.Store(&pos)
// The client does not send a ContainerClose packet for lecterns.
_, lectern := b.(block.Lectern)
if !lectern {
s.containerOpened.Store(true)
inv := inventory.New(1, nil)
s.openedWindow.Store(inv)
s.openedPos.Store(&pos)
}

var containerType byte
switch b := b.(type) {
Expand Down

0 comments on commit 8d4e5ac

Please sign in to comment.