3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 02:20:07 +01:00

Fix saving entities in DiskOptimizedClipboard when no tiles are present (#1815)

Dieser Commit ist enthalten in:
Jordan 2022-06-19 00:58:47 +01:00 committet von GitHub
Ursprung 907ad8528e
Commit 003cec30be
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -182,7 +182,7 @@ public class DiskOptimizedClipboard extends LinearClipboard {
readBiomeStatusFromHeader(); readBiomeStatusFromHeader();
int nbtCount = readNBTSavedCountFromHeader(); int nbtCount = readNBTSavedCountFromHeader();
int entitiesCount = readEntitiesSavedCountFromHeader(); int entitiesCount = readEntitiesSavedCountFromHeader();
if (Settings.settings().CLIPBOARD.SAVE_CLIPBOARD_NBT_TO_DISK && nbtCount + entitiesCount > 0) { if (Settings.settings().CLIPBOARD.SAVE_CLIPBOARD_NBT_TO_DISK && (nbtCount + entitiesCount > 0)) {
loadNBTFromFileFooter(nbtCount, entitiesCount, biomeLength); loadNBTFromFileFooter(nbtCount, entitiesCount, biomeLength);
} }
} else if (braf.length() - headerSize == ((long) getVolume() << 1) + biomeLength) { } else if (braf.length() - headerSize == ((long) getVolume() << 1) + biomeLength) {
@ -551,6 +551,7 @@ public class DiskOptimizedClipboard extends LinearClipboard {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
nbtOS.flush();
if (baOS.size() > nbtBytesRemaining) { if (baOS.size() > nbtBytesRemaining) {
LOGGER.warn( LOGGER.warn(
"Clipboard file {} does not have enough remaining space to store entity data on disk.", "Clipboard file {} does not have enough remaining space to store entity data on disk.",
@ -564,14 +565,14 @@ public class DiskOptimizedClipboard extends LinearClipboard {
} }
} }
if (output == null) {
return;
}
if (entitiesFit) { if (entitiesFit) {
output = baOS.toByteArray(); output = baOS.toByteArray();
} }
if (output == null) {
return;
}
long currentLength = this.braf.length(); long currentLength = this.braf.length();
this.braf.setLength(currentLength + baOS.size()); this.braf.setLength(currentLength + baOS.size());
MappedByteBuffer tempBuffer = fileChannel.map( MappedByteBuffer tempBuffer = fileChannel.map(