Skip to content

Fix SGDimensionMap save file name being invalid on Windows - #30

Merged
Algent merged 4 commits into
masterfrom
algent/fix-dimension-map-filename
Oct 30, 2026
Merged

Algent merged 4 commits into
masterfrom
algent/fix-dimension-map-filename

Conversation

@Algent

@Algent Algent commented Oct 30, 2026 •

Copy link
Copy Markdown

Summary

While trying to startup a local dedicated to test a dev on a gate world from someone else I ran into that error being very semi spammed in the logs.

[22:51:23] [File IO Thread/ERROR] [HodgepodgeWorldDataSaver]: Failed to write data to file .\World\data\sgcraft:dimension_map.dat
java.nio.file.InvalidPathException: Illegal char <:> at index 20: .\World\data\sgcraft:dimension_map.dat
        at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:191) ~[?:?]
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:142) ~[?:?]
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:46) ~[?:?]
        at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92) ~[?:?]
        at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:203) ~[?:?]
        at java.base/java.io.File.toPath(File.java:2099) ~[?:?]
        at Launch//com.mitchej123.hodgepodge.util.WorldDataSaver.writeData(WorldDataSaver.java:159) ~[WorldDataSaver.class:?]
        at Launch//com.mitchej123.hodgepodge.util.WorldDataSaver.func_75814_c(WorldDataSaver.java:82) [WorldDataSaver.class:?]
        at Launch//com.mitchej123.hodgepodge.util.WorldDataSaver$DrainTask.func_75814_c(WorldDataSaver.java:245) [WorldDataSaver$DrainTask.class:?]
        at Launch//net.minecraft.world.storage.ThreadedFileIOBase.func_75736_b(SourceFile:30) [azr.class:?]
        at Launch//net.minecraft.world.storage.ThreadedFileIOBase.run(SourceFile:23) [azr.class:?]
        at java.base/java.lang.Thread.run(Thread.java:1474) [?:?]
[22:51:23] [File IO Thread/ERROR] [Hodgepodge]: java.nio.file.InvalidPathException: Illegal char <:> at index 20: .\World\data\sgcraft:dimension_map.dat

This is a fix for that , plus also a bump of deps and buildscript since it haven't been done in a while.

Full Explanation

The dimension map was saved as "sgcraft:dimension_map.dat", and ":" isn't a valid filename character on Windows.

  • On Windows with vanilla saving, java.io.File writes it as a hidden NTFS alternate data stream on an empty "sgcraft" file. This works, but the data is lost when the world is zipped or copied to another machine.
  • Hodgepodge's WorldDataSaver uses File.toPath(), which rejects the ":", so every save fails with InvalidPathException.
  • A world made on Linux and extracted on Windows usually ends up with sgcraft_dimension_map.dat. SGCraft never reads that file and starts an empty map, which can break stargate addresses.

Fix

  • Save as sgcraft_dimension_map.dat instead.
  • If the new file doesn't exist, read the old sgcraft:dimension_map.dat once and save it under the new name. This covers both Linux files and Windows hidden streams. The old file is left in place.

Checklist

  • I have tested this PR in DevEnv
  • I have tested this PR in Fullpack
  • This PR is in compliance with the GTNH AI Policy

@Algent Algent added the Bug Fix Fixes a bug. Please link it in the PR if an issue exists for it. label Oct 30, 2026
@Algent
Algent requested a review from a team October 30, 2026 22:38
@Algent
Algent merged commit b052727 into master Oct 30, 2026
1 check passed
@Algent
Algent deleted the algent/fix-dimension-map-filename branch October 30, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Fix Fixes a bug. Please link it in the PR if an issue exists for it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants