2

[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.

2

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.

| improve this answer | |
0

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.

| improve this answer | |
  • If it's a tile entity, potentially can't be moved by pistons or similar? Probably done that way to prevent other bugs happening with adding/removing the bells from villager memory. Haven't actually done too much testing on the newest version since it was changing a lot after release – phflack Aug 27 '19 at 8:02
  • If it was simply to not be movable by pistons, they could have just added it to the list of obsidian, bedrock, barriers, structure void, end portal frames, end portals, nether portals, ender chests, extended pistons, piston heads, enchantment tables and the three types of anvils. – Fabian Röling Aug 27 '19 at 10:43
  • Is there any block that is not a tile entity, but has an animation (animated textures and particles don't count)? As I understand it, the bell is a tile entity, because it has an animation. – user232393 Aug 27 '19 at 13:25
  • I just went through the list of blocks and apparently you're somewhat right, many blocks have tile entities despite not needing them, like ender chests, conduit, dragon heads and extending piston bases. – Fabian Röling Aug 27 '19 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.