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){returnSUCCESS;// player opened the container}else{//...}}
Shulker box (unaffected):
useWithoutItem(Level,Player,/*...*/){if(Level.isClientSide){returnSUCCESS;// player opened the container}elseif(Player.isSpectator()){returnCONSUME;// 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:
elseif(Player.isSpectator()){returnCONSUME;}
Potential Fix: Adding the code that I highlighted from the shulker box to the affected containers' code might fix the bug.
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:
Shulker box (unaffected):
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:
Potential Fix: Adding the code that I highlighted from the shulker box to the affected containers' code might fix the bug.