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

Commit

Permalink
Fix crash when vanilla dfu fails due to vanilla bug. See https://bugs…
Browse files Browse the repository at this point in the history
  • Loading branch information
NotStirred committed Mar 28, 2022
1 parent 21f6888 commit 82496d9
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,19 @@ private CompoundTag mergeOldNbt(CubePos pos, CompoundTag[] cubeTags) {

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

cubeTags[i] = NbtUtils.update(this.dataFixer, DataFixTypes.CHUNK, cubeTags[i], version, 1493);
//if (nbt.getCompound("Level").getBoolean("hasLegacyStructureData")) {
// if (this.legacyStructureHandler == null) {
// this.legacyStructureHandler = LegacyStructureDataHandler.getLegacyStructureHandler(worldKey, (DimensionDataStorage)persistentStateManagerFactory.get());
// }
// nbt = this.legacyStructureHandler.updateFromLegacy(nbt);
//}
cubeTags[i] = NbtUtils.update(this.dataFixer, DataFixTypes.CHUNK, cubeTags[i], Math.max(1493, version));
try {
cubeTags[i] = NbtUtils.update(this.dataFixer, DataFixTypes.CHUNK, cubeTags[i], version, 1493);
//if (nbt.getCompound("Level").getBoolean("hasLegacyStructureData")) {
// if (this.legacyStructureHandler == null) {
// this.legacyStructureHandler = LegacyStructureDataHandler.getLegacyStructureHandler(worldKey, (DimensionDataStorage)persistentStateManagerFactory.get());
// }
// nbt = this.legacyStructureHandler.updateFromLegacy(nbt);
//}
cubeTags[i] = NbtUtils.update(this.dataFixer, DataFixTypes.CHUNK, cubeTags[i], Math.max(1493, version));
} catch (Exception e) {
System.err.printf("Vanilla DFU error on (%d, %d, %d)!\n", pos.getX(), pos.getY(), pos.getZ());
e.printStackTrace(System.err);
}
if (cubeTags[i] == null) {
LOGGER.warn("Dropping incomplete cube at " + pos);
return null;
Expand Down

0 comments on commit 82496d9

Please sign in to comment.