Flush clipboards before writing schematics.

#1286
This commit is contained in:
dordsor21 2021-09-18 03:19:49 +01:00
parent bd95d5a86d
commit dbbb450172
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
4 changed files with 7 additions and 0 deletions

View File

@ -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);
}

View File

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

View File

@ -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();

View File

@ -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)));
}