How to affect every nearby entity?

Started by NotABlackHole on

Topic category: Help with MCreator software

Last seen on 18:11, 7. Apr 2023
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to affect every nearby entity?

I'm trying to make an item that will set every nearby mob on fire, but I can't find a way to target multiple nearby enemies. The closest I got was a "For each entity as "Entity Iterator"" procedure block, but it won't let me change the "Entity Iterator" block. Any solutions?

Last seen on 00:08, 19. Nov 2022
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't recommend trying to…
Tue, 10/11/2022 - 14:25

I don't recommend trying to use entity iterator. Instead, use the block in the World Data tab, all the way at the bottom, that says "get nearest entity." It basically does what the entity iterator does with half of the hair pulling trying to figure out how it even works. If you want it to target multiples, simply duplicate the blocks and expand the box size by 1. Make sure it searches for the type "Living Entity." 

If you don't want it to target the entity you're attacking but instead everything around it, duplicate the block 6 times (4 times for every side around the mob, 2 for above and below the mob. If you don't want anything to happen below the mob, then only use 5) and set each of the x, y, and z coordinates accordingly to be outside of the bounds of where the entity being attacked is located. E.g. I wanted to make a "shared damage" enchantment but didn't want it to hurt the mob I'm attacking.