Started by
CookiesZININHO
on
Topic category: Help with MCreator software
I tried to make a sword that when it hits a mob it gives food points to the player, but I couldn't, can someone help me?
Topic category: Help with MCreator software
I tried to make a sword that when it hits a mob it gives food points to the player, but I couldn't, can someone help me?
trigger: on attack
if (source entity) is sub type of player
if item in main hand of (source entity) is (item)
set food saturation of (source entity) to (get food saturation level of (event/target entity) + 5)
I didn't find where this trigger "on attack" is, sorry, can you show me please?
I also couldn't find the " if item in main hand of (source entity) is (item)", sorry, can you help me find it please?
maybe swap where the sword and the item in main-hand is.
Your Issue is, that you use "the set food saturation" block (saturation is like an invisible parameter that decides how long it takes to lower the first piece of the hunger bar) What you want to use is the "set food level of" block that actually adds hunger to your bar. Otherwise it should work with all the entity blocks being "source entity".
Another maybe code efficient way of achieving your goal is to go to your custom Item, then triggers and add the procedure to "when living entity is hit with item". The procedure can look like this:
and you can add the procedure here:
If you cant see the images in this text, rightclick it and open in a new tab.