mojira.dev
MC-232968

Spectators can prevent the closing animation of a chest/barrel when viewing it at the same time as a non-spectator

The chest and barrel close animation doesn't occur while player in spectator gamemode is viewing chest contents.

Steps to reproduce:

  • Get a player to open a chest.

  • Open the same chest while in spectator.

  • Have them close the chest.

  • The chest remains open until exited by the spectator.

Linked issues

Attachments

Comments 6

This is not a bug. Spectators can look inside of containers without opening them. This is the same for barrels, shulker boxes, and even mods (like Quark) follow this rule.

Maybe it isn't a heavy bug, but don't you think it shouldn't look like that? Spectator mode is for not being noticed by players in other gamemodes, so in my opinion it is a little bug.

Can confirm in a vanilla environment, this also occurs with barrels. Copied over steps to reproduce from MC-234928.

I was also able to reproduce this in a vanilla environment. I've attached a video.

[media]

Can confirm for 1.19

This bug does not affect shulker boxes (another container with an opening/closing animation).

There is a difference in Minecraft's code (simplified) between the affected containers (chests and barrels) 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.

Axer22

Filip Randenbäck

Confirmed

Platform

Low

Block states, Player

1.17.1, 1.19, 1.21, 25w05a

25w33a

Retrieved