Wizard's Reborn

Wizard's Reborn

603k Downloads

Knowledge tick is expensive/laggy

someaddons opened this issue ยท 3 comments

commented

Image(one single player)

The way the player tick is structure for adding knowledge is a bit laggy, esp with multiple players.
From looking at the code it looks like its searching the whole inventory for each knowledge by itself which is probably why it is laggy as with multiple ItemKnowledges its searching the same inventory a lot of times.

I think you could restructure it a bit to loop the inventory once, and lookup the relevant Knowledge via HashSet<Item> or similar for fast O(1) access. And maybe even do this only every 10 ticks and add 10 times the knowledge then.

Great mod otherwise :)

commented

yea, this is a problematic code
i think such a solution can help, thanks

commented

also please update the mod to the latest version, I constantly fix bugs

commented

ah ye will do, just currently planning which mods to add to a new packs, once the list is final gonna update all :)