How to test if a mob/animal has been fed? 1.14

I'm trying to test if a fox has been fed sweet berries to execute a command.


The simple act of giving a fox a sweet berry cannot be detected. What you can do is either:

  • detecting a player successfully breeding two foxes, using the bred_animals advancement trigger (archive) and a condition for the parent to be a fox (this does not detect giving a lone fox a sweet berry)
  • detecting a player using a sweet berry and a fox being nearby, using a scoreboard of type used:sweet_berries (archive) (this also detects eating sweet berries while standing near a fox)
  • detecting a player using a sweet berry while looking at a fox, this requires "raycasting", which is pretty complicated and a bit resource intensive, an example can be seen in my other answer here (this also detects a player turning towards a fox while eating a sweet berry)