Lag in LivingUpdateEvent
LemADEC opened this issue ยท 4 comments
Minecraft version: 1.12.2
Wizardry version: 4.2.11
Environment: Server
Issue details:
Lag consistently reported with LagGoogle in LivingUpdateEvent handling
From the look of it, there's quite a few of such events in the mod and they're all updating entities every tick.
A simple workaround would be to only update every 20 ticks or so, since most of those don't need single tick reaction time.
For example, you can do a smooth and fast check like so:
if ((entity.ticksExisted & 0xF) != (entity..getEntityId() & 0xF)) {
return;
}
Other mods involved: https://www.curseforge.com/minecraft/modpacks/fsg-arcania-craft/files/3020551
Link to crash report (if applicable): n/a
Hm, interesting. I'll have a look through them and see where I can cut out some updates without causing problems.
On a similar note, the PotionSlowtime.cleanUpEntities() could also be slowed down to run every 20 ticks or so, especially when considering it currently recreates an array of all entities every tick.
I've gone through all receivers of LivingUpdateEvent
and cut down the frequency wherever I can, however I think the main problem is how imbuements are handled in WizardData
(currently it iterates through the inventory for each imbuement), so I'll rewrite that system and hopefully that will reduce the lag to an acceptable level.