Make it so when a spawner spawns all the Pokémon it can at a time, it pauses the tick counter for when it is about to spawn another.
Long version:
So, I should start by explaining my goal. I made a quick datapack that just replaces mob spawners with the pixelmon spawner within a radius of the player using the /fill ... replace ... command. I am going to use this with the lost cities mod to make it so aggressive Pokémon spawn from spawners within the cities giving it the idea that humans used to live in cities but Pokémon took over. The player is able to go into these aggressive cities and grab loot out of the buildings while fighting off Pokémon. I have a "preset" spawner block which I saved the NBT Tags for which has all the settings set up on the spawners that spawn.
So, I have all that set up and it is working. Spawners are getting replaced and Pokémon are spawning. However, I came across a problem with the spawning of aggressive Pokémon. My problem is that the spawner is continuously going through ticks getting ready to spawn a Pokémon. This is a problem since if the player spends too long in battle, when he ends the fight a new Pokémon will near instantly spawn, starting another fight immediately.
So, the suggestion I would like to make to fix this is for a pause spawning feature. This would have it so the spawner will continue to spawn Pokémon till it hits its max number of spawned Pokémon. When it does, it will stop waiting for ticks until it reaches a number of Pokémon left.
For instance, you can have the max Pokémon set to 10 and the pause until number Pokémon set to 5. So, when the spawner is first placed, it will continue spawning Pokémon until it hits 10. When it does, it will trigger a flag or bool which says to stop spawning. When the number of Pokémon tied to that spawner hits 5 or under, it will unflag the pauseSpawner bool and resume spawning till it hits 10 again.
I don't know how well I explained that so I will try and say it in code which hopefully your programmers will understand.
Excuse my pseudo-code I don't know how to program in minecraft and only know C# instead of Java nor have I looked at what your guys code is so I can make proper references, but it will look something like this:
var tickRate = 40; // How many ticks till a pokemon spawns
var curTicks = 0; // How many ticks have went by. When this hits the tickRate a pokemon spawns
var pauseSpawner = false; // Does what it says
var currentNumberOfPokemon = 0; // How many Pokemon currently tied to the spawner
var maxNumberOfPokemon = 10; // What it says
var pauseUntilNumberOfPokemon = 5; // The number it will wait to unpause for
Within the Tick method (I don't know what it is)
{
if(pauseSpawner == false && currentNumberOfPokemon >= maxNumberOfPokemon)
{
pauseSpawner = true;
}
if(pauseSpawner == true && currentNumberOfPokemon <= pauseUntilNumberOfPokemon)
{
curTicks = 0; // Just to ensure the number of ticks when unpaused will start from 0
pauseSpawner = false;
}
else if(pauseSpawner == false)
{
curTicks += 1;
if(curTicks >= tickRate)
{
SpawnPokemon(); // Or whatever your method is to spawn in a pokemon from the spawner
currentNumberOfPokemon += 1;
curTicks = 0;
}
}
}
Then all you have to do is make it so it subtracts 1 from currentNumberOfPokemon when one is defeated in battle. Also, you'd have to make sure in the spawners settings that the variable pauseUntilNumberOfPokemon is not greater then maxNumberOfPokemon.