Possible workaround / clue:
Generate a world with view range 32, join and let chunks finish spawning, reduce view range to 2, then exit, set view range back to 32 in options menu, then rejoin, explore in any direction. The problem is gone, around spawn as well as when exploring further and on consecutive exit/rejoins. As long as view range is reduced before exit, the problem does not occur.
Taking a look at solving this with some modders, @Philipp Provenzano if you're interested join us on the Minecraft WorldGen discord at https://discord.gg/BuBGds9, dev-1-17 channel. A few more things to note:
When you generate a new world with view range 32, stand still, let chunks finish spawning, reduce view range to 16, then exit/rejoin, there does not appear to be a problem.
When you generate a new world with view range 16, stand still, let chunks finish spawning, exit/rejoin, then increase view range to 32, you get a perfect 1 chunk wide rectangular band of regenerated chunks. (this is also mentioned in original post)
This makes it easy to debug at least.
@Philipp Provenzano: All tests were done with render distance 16, just did another test with 32, when traveling north after each exit/rejoin, I get a band of regenerated chunks every time. Have confirmed findings via code and without mods, though I also have an (admittedly goofy) test setup to make the problem clearly visible:
[media]
*North at 10 o clock, though lines appear no matter which direction you travel.
Have done some debugging with Forge client, trying to see what happens to the affected band of chunks on the boundaries of the generated area when exiting.
net.minecraft.world.server.saveAllChunks() (different mappings than original poster, otherwise the same code).
if (flush)
{ ... }
else {
this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((chunkHolder) -> {
IChunk ichunk = chunkHolder.getChunkToSave().getNow((IChunk)null);
if (ichunk instanceof ChunkPrimerWrapper || ichunk instanceof Chunk)
{ this.save(ichunk); chunkHolder.refreshAccessibility(); }
});
}
When exiting the world, saveAllChunks is called, it reaches "IChunk ichunk = chunkHolder.getChunkToSave().getNow((IChunk)null);", however ichunk is null after this. When inspecting chunkHolder for these chunks, I see the following:
*Edit: After more debugging, and disabling the wasAccessibleSinceLastSave filter, the affected chunks turned out to be of type ChunkPrimer, which also makes them fail the instanceof check, present in both the flush and non-flush branches.
Unfortunately I'm new to 1.16 coming from 1.12, so I'm not knowledgeable on these things, will continue to do some digging though. If you need any more info let me know, hope it helps, cheers.
All tests done with render distance 16.
After generating a (rectangular) spawn area and exiting/rejoining the SP client, then exploring to generate chunks, a band of chunks 1 chunk wide around the previously generated area is generated a second time.
This does not happen only around spawn, it repeats on every exit/rejoin. Using the steps in the aforementioned Forge issue, after adding some logic to make regenerated chunks visible, I generated spawn, exited/rejoined, traveled north, found a 1-wide band of regenerated chunks, exited/rejoined again, traveled farther north, found another band of regenerated chunks, repeated with same result, etc. To be clear: Chunks appear to have both chunkgen and decoration run twice, so this doesn't only affect resources spawned by adjacent chunks.
*Note: Tested with MC 1.16.5 Forge 36.1.6 SP client render distance 16, though the problem appears identical to the vanilla issue. Hope it helps, cheers.
Chunks appear to be generated+decorated twice on exit/reload, leading to cut off resources, have also been able to confirm via debugging, see: https://github.com/MinecraftForge/MinecraftForge/issues/7766#issuecomment-841545896. Great job tracking this down, hope it can be fixed soon.
Chunks appear to be generated+decorated twice on exit/reload, leading to cut off resources, have been able to confirm via debugging, see: https://github.com/MinecraftForge/MinecraftForge/issues/7766#issuecomment-841545896.
MC-224729 seems like the likely culprit and has more detail.
@Philipp Provenzano, SuperCoder is with us on the discord, unfortunately the hackfix did not work.