Lootr (Forge & NeoForge)

Lootr (Forge & NeoForge)

66M Downloads

Lag when generating chunks

LegendaryTot opened this issue ยท 12 comments

commented

Lootr is gobbling up TPS. Appears orders of magnitude higher than it should be...

Minecraft 1.18.1
Forge v 39.0.20
Lootr v0.1.13.41

Spark profiler: https://spark.lucko.me/c0wGxqbPg0

commented

That's pretty curious.

I'm very specifically making sure the chunk is loaded before doing anything with it, but it seems to be still spending a fair amount of time waiting for a chunk to load, but that chunk isn't the one with the container in it. I'll look into it, thanks.

commented

It appears to be loading adjacent or nearby chunks. Kind of 'ye olde cascading chunks' from 1.12! I'll try adding a check to ensure that any adjacent chunks are also loaded & generated before performing the operation.

commented

If you could check out 0.1.14.42, which was just released on CurseForge and see if you still have the same issues?

commented

I tried it again and TPS was still pretty bad; but I think that's partly due to another mod "The Wild Update".

Spark Profiler: https://spark.lucko.me/4X67S7ZOse

I removed that mod and tried again and Lootr still looks high:
(another mod Hexeri might be making it worse)

Spark Profiler: https://spark.lucko.me/b8WsjYxbxi

However even with just Lootr + Spark by themselves Lootr still looks a bit higher than it should be.

Spark Profiler: https://spark.lucko.me/zxTQVlhR8N

commented

Hm, in the first instance, it's the block-placed event being fired by Wild Update that's problematic.

In the second, there does appear to still be some blocking taking place. I'm not sure what to do about that now, unfortunately.

commented

I'm going to attempt to make a build with a config option that ensures all adjacent chunks are loaded.

EDIT: Looking at it again, it seems that the chunk delay caused by Hexerei and Wild Update is what's causing Lootr to delay. Checking more chunks is just going to make it worse.

Unfortunately, getChunkFuture also blocks the main thread, so I'm not sure what's really going on.

EDIT 2: As a reminder, chunk generation in 1.18 is very slow in general.

Looking at it all again, I'm not sure what else there is I can do to help alleviate.

I'm pretty sure the first two examples having Lootr quite high are a symptom of blocking caused by Hexerei/Wild Update.

That said, I will try to convert it to process asynchronously.

commented

Can you try out this version of Lootr? It has the same version number, but it has a few improvements:

  • Chunk positions are now stored when they are loaded (using an event)
  • Entries in the ticker expire after 3 minutes
  • Entries in the ticker now check to make sure that the area they are in is loaded and remove themselves otherwise
  • Radius for chunk checking is now 5*5 around the chunk location

This may also improve issues with other mods, specifically Wild Update.

commented

Here's the new profile now with that version: https://spark.lucko.me/m3BjzCkvO2

I noticed the fn calls are different and are seemingly spent on terrablender.worldgen (Biomes O' Plenty library). I removed Terra Blender + BOP and reran and now it looks significantly better: https://spark.lucko.me/k3preh2LJm

(I have another mod Hexeri that is being bad but Lootr now looks fine)

I'm guessing there might be some issue with Terra Blender + Lootr (or just Terra Blender in general since it's newish).

commented

Okay, the delay in the first one is due to treasure chest map generation taking quite a while, but that's something I can definitely fix. I'll create another new build for you because I think that will skew any sample.

commented

Can you try this build?

EDIT: The difference between both just happens to be whether or not the chest replaced had a treasure map in it or not. This build wipes the loot table before generating.

commented

Yeah it seems much better now with this build: https://spark.lucko.me/OPL9BoJAAQ
(Hexerei gonna make me cry tho)

commented

The 0.1.14.43 build should resolve all of these issues. It has a few additional fixes to the builds I posted here. Please let me know if you have any more problems!