5

I want to make it so I always have 50 entities in an area. So when 1 dies/despawns/leaves the area I want it to detect that and summon in a new entity, and yes I do want them to die/despawn/leave the area so preventing those things is not an option.

1
  • 2
    @RudolfLibal People are editing to make content more useful and searchable for future visitors.
    – Orc JMR
    Apr 6, 2016 at 9:38

2 Answers 2

1

Plug a redstone clock into 2 Command blocks (or use 1.9 Repeat command blocks):

The first command:

/testfor @e[x=X,y=Y,z=Z,r=R]  

And the second:

/testforblock X Y Z command_block 1 {SuccessCount:49}

Place a Comparator leading from the second Command Block - that is, if there are 49 entities, it succeeds. Then place your final command block next to the Comparator, into it put your /summon command.

8
  • 4
    What happens, if two or more entities die at same time - between RS clock tick? Then it will be broken. Apr 6, 2016 at 11:36
  • 1
    Thankyou for the easy to read and understand answer. this is good enough if not plenty good for what I need it for!
    – LethaIity
    Apr 6, 2016 at 13:22
  • 2
    That said, downvotes are part of how this site works, and you, as a user of this site, will have to accept this. While providing an alternative answer would be ideal, it is not a necessity or even prerequisite for downvoting. The only thing any user of this sites needs to legitimately downvote an answer is to find it "not useful".
    – MrLemon
    Apr 6, 2016 at 14:01
  • 1
    @Rudolf You don't have to. You just have to stop telling people how to vote. You vote your way, we vote ours, and all is good. Telling someone they're doing it wrong is going to get you nothing but backlash. Especially for downvotes.
    – Frank
    Apr 7, 2016 at 21:15
  • 2
    Yes it is okay. It's also okay to downvote whatever I want. I do what I want, you do what you want, and we're all good.
    – Frank
    Apr 8, 2016 at 16:20
0

Use stats

    stats block [K] set SuccessCount #Fake K
[K]:testfor @e
    scoreboard players test #Fake K 0 49
CONDxxxx

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .