Remove dataStorage.save() call that conflicts with fastasyncworldsave

storeRefinedStorageDisks() called DimensionDataStorage.save() directly
to flush RS2 data before reading the .dat file. This triggers all
SavedData saves simultaneously and conflicts with fastasyncworldsave's
async save mixin, causing ConcurrentModificationException crash.

Fix: Only mark RS2 SavedData as dirty (setDirty()) and let the normal
world save cycle handle the flush. The .dat file read may get slightly
stale data but avoids crashing the server.

Vyrriox
This commit is contained in:
laforetbrut 2026-03-26 18:51:27 +01:00
parent 484f1a8c05
commit 7c89df7d1b

View File

@ -451,13 +451,14 @@ public class ModsSupport {
if (diskUuids.isEmpty()) return;
try {
// Force RS2's SavedData to flush to disk before reading
// Mark RS2's SavedData as dirty so it gets saved on the next world save.
// Do NOT call dataStorage.save() directly - it conflicts with fastasyncworldsave
// and other mods that mixin into DimensionDataStorage, causing ConcurrentModificationException.
com.refinedmods.refinedstorage.common.api.storage.StorageRepository repo =
com.refinedmods.refinedstorage.common.api.RefinedStorageApi.INSTANCE.getStorageRepository(sp.serverLevel());
if (repo instanceof net.minecraft.world.level.saveddata.SavedData sd) {
sd.setDirty();
}
sp.getServer().overworld().getDataStorage().save();
// Read the .dat file directly (getDataFile is private, use reflection)
java.io.File datFile = getRS2DataFile(sp);