Isaac.Spawn() Crash Fix
Most mods use a function named Isaac.Spawn() to spawn just about everything in the game (visual effects, familiars, pickups, etc.). However, this function has a very small chance (1 in 4294967296) to Crash the game if the randomly generated seed happens to be 0.
Since it’s unlikely that every mod that uses Isaac.Spawn() will update their code to account for this possibility, I created this mod to patch the problem directly.
The issue affects all versions of the game, including REPENTOGON, although it is likely that the issue will be fixed in their next update. While Repentance may eventually receive a patch, this issue also affects Afterbirth+, which is unlikely to receive one. Therefore, this mod will remain available to protect Afterbirth+ users.
While it is true that the necessary checks to avoid this edge case add some overhead, in practice this "slowdown" is irrelevant. The most time-consuming part of the function is not the checks, but the actual spawning of the entity, and the difference is significant. Even when the function is called frequently enough to potentially skip frames (around 1000 spawns in a single frame), the added delay cannot be noticed in terms of milliseconds.