Naturalist

Naturalist

17M Downloads

[Bug]: `Lion::finalizeSpawn` does not call super, preventing Forge from saving the `MobSpawnType`

Fuzss opened this issue ยท 0 comments

commented

Mod Version

4.0.3

Mod Loader

Forge

Mod Loader Version

47.2.0

What happened?

Lion::finalizeSpawn does not call super and therefore does not allow Forge to save the MobSpawnType: https://github.com/MinecraftForge/MinecraftForge/blob/309116520b7f308de93f93ff27b67762c3c57c9a/patches/minecraft/net/minecraft/world/entity/Mob.java.patch#L97
I don't really see a reason in your implementation why super shouldn't be called:

public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType reason, @Nullable SpawnGroupData spawnData, @Nullable CompoundTag dataTag) {

Having access to the MobSpawnType is important to mods like my Respawning Animals mod.
Would be great if this could be fixed. Not sure if it's an issue with other mobs from this mod, too, only found the lion for now.

Also on another note I noticed this:
[Respawning Animals/]: Mismatched spawn type for naturalist:butterfly! Mob is registered as AMBIENT, but spawning as CREATURE. Report this to the author of Naturalist at https://github.com/starfish-studios/Naturalist/issues.
Registering an EntityType with a different MobCategory than is used for spawning is generally not so great since the mob will not count towards its own spawn cap which can lead to infinite spawning.
In vanilla this is not an issue since there are vanilla mobs without this mismatch in the spawning pool which will fill up the mob cap on their own, but with mods such as Respawning Animals the mismatch has serious implications in game due to the spawning cycle changes.
I honestly don't even know why the vanilla implementation works this way and even allows such a mismatch to exist. Is there any reason why you do not use the same MobCategory in both places?