I want to use the method described above in a mini game to track the amount of custom entities in the world for the purpose of reducing lag. Is it possible to do so?
I am trying to track the number total of all mobs given a certain tag to stop command blocks from spawning more mobs when it gets close to the lag count.
I want to use the method described above in a mini game to track the amount of custom entities in the world for the purpose of reducing lag. Is it possible to do so?
Wubbla Lubba Dub Dub!
/testfor
May I ask what exactly you are trying to do? Like do a mob limit or something?
Yes I am. Thanks
Wubbla Lubba Dub Dub!
Ok, so you down't want to do a full mob clear and just pick specific mobs you want to occasionally clear?
I am trying to track the number total of all mobs given a certain tag to stop command blocks from spawning more mobs when it gets close to the lag count.
Wubbla Lubba Dub Dub!
depends on how many mobs but if you're just going off of total I would do
/tag @e[type=<mob>,tag=!mobsummon] add mobsummon
then tie that to a conditional block that adds to a scoreboard
/scoreboard players add @e[tag=dummyCount] mob_limit 1
then you can have a repeating command block that does something like
/execute @e[scores={mob_limit=50}] ~~~ setblock ~ ~ ~ air
and in that setblock have it deactivate the redstone for the command blocks summoning your mob
<to setup the scoreboard>
/scoreboard objectives add mob_limit dummy mob_limit
---------------------------------------------------------------------
The trick is removing the count.
I would pick an item drop from the mob or XP
id remove it and then reduce the mob count by 1
Or
Do the recount idea that I mention in the next comment
You could also try clearing all the tags occaionally. And then clearing the scoreboard and recounting.