How to make a tool that gives you a potion effect when you kill a mob with it?

Started by Porsche928 on Thu, 01/06/2022 - 14:32

Topic category: Help with modding (Java Edition)

Last seen on 14:49, 11. Jan 2022
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to make a tool that gives you a potion effect when you kill a mob with it?
Thu, 01/06/2022 - 14:32

How do I make a tool that gives you a potion effect when you kill a mob with it?

Last seen on 18:05, 27. May 2022
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
This is one way to do it,…
Thu, 01/06/2022 - 15:01

This is one way to do it, swap the "in inventory" to "in main hand"

Procedure

This checks if the entity dies in the area so a way to check if the player killed it is to place a variable on the entity when the player attacks it then check if that entity has it before it dies.

Hope it helps!