How to deal damage to player when it gets a certain item in inventory?

Started by MasterAppleJuice on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to deal damage to player when it gets a certain item in inventory?

So I'm trying to make it to where when the player brings an item in their inventory they take damage.

For Example: Let's say I mine iron, and I get it in my inventory, when it is in my inventory it damages me. 

If you have any questions about my problem, let me know.

Thank You, MasterAppleJuice.

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not sure how to do it if…
Sun, 07/07/2024 - 21:04

I'm not sure how to do it if you only want it to damage them once, but if you make a procedure that has a global trigger of player tick update you can do something like:

if: player has ___ in inventory

deal ___ damage to target.

 

Don't make the damage too high, or add a cooldown, because this will check 20 times a second.