1
Need Help with Function to Throttle Mob Spawn
In my "Water World" data pack, I've converted illagers to pirates. Among other changes, I've allowed illagers to spawn (in very low numbers) as wandering hostile mobs.
The problem is that they spawn even during the day, as soon as the game starts, which means that before players even have a chance to begin equipping themselves, they might find themselves having to escape very tenacious enemies.
The obvious solution is to use a function to disable pirate spawns until a certain amount of time has passed, much like patrols won't spawn in the vanilla game until several days go by. Fairly simple.
HOWEVER....
In addition to random spawns, pirates also spawn around pirate outposts, and also on the pirate ships I'm adding to the data pack in the update I'm about to release. And I do *not* want those spawns cancelled.
The pirates in ships I can handle via a predicate which overrides the spawn throttle function in an ocean biome.
But I've yet to think of any way to allow pirates to spawn next to pirate outposts (reskinned pillager outposts) while preventing them from spawning elsewhere, as there doesn't seem to be any way to check a mob's proximity to a structure feature.
So....
Anyone got any ideas, or see something I'm missing?
The problem is that they spawn even during the day, as soon as the game starts, which means that before players even have a chance to begin equipping themselves, they might find themselves having to escape very tenacious enemies.
The obvious solution is to use a function to disable pirate spawns until a certain amount of time has passed, much like patrols won't spawn in the vanilla game until several days go by. Fairly simple.
HOWEVER....
In addition to random spawns, pirates also spawn around pirate outposts, and also on the pirate ships I'm adding to the data pack in the update I'm about to release. And I do *not* want those spawns cancelled.
The pirates in ships I can handle via a predicate which overrides the spawn throttle function in an ocean biome.
But I've yet to think of any way to allow pirates to spawn next to pirate outposts (reskinned pillager outposts) while preventing them from spawning elsewhere, as there doesn't seem to be any way to check a mob's proximity to a structure feature.
So....
Anyone got any ideas, or see something I'm missing?
2
Rainbeau_Flambe's suggestion is about what you are looking for. Just use a scoreboard timer and spawn a placeholder mob, which is replaced with a pillager or just killed depending on the timer.
Never mind. I literally just thought of a solution.
It may not be "elegant," but it will work.
I'll replace pillagers in the biome definition files with something that doesn't spawn in the overworld.... Then have a function check whenever one of them spawns, either replacing it with a pirate if enough time has elapsed, or just deleting it without a replacement if not.
It may not be "elegant," but it will work.
I'll replace pillagers in the biome definition files with something that doesn't spawn in the overworld.... Then have a function check whenever one of them spawns, either replacing it with a pirate if enough time has elapsed, or just deleting it without a replacement if not.
