Builderb0y / BigGlobe

This is my worldgen mod for Minecraft. There are many like it, but this one is mine.
Other
56 stars 3 forks source link

`/locate structure`ing delegated vanilla structures freezes server thread #8

Closed maximumpower55 closed 5 months ago

maximumpower55 commented 6 months ago

Step 1: /locate structure bigglobe:mineshaft Step 2: ??? Step 3: Profit? latest - Copy.log

Edit: After staying in the pause screen for awhile it seems to unfreeze but it gets super laggy until i reload the world after that, its very interesting how this only happens with delegated structures even when im right next to one which should speed up the search

Builderb0y commented 5 months ago

Hopefully fixed in V4.1.1.

The issue was that delegating structures are actually a different structure than the one they're mimicking. So when the game asks bigglobe:mineshaft to add itself to the chunk, it secretly adds minecraft:mineshaft to that chunk instead. Which then means that when you try to /locate bigglobe:mineshaft, it doesn't actually find that structure in the chunk that it was supposed to spawn in. So the game tries to load more chunks searching for it. And then more, and more, and loading all these chunks all at once is what causes the freeze.

My solution was two-fold:

  1. Check for the correct structure.
  2. Only load chunks where the structure could potentially spawn in.

This made the whole process much faster, even for structures that are genuinely nowhere nearby. Let me know if you find any other issues with it.