Custom spawning algorithm causing severe TPS/FPS loss
Funwayguy opened this issue ยท 7 comments
While helping debug a mod pack and it's problem with lag I stumbled across this piece of code:
This algorithm appears to be running every tick and seems to be responsible for severe loss in TPS to the point of even freezing the game for up to a whole second. Even when putting the game into peaceful mode, hostile mobs continued to spawn via this script and did not despawn.
Thank you and I look forward to a fix soon.
I don't think it's that code that's causing the problem.
Hostile mobs should despawn when on peaceful mode regardless of how they were spawned and I'm sure it's working as intended (with my combination of mods anyway).
You must have some other mod that is messing with how mobs work/spawn. Can you give me a mod list?
We had only the Erebus mod installed while testing this. Only disabling the game rule for mob spawning stopped the lag.
Only some hostile mobs weren't despawning, I believe a type of centipede was one of them.
May I suggest at least using "world.getTotalWorldTime()%20 == 0" to mitigate the amount of calls to this method to once per second instead of every tick.
Please tell us which forge version you are using.
Hostile mobs spawning in peaceful (or not de-spawning) basically shouldn't and can't happen using our code.
All hostile mobs de-spawn in peaceful and some mobs that are 'creatures' who are hostile eg. The Rhino and Titan Beetles specifically have code to make them de-spawn on peaceful.
Here is the mod list for the pack in question: http://pastebin.com/K8aPH8a6
Please note: Void Decay and Epic Siege Mod were both removed from the pack and the "lag" issue persisted.
I will be streaming development of this pack today to collect more data to give you (www.twitch.tv/Darkosto)
Thank you for your patience and assistance!
Here's an example of where the "lag" in question is happening:
Seed: "-9203439170981527153"
X: 104 Y: 27 Z:441
Closing issue as this is now a priority fix and has be moved here #444.