Is it possible to check the Bell's block entity data?
[Minecraft 1.14.4]
I want to check when a player hits a village bell in minecraft, and then perform some action.
After reading a bit on the minecraft wiki, it seems that bells have a block Entity Data entry named "keepPacked" that should be set to 1 if the bell is swaying (has been hit) or 0 if it's stationary.
I'm not sure how to access this data, or if this is even possible.
You can create a scoreboard objective to detect when a player rings a bell, the command to create the scoreboard objective looks like this:
/scoreboard objectives add bell minecraft.custom:minecraft.bell_ring
The score for a player increases by one every time that player rings a bell.
According to the wiki, keepPacked
has something to do with world generation and is not specific to bells. So it is not a tag for having been rung by a player or not. There is also no other NBT tag specific to bells. (Honestly I wonder why it's a tile entity at all then.)
There is also no block state indicating whether a bell is or was ringing. So I assume that ringing a bell is just a specially coded event that instantly applies the effect to nearby mobs, plays the sound and the animation, but isn't stored anywhere. Leaving and re-joining the world during the bell animation would probably show an unmoving bell.
So, in summary: Commands cannot detect when a bell is ringing or has been rung.