Naturally Charged Creepers (Fabric)

Naturally Charged Creepers (Fabric)

87.6k Downloads

[1.14.4] Recent change to allowing/disallowing spawners causes high server TPS lag

noobanidus opened this issue ยท 3 comments

commented

I don't have full reference on me at the minute, but running Spark as a profiler resulted in about 35% of the tick time being taken up by the "can entities spawn" function specifically via the Forge hook associated with your mod.

I'll try to have a look through the code to see if anything jumps out at me. (This would be proportional to the number of people online at the time)

commented

Have you taken a look at the code yet? It's indeed something I'm still trying to tweak. The amount of resources used with 1 or 2 players was fine, but I can imagine a full server makes it more difficult.

There is currently a "cooldown" which prevents the campfire check when another entity is nearby which did the check. It's currently set to 20 seconds, but I'll make it configurable so you can up that cooldown. I think that will improve the computational speed, and won't affect the gameplay too much. The only thing I can think of is when a village campfire loads it might not immediately prevent spawns.

Let me know though if you've got improvements for it of your own. The complete source can be found here: https://github.com/ricksouth/FAB-Library

commented

I haven't had a chance, but my mental implementation has a hash set stored in WorldSavedData and iterating over it calculating the distance of the spawn type to the blockposition, which should be O(n) at worst case scenario (if there are none found), then have an event which removes the stored blockpos... I havne't looked at your implementation to see what it's like, of course.

commented

Not sure, if you're still interested but nonetheless I've updated FAB Library (the find a block library mod for both campfire mods) to version 1.2. I made a mistake converting ms into seconds, and the check happened way too often.

Also, I've added a config where you can increase the time in between checks around entities.

Thanks for opening the issue! :)

https://www.curseforge.com/minecraft/mc-mods/fab-library