How to make a mob give us a drop if we feed it

Started by TrueDiamond on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a mob give us a drop if we feed it

How to make a mob give us a drop if we feed it. For example, I fed the dog meat, and she gave us a bone

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make a procedure with the…
Wed, 12/27/2023 - 06:53

Make a procedure with the global trigger 'player right clicks entity.' Use an if bracket to check if the item in the main hand of the player is meat. (Using an item compare function from the logic tab, and a 'item in main hand' function from the entity data tab).

If the item in the player's main hand is meat, spawn a bone item at the dog's position. (Using the 'spawn item/gem' function, from the world tab).

You will also likely want to use the 'shrink itemstack' function to decrease the number of items in the player's main hand, and the 'swing main hand' function to make the player's hand swing when they right click on the entity with the correct item.