Create sections for chunk conversion if non-existant

Required to add in the new biome sections
This commit is contained in:
Spottedleaf 2021-12-18 01:04:00 -08:00
parent b71babb3c8
commit a5872264a3

View file

@ -15710,14 +15710,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final MapType<String>[] newBiomes = createBiomeSections(level, isOverworld, minSection, isAlreadyExtended);
+ final MapType<String> wrappedEmptyBlockPalette = getEmptyBlockPalette();
+
+ final ListType sections = level.getList("Sections", ObjectType.MAP);
+ ListType sections = level.getList("Sections", ObjectType.MAP);
+ if (sections == null) {
+ level.setList("Sections", sections = Types.NBT.createEmptyList());
+ }
+
+ // must update sections for two things:
+ // 1. the biomes are now stored per section, so we must insert the biomes palette into each section (and create them if they don't exist)
+ // 2. each section must now have block states (or at least DFU is ensuring they do, but current code does not require)
+ V2841.SimplePaletteReader bottomSection = null;
+ final Set<String> allBlocks = new HashSet<>();
+ if (sections != null) {
+ final IntOpenHashSet existingSections = new IntOpenHashSet();
+
+ for (int i = 0, len = sections.size(); i < len; ++i) {
@ -15777,7 +15779,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ newSection.setGeneric("biomes", newBiomes[sectionIndex]);
+ }
+ }
+
+ // update status so interpolation can take place
+ predictChunkStatusBeforeSurface(level, allBlocks);