Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.

Commit e7d3b31

Browse files
committed
Fix crash when vanilla dfu fails due to vanilla bug. See https://bugs.mojang.com/browse/MC-241172 as one example
1 parent b6d0e16 commit e7d3b31

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

src/main/java/io/github/opencubicchunks/cubicchunks/world/storage/RegionCubeIO.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,19 @@ private CompoundTag mergeOldNbt(CubePos pos, CompoundTag[] cubeTags) {
380380

381381
int version = ChunkStorage.getVersion(cubeTags[i]);
382382

383-
cubeTags[i] = NbtUtils.update(this.dataFixer, DataFixTypes.CHUNK, cubeTags[i], version, 1493);
384-
//if (nbt.getCompound("Level").getBoolean("hasLegacyStructureData")) {
385-
// if (this.legacyStructureHandler == null) {
386-
// this.legacyStructureHandler = LegacyStructureDataHandler.getLegacyStructureHandler(worldKey, (DimensionDataStorage)persistentStateManagerFactory.get());
387-
// }
388-
// nbt = this.legacyStructureHandler.updateFromLegacy(nbt);
389-
//}
390-
cubeTags[i] = NbtUtils.update(this.dataFixer, DataFixTypes.CHUNK, cubeTags[i], Math.max(1493, version));
383+
try {
384+
cubeTags[i] = NbtUtils.update(this.dataFixer, DataFixTypes.CHUNK, cubeTags[i], version, 1493);
385+
//if (nbt.getCompound("Level").getBoolean("hasLegacyStructureData")) {
386+
// if (this.legacyStructureHandler == null) {
387+
// this.legacyStructureHandler = LegacyStructureDataHandler.getLegacyStructureHandler(worldKey, (DimensionDataStorage)persistentStateManagerFactory.get());
388+
// }
389+
// nbt = this.legacyStructureHandler.updateFromLegacy(nbt);
390+
//}
391+
cubeTags[i] = NbtUtils.update(this.dataFixer, DataFixTypes.CHUNK, cubeTags[i], Math.max(1493, version));
392+
} catch (Exception e) {
393+
System.err.printf("Vanilla DFU error on (%d, %d, %d)!\n", pos.getX(), pos.getY(), pos.getZ());
394+
e.printStackTrace(System.err);
395+
}
391396
if (cubeTags[i] == null) {
392397
LOGGER.warn("Dropping incomplete cube at " + pos);
393398
return null;

0 commit comments

Comments
 (0)