Wizardry Mod

Wizardry Mod

6M Downloads

Unicorn seems to spawn with only one UUID for all unicorns.

jmarakelian opened this issue ยท 3 comments

commented

Getting the console warning below almost indefinitely when a player on my server goes into the dimension with Unicorns. Had a server crash due to it once already.

[Warn] [WorldServer]: Keeping entity wizardry:unicorn that already exists with UUID bd6d072e-4c47-4357-b111-c24eb594bfe4.

commented

I can confirm this issue, reproducing is simple. In a creative world, dig down to y=1 and move yourself up enough to fall onto the bedrock and achieve the CRUNCH. advancement. From there, the log should show the warning OP had, though with a different UUID. Attached is a log of my recreation. The only mods installed are Wizardry, LibLib, and Forgelin.
unicorn_lag_bomb.log

commented

I feel kinda dumb, looking at this now... when we try to spawn a unicorn, we loop a couple hundred times, looking for a random spot near the player where the unicorn can spawn. Part of that "looking for a random spot" involves looping over the height values of a given column, and if it's a spawnable location, we spawn the unicorn and break out of that loop.

But wait, aren't there two loops? Yeah, turns out we're only breaking out of the inner loop, but the outer loop keeps looping on and on until the 300 spawn attempts we've hardcoded in. We spawn the unicorn at some point in that outer loop, then it keeps trying to spawn that same unicorn a couple hundred more times. If you're lucky, it won't make an error, but if not, that could be 299 duplicate spawn attempts getting logged, each time a unicorn spawns.

commented

Unfortunately, we were not able to reproduce this issue. If you can produce steps to reproduce with the newest version if Wizardry and LibLib, please comment on this issue.