Started by
DarkCreeper208
on
Topic category: Help with Minecraft modding (Java Edition)
I'm working on a mod that add a ore in the nether and I want to know how to get piglin attack you after mining the ore.
I'm on version Mcreator 2026.1
Edited by DarkCreeper208 on Tue, 05/05/2026 - 04:32
Use a trigger on the ore block broken, then use an entity iterator: get all entities in area 3 3 3 or whatever size you want. If entity iterator is type piglin: set attack target of entity iterator to event/target entity, may be source entity in this case so try both.
I did what you said and it didn't work.
Show me your procedure?
I sent a screenshot of it.
Try using imgbox next time. Code looks fine but I can’t tell for sure. Did you use entity iterator for everything other than the set target to?
Is the procedure selected in the block tab? What happens when you break the block? Did you try increasing the range of the iterator?
If you go into "element tags", add a block tag with the namespace of minecraft and the tag name of guarded_by_piglins, then you can add your block to the list. I hope this works!
fr6_17 I put the iterator entity on the "set target to", and I tried to find the proceed to detect block, but couldn't find it. I added the procedure to my ore, but every time I tried to break the ore, the piglins didn't react to it; they just picked up the item instead.
Jasonc_414, I don't see elemental tags on procedures. Can you send me the code for it?
Use jasonc_414’s tag suggestion. Go to element tags on the left sidebar under resources (your textures). Then either locate guarded_by_piglins in common tags or add/create it yourself by doing: blocks,minecraft,guarded_by_piglins and adding your block to the list afterwards it should work without anything else needed
It works thank you.