Fuzss / respawninganimals

Animals no longer stay in the world forever, instead they spawn and disappear like monsters.
https://www.curseforge.com/minecraft/mc-mods/respawning-animals
Mozilla Public License 2.0
3 stars 3 forks source link

Added friendsandfoes:mauler to the blacklist #16

Closed Faboslav closed 10 months ago

Faboslav commented 10 months ago

Hello, based on this https://github.com/Faboslav/friends-and-foes/issues/126#issuecomment-1676404060, it would be great to have friendsandfoes:mauler on the blacklist by default.

Fuzss commented 10 months ago

Thanks, I reworked the mod, so this is now a tag, the mauler is included by default.

But unfortunately this doesn't quite seem to work: The overspawning is solved, but apart from that maulers only spawn a few times and then stop spawning at all. I tested this in a single biome desert world, a few would spawn around the spawn, but as soon as you start traveling a little you wouldn't find a single one.

I also extensively tested the blacklist tag feature with vanilla mobs and that works without issues: Blacklisted animals continue to spawn from chunk generation and stay in the world forever, while all other animals spawn as part of the spawning cycle and are able to despawn again just like monsters.

Do you maybe do something special when it comes to mauler spawning?

Also I noticed that you are making maulers persistent upon spawning (here). I assume you are doing this to prevent them from despawning like monsters? If this is the case that's not the correct method. The problem with persistence is that mobs with that tag don't count towards the spawn cap. Preventing a mob from despawning like animals is achieved by overriding Mob::removeWhenFarAway and returning false (no clue what it's called in Yarn). Overriding that method might even make maulers work with Respawning Animals.

Fuzss commented 10 months ago

I did some more digging, and removing this line allows mauler spawning to work as it does without Respawning Animals installed as long as they are blacklisted.

But I don't understand why that could be an issue. 🙈 I ran a lot of tests and that code does what it should: Preventing animals affected by Respawning Animals from spawning during chunk generation. Maulers don't end up in that if branch, so they are not blocked, I verified that. But it appears that blocking other animals from chunk generation prevents any maulers from spawning at all, the event doesn't even fire for them anymore, meaning they are not spawning.

I really don't understand how the blocked spawns of other entities can result in this... Maybe you have an idea?