Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-274944

Spectators Keep Chests and Barrels Open

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.21
    • None
    • Unconfirmed
    • Spectator
    • Block states, Player

      (I will refer to chests and barrels as 'affected containers')

      If a player who is not in spectator mode closes an affected container that has the open animation while a player in spectator mode is viewing the contents of said affected container, that affected container keeps its open animation until the player in spectator mode closes the container.

      The attached video demonstrates how to replicate this bug.

       

      This bug does not affect shulker boxes (see below).

       

      Difference in Minecraft's source (simplified) between affected containers and shulker boxes:

      Affected containers:

      useWithoutItem(Level, Player, /*...*/) {
        if (Level.isClientSide) {
          return SUCCESS; // player opened the container
        } else {
          //...
        }
      }

      Shulker box (unaffected):

      useWithoutItem(Level, Player, /*...*/) {
        if (Level.isClientSide) {
          return SUCCESS; // player opened the container
        } else if (Player.isSpectator()) {
          return CONSUME; // player is in spectator mode, so they didn't actually open the container
        } else {
          //...
        }
      }

       

      Shulker boxes have the following code (simplified) that checks if they are in spectator mode and removes the interaction while the affected containers do not:

      else if (Player.isSpectator()) {
        return CONSUME;
      }

       

       

      Potential Fix: Adding the code that I highlighted from the shulker box to the affected containers' code might fix the bug.

            Unassigned Unassigned
            Eevee17_ Eevee 17
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: