Список изменений
What' s changed.
Fixing repeated creation of SaveHandler covering session.lock causing save interruptions, and adding persistent per-save difficulty for unlocked archives.
Root cause: Multiple calls to getActiveAnvilConverter().getSaveLoader(name, false) create new SaveHandler for running worlds, whose constructor setSessionLock() overwrites the archive's session.lock. Subsequently, saveLevel()'s checkSessionLock() throws exceptions due to timestamp mismatch and aborts saving, causing two symptoms:
- Archive list sorting degrades to 'creation order' (LastPlayed cannot be updated, should normally be 'recent play priority');
- Difficulty of unlocked archives resets to default (normal) upon exiting and re-entering. These are two manifestations of the same root cause 'save interrupted'.
Fix: Change all 8 calls to create new SaveHandler to reuse the running world's server.worldServers[0].getSaveHandler() (all with worldServers null protection):
- MixinIntegratedServer: loadAllWorlds(hardcore) and initiateShutdown are changed to reuse; startServer keeps difficulty loading deferred until loadAllWorlds completes;
- MixinGuiOptions: hardcore auto-lock, lock confirmation, unlock confirmation are refactored to reuse via @unique helper method;
- DifficultyLocker.onServerStarting is changed to reuse;
- GuiWorldSettings.saveWorldData is changed to reuse.
New addition: WorldDifficultyData adds a currentDifficulty snapshot field (stored in difficultylocker.dat). On exit, record the current world difficulty; on loading, restore it, so unlocked worlds retain independent difficulty per save like 1.8+; New worlds without records do not override game default difficulty. Old archives without this key are handled as -1 for backward compatibility.
Full Changelog: https://github.com/song682/ModernDifficultyLocker/compare/v1.1.0...v1.2.0

