Fallback to uncompressed when reading player data (paulevsGitch/BetterNether#436)
This commit is contained in:
parent
07d8c56e18
commit
60574d5b75
1 changed files with 13 additions and 3 deletions
|
@ -41,6 +41,7 @@ import java.util.function.BiConsumer;
|
|||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.zip.ZipException;
|
||||
|
||||
/**
|
||||
* API to manage Patches that need to get applied to a world
|
||||
|
@ -397,7 +398,8 @@ public class DataFixerAPI {
|
|||
private static void fixPlayer(MigrationProfile data, State state, File file) {
|
||||
try {
|
||||
LOGGER.info("Inspecting " + file);
|
||||
CompoundTag player = NbtIo.readCompressed(file);
|
||||
|
||||
CompoundTag player = readNbt(file);
|
||||
boolean[] changed = { false };
|
||||
fixPlayerNbt(player, changed, data);
|
||||
|
||||
|
@ -599,4 +601,12 @@ public class DataFixerAPI {
|
|||
Patch.getALL().add(patch.get());
|
||||
}
|
||||
|
||||
private static CompoundTag readNbt(File file) throws IOException {
|
||||
try {
|
||||
return NbtIo.readCompressed(file);
|
||||
} catch (ZipException e){
|
||||
return NbtIo.read(file);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue