
TPS lag from blade trap
LemADEC opened this issue ยท 2 comments
As of 1.12.2-1.4.0, blade trap are using ~1% server CPU by itself.
world.getEntitiesWithinAABB()
is very slow, should be only called as a last resort, every ticks.
Current version is calling it every ticks, for every tile entities.
Consider scanning the player list instead of all entities, using world.getPlayers()
.
Consider checking for players only every few seconds with a bit of randomness.
I'll look into this. This was always a great mod, though until I took over it and saw the source code I had no idea how unoptimized it was. I've been trying to fix some of this with, but this slipped by.
Checking the player list would make more sense in general. Don't know how soon -- this isn't my only, or favorite project, and then there's real life. But this should not be that complicated to fix (unlike lizalfos, which may stay broken).