I am playing a custom set of mods that includes Millenaire, and I really cranked up the settings to create a dense amount of villages and active chunks. Of course, I now get block-break lag where the server ticks are just taking too much time to keep up.
I have a Java programming background and so I inspected things in VisualVM to see what is taking so much time. It appears MillVillager.checkGoals() and MillVillager.setNextGoal() is taking the most time, and in that, it's the isStillValid() checks in both of these calls that slow things down. Specifically, it's the Building.countGoods() that takes the longest.
I haven't taken the time to decompile your mod to see how these calls are done, but could they be done less frequently? As in a villager checks their goals once every 20 ticks? Or a cap of 20 villagers may check their goals in a tick according to a round-robin turn at a tick? Or cache the building's goods counts and update that less frequently? I'd think users would rather have a villager pause for a second after completing a task rather than cause server-wide block lag on all actions.
1 post • Page 1 of 1