BUG: Crashes with Butchercraft
brisingraerowing opened this issue ยท 2 comments
Minecraft Version
1.19.2
Forge Version
43.3.8
Lightman's Currency Version
2.2.1.2
Environment Type
Minecraft Client (Bug/crash happened in a single-player world or while the game was booting)
Other relevant Mods
Butchercraft 2.3.4
Describe the bug
Random crash when Butchercraft spawns a mob with an animal hood and several related animals around it. It does so with a null
MobSpawnType
, which is perfectly valid.
To Reproduce
- Install LC and Butchercraft
- Load a world
- Wait for random-ish crash
Screenshots/Logs/Crash Reports
https://gist.github.com/brisingraerowing/d3676dd14010717c1aa022fe763f3c39
Considering that the MobSpawnType
field of the MobSpawnEvent.FinalizeSpawn
constructor (the event I listen to to define a mobs spawn-type) is not flagged @Nullable
unlike the SpawnGroupData
,CompoundTag
, and BaseSpawner
fields that follow. Therefore its input should not ever be a null value, same as the return value of MobSpawnEvent.FinalizeSpawn#getSpawnType
.
I will add a null check to keep issues like this from occurring in the future, but I'm not going to expedite an update to fix an issue that isn't even my fault, so the fix will be posted whenever the next LC update comes out.
Butchercraft's developer really should be using NATURAL
(when naturally spawned) or even MOB_SUMMONED
(when summoned by another mob) for their spawn types, as null is not a valid input in that function.
Bonus Research:
I did some extra research after writing the above, and even the base EntityType#spawn
function that they call doesn't have that field flagged as @Nonnull
(and once again, the same function has other fields that are, so it's not an oversight or anything of the sorts), and Mojang always uses the NonNullByDefault
flag on every class they ever make, so that is 100% not supposed to ever receive a null MobSpawnType
like what ButcherCraft is giving it on lines 98/99 & 110/111 of their event listener class.
Edit:
For reference, here's my developer environments copy of the aforementioned EntityType#spawn
function: