Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Fuzss opened this issue Feb 17, 2024 · 1 comment

Comments

@Fuzss
Copy link

Fuzss commented Feb 17, 2024

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?

@crispytwig
Copy link
Contributor

@Fuzss Hello! Apologies for the late reply, we've been on a bit of a hiatus. This was simply a mistake, and has been fixed in 4430830. The MobCategories have also been fixed in b74f709 and 0fa70f6 and I will be reviewing them shortly to confirm that they were fixed properly. Thank you!

KedisPL added a commit to KedisPL/Naturalist-1.21.4 that referenced this issue Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants