Flush clipboards before writing schematics.

#1286
Dieser Commit ist enthalten in:
dordsor21 2021-09-18 03:19:49 +01:00
Ursprung bd95d5a86d
Commit dbbb450172
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
4 geänderte Dateien mit 7 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -72,6 +72,7 @@ public class FastSchematicWriter implements ClipboardWriter {
@Override
public void write(Clipboard clipboard) throws IOException {
clipboard.flush();
// For now always write the latest version. Maybe provide support for earlier if more appear.
write2(clipboard);
}

Datei anzeigen

@ -153,6 +153,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
@Override
public void write(Clipboard clipboard) throws IOException {
clipboard.flush();
write(clipboard, "FAWE");
}

Datei anzeigen

@ -31,6 +31,7 @@ public class PNGWriter implements ClipboardWriter {
@Override
public void write(Clipboard clipboard) throws IOException {
clipboard.flush();
Region region = clipboard.getRegion();
int width = region.getWidth();
int height = region.getHeight();

Datei anzeigen

@ -78,6 +78,10 @@ public class SpongeSchematicWriter implements ClipboardWriter {
@Override
public void write(Clipboard clipboard) throws IOException {
//FAWE start - ensure clipboard is flushed in case of using clipboard-on-disk. Maintains allowing of the same code
// between upstream and FAWE
clipboard.flush();
//FAWE end
// For now always write the latest version. Maybe provide support for earlier if more appear.
outputStream.writeNamedTag("Schematic", new CompoundTag(write2(clipboard)));
}