Fix loading not working on new worlds (#2807)

* fix saving when the disk file did not previously exist

* changelog
This commit is contained in:
Darkere
2021-01-03 18:49:16 +01:00
committed by GitHub
parent 0699d73815
commit 9263fbbdf5
2 changed files with 14 additions and 2 deletions

View File

@@ -1,5 +1,11 @@
# Refined Storage Changelog
### 1.9.11
- Fixed Disks and Nodes not loading when they did not previously exist
- If you are affected by this please go to the world/data/ folder and remove the ".temp" ending from the files before
launching
### 1.9.10
- Improve performance of the Grid view (ScoreUnder)

View File

@@ -36,9 +36,15 @@ public abstract class RSWorldSavedData extends WorldSavedData {
try {
CompressedStreamTools.func_244264_a(compoundnbt, tempFile);
if (fileIn.delete()) {
tempFile.renameTo(fileIn);
if (fileIn.exists()) {
if (!fileIn.delete()) {
LOGGER.error("Failed To delete " + fileIn.getName());
}
}
if (!tempFile.renameTo(fileIn)) {
LOGGER.error("Failed to rename " + tempFile.getName());
}
} catch (IOException ioexception) {
LOGGER.error("Could not save data {}", this, ioexception);
}