How do I check when player eats vanilla food?

Started by pylonuclear on Thu, 03/19/2020 - 05:01

Topic category: Help with modding (Java Edition)

Last seen on 16:00, 22. Oct 2020
Joined Feb 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How do I check when player eats vanilla food?
Thu, 03/19/2020 - 05:01

I am planning to make a mod that makes it to where when you eat chicken, it give you a wishbone.  Does anyone know how this can be achieved, or even if it can be achieved?  Thanks in Advance!

Last seen on 10:24, 10. Sep 2020
Joined Aug 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
There is a global trigger…
Mon, 07/20/2020 - 19:15

There is a global trigger named "Player right clicks with item". I think if you check if chicken is in the main hand of the player you can do something.

Or you can try to replace the vanilla chicken (item) by creating a new one and replacing the chicken (creature) loot table with your chicken (item). If you do that you can use the "when food eaten" food event.

I think the easyest way is the second one :3

Last seen on 01:38, 22. Oct 2020
Joined Sep 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
in any case you will need a…
Tue, 07/21/2020 - 00:22

in any case you will need a IF for each vanilla food. or one IF that includes them all

Last seen on 16:00, 22. Oct 2020
Joined Feb 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
For those of you who find…
Fri, 08/28/2020 - 17:15

For those of you who find this post and want to know the best answer, I think I figured out the best solution.  
 

You make an advancement (hide it from the player if you wish)

There is a trigger in the achievements where you can select the food you want to detect, and then you can add your custom item into the loot table of the advancement.  So if you eat the food, it will give you the item(s) you wish.