fabric-1.18: update to 1.18 chunk format

This commit is contained in:
Kosma Moczek 2021-11-26 18:37:22 +01:00
parent 038f9c7085
commit b82095fcb6
2 changed files with 7 additions and 6 deletions

View File

@ -165,7 +165,7 @@ public class ChunkSnapshot {
sectcnt++;
}
/* Get sections */
NbtList sect = nbt.getList("Sections", 10);
NbtList sect = nbt.getList("sections", 10);
for (int i = 0; i < sect.size(); i++) {
NbtCompound sec = sect.getCompound(i);
int secnum = sec.getByte("Y");
@ -186,10 +186,11 @@ public class ChunkSnapshot {
sections.set(secnum + sectoff, cursect);
DynmapBlockState[] states = cursect.states;
DynmapBlockState[] palette = null;
// If we've got palette and block states list, process non-empty section
if (sec.contains("Palette", 9) && sec.contains("BlockStates", 12)) {
NbtList plist = sec.getList("Palette", 10);
long[] statelist = sec.getLongArray("BlockStates");
NbtCompound block_states = sec.getCompound("block_states");
// If we've block state data, process non-empty section
if (block_states.contains("data", 12)) {
long[] statelist = block_states.getLongArray("data");
NbtList plist = block_states.getList("palette", 10);
palette = new DynmapBlockState[plist.size()];
for (int pi = 0; pi < plist.size(); pi++) {
NbtCompound tc = plist.getCompound(pi);
@ -247,6 +248,7 @@ public class ChunkSnapshot {
}
}
/* Get biome data */
// TODO: Update to new 1.18 format (3D biomes, sectioned):
this.biome = new int[COLUMNS_PER_CHUNK];
if (nbt.contains("Biomes")) {
int[] bb = nbt.getIntArray("Biomes");

View File

@ -1099,7 +1099,6 @@ public class FabricMapChunkCache extends MapChunkCache {
Log.severe("ChunkSerializer.serialize threw a NullPointerException", e);
continue;
}
if (nbt != null) nbt = nbt.getCompound("Level");
try {
SnapshotCache.SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
ss = ssr.ss;