Skip to content

Conversation

@PierreSchwang
Copy link
Member

Overview

The DiskOptimizedClipboard uses a compressed OS (with underlying LZ4 streams) for storing tile and entity nbt data.
For storing the resulting bytes into the MappedByteBuffer of the clipboards file FileChannel it flushes the OutputStream after writing tile entity data and stores the resulting buffer (NBTOutputStream > FaweOutputStream > FastBufferedOutputStream > LZ4BlockOutputStream > [...] > ByteArrayOutputStream) into a local byte array.
That byte array is written into the file. If regular entity data is in the clipboard, the local buffer will be refreshed after closing the OutputStream(s) - but without those, the buffer will be the same.

The issue is, that simply flushing doesn't commit the LZ4 data if the current size does not exceed the configured block size (which is quite large in FAWE). Setting syncFlush to true in the constructor of the LZ4BlockOS forces the non-exhausted block to be written and flushed, as documented:
image

The issue won't occur if entities are written, as then the byte array would've been updated with the bytes of the underlying buffer after closing the streams (and therefor after flushing everything).

Submitter Checklist

  • Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • Ensure that the pull request title represents the desired changelog entry.
  • New public fields and methods are annotated with @since TODO.
  • I read and followed the contribution guidelines.

@PierreSchwang PierreSchwang requested a review from a team as a code owner November 30, 2025 18:44
@github-actions github-actions bot added the Bugfix This PR fixes a bug label Nov 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix This PR fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants