UPDATE: See additional information below. Actual bug is: Structures do not regenerate correctly when chunks are regenerated. Null pointer error actually happened on a world that originally had forge, and was re-loaded into vanilla; and did not happen on a world that was a re-creation in pure vanilla.
—
Well, it crashed in startup.
What I did: I am trying to track down the source of "ghost towns", generating with no people, no chest in the smithy.
I have managed to reproduce this with forge, only – no mods. So now I needed to see if this happened in vanilla.
I found a town. Quit the game. Deleted the region files, so that the world would be regenerated when I logged back in.
What I expected to happen was...:
The world would be created, either with a village, with people (in which case the problem is with forge), or without people (in which case the problem is with vanilla).
What actually happened was...:
Null pointer.
Steps to Reproduce:
1. New world.
2. Find a village.
3. Quit game.
4. Delete all the .mca files in the region folder.
5. Restart.
Comments 3
However, when a structure, such as a village, is re-created from the data in the structure files, it does not rebuild "supplemental" stuff such as people, or chests
Entities and tile entities are of course stored in the region files.
In village.dat
there are only stored the coordinates and types of the houses.
If village.dat
is still exisiting while recreating the chunks, the entities and tile entities are not recreated.
Not a bug of the game, since you are messing around with the files.
I agree with "works as programmed"
I disagree with "works as intended".
There have been, in the past, bugs that have resulted in chunks being regenerated because of errors. I believe the code still has checks for invalid data and forceably regenerating the chunks when that happens.
My point is, when a chunk is being regenerated, then all the information should be regenerated.
There are two potential ways that this can be done:
1. On chunk generation, ignore anything about that chunk already in the structure files; write out any new data about structures generated afterwards. This is arguably the proper way – as seen when a 164 village was "restored" into a 174 landscape, the structures are made based on how the ground is made, and when the ground changes, the old structure data should be replaced with new ones.
2. If structure information is to override new generation, then the structure information needs to be complete enough for a full duplication.
Right now, the structure information is not complete, and so the chunks do not generate completely when structure data overrides chunk generation.
Since the result is inconsistent chunks / inconsistent generation, while working as-programmed, it does not seem to be as-intended. Not when the result is that the old system behaved better than the new system.
So I did some playing around.
First: Re-creating the world, brand-new, in vanilla (so the test is in a copy of the world that has never seen forge): No null pointer.
HOWEVER: The village on re-creation is a ghost town. No people. Additionally, no chest in the smithy.
Try again with 174: World loads just fine. Same issue.
Delete region file: Surprise! There is now a stained clay mesa hills biome there. And, in the middle of the stained clay, desert village buildings, sometimes dozens of blocks down in the hill. Not on the surface, deep in the ground. Where the buildings were before.
No people. No chest in the smithy.
Look around for a 174 village. Find one. People, smithy, chest in the smithy.
Quit, delete region files, restart.
Newly rebuilt town. Farm land starts dry, hydrates. No people. All the animals around – sheep, horses, etc – are there. Just no people, no chest in smithy.
Quit, delete region files, * and delete the two village data structure tracking files *
Restart. Village is there. People are there. Chest is there.
===
So the initial problem – null pointer on server startup – seems to be because of something left over from forge. No clue what. It goes away on a world that never saw forge.
However, when a structure, such as a village, is re-created from the data in the structure files, it does not rebuild "supplemental" stuff such as people, or chests. I am curious to see what would happen in a rebuilt pyramid (treasure chests? TNT?), or temple (chests? arrow dispensers?), or mineshaft (any of the wood support beams? Any of the minecarts with chests?), etc.
In other words, only part of the information is stored in the structure files, and only that is used to rebuild.
===
At first guess, it is entities that are not being saved/restored. This is understandable – entities such as villagers can wander. But tile entities, such as chests, don't. And, just as horses/sheep are recreated with the landscape, so too villagers should be recreated with the village landscape.
So, there is more information about the structure at generation, than is saved in the structure files.
And when it finds structure file information, it only uses that, and ignores/does not actually regenerate the whole place.
Wonder if this means that the blaze spawners in the nether fortresses would go poof as well?