how do I stop a mob from spawning when another of the same is already spawned in?

Started by jammerj5 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do I stop a mob from spawning when another of the same is already spawned in?

trying to make a mob spawn around the player around ever 5-20 minutes but make it not spawn if ones already spawned in

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
A simple way is just to use…
Fri, 10/13/2023 - 15:50

A simple way is just to use the 'does entity exist of (type) in (radius)' function to check whether there's already an entity of that type nearby. 

If you want a more configurable method, you can make a local number variable, and run an entity iterator that checks for your custom entity in the same radius, but instead increases the number variable by one each time it finds your entity. You can then spawn in the entity based on how many are nearby, and set a threshold at which they no longer spawn.