need help making an entity spawn another entity if none are around

Started by Ferryboo on

Topic category: Help with modding (Java Edition)

Last seen on 20:29, 23. Jul 2023
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
need help making an entity spawn another entity if none are around
Wed, 10/19/2022 - 15:20 (edited)

So i made an entity bomb flower and i'm trying to make it spawn a bomb entity if no other bombs are nearby. The procedure detects that a bomb is nearby and stops spawning bombs after like 80 of them are spawned. I set it to OnEntityTickUpdate

Edited by Ferryboo on Wed, 10/19/2022 - 15:20
Last seen on 14:24, 2. May 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There should be some…
Fri, 10/21/2022 - 13:05

There should be some specific procedures in the 'world' tab to check the number of entities within a given radius. Keep in mind though that a 3 cube radius is pretty small, and anything upwards of 30+ entities with AI could cause some serious lag. (Also, this will only spawn them directly inside the first entity. You could use random variables to check different locations for viability and then spawn the entity there- or, if you're using explosives, you could also just give the thing a projectile attack. If you remove the 'discard in ground' section in the custom code of a projectile, you can make a projectile entity that stays in the world, and from there could give the projectile a delay procedure before exploding.

Last seen on 20:29, 23. Jul 2023
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you for the answer,…
Fri, 10/21/2022 - 22:42

Thank you for the answer, the problem is that it actually does detect that the entity is there, but it spawns a BUNCH of them instead of just a single one