[SOLVED] Item that when in inventory gives an effect that if you kill a mob it drops more XP

Started by Hurricane_FNaF on

Topic category: Help with modding (Java Edition)

Last seen on 20:35, 14. Jul 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[SOLVED] Item that when in inventory gives an effect that if you kill a mob it drops more XP
Sun, 02/18/2024 - 02:43 (edited)

So, i want to make an item that, when in your inventory (the slot doesnt matter), makes you recieve more XP from killing any mobs, is it possible? and if so, can anyone tell me how to do it?

Edited by Hurricane_FNaF on Sun, 02/18/2024 - 02:43
Last seen on 17:47, 14. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make a procedure with the…
Mon, 10/09/2023 - 16:01

Make a procedure with the global trigger 'when entity attacked.' This provides 'ammount' as one of the dependencies available for you to use. (The ammount of damage being dealt.) Have the procedure check if the attacker, (the source entity), is a player, and if the amount of damage dealt is greater than the victim, (the event/target entity's) current health. 

If both these conditions are true, run an itemstack iterator that checks each slot of their inventory for your custom item. If it finds the custom item, spawn some XP orbs at the x/y/z position of the source entity. (Probably more, depending on the level of the enchantment, which you can also reference.)