Skip to content

Sable ignores the flush parameter when saving sublevels #1539

Description

@Auroali

Sable ignores the flush parameter (bl) in ServerLevelMixin when saving sublevels, causing the game to write sublevel data to disk every save. Vanilla avoids writing chunks to disk when this parameter is false. Ideally Sable would only attempt to write data when flush is true as IO can be expensive, especially on older systems with mechanical drives.

@Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;saveLevelData()V", shift = At.Shift.BEFORE))
public void sable$saveSubLevels(final ProgressListener progressListener, final boolean bl, final boolean bl2, final CallbackInfo ci) {
final ServerLevel self = (ServerLevel) (Object) this;
if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingSubLevels"));
}
final ServerSubLevelContainer container = SubLevelContainer.getContainer(self);
assert container != null : "No sub-level container";
final SubLevelHoldingChunkMap holdingChunkMap = container.getHoldingChunkMap();
holdingChunkMap.saveAll();
}

This is likely related to #739

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions