Skip to content

Add mutable filesystem overlays - #478

Open
AlexIIL wants to merge 11 commits into
QuiltMC:developfrom
AlexIIL:mutable-fs-overlay
Open

Add mutable filesystem overlays#478
AlexIIL wants to merge 11 commits into
QuiltMC:developfrom
AlexIIL:mutable-fs-overlay

Conversation

@AlexIIL

@AlexIIL AlexIIL commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

This allows mods to add new files to their own filesystem via a separate "overlay" filesystem.

This allows mods to dynamically generate resources that will be automatically picked up by fabric-api or QSL's resource loading system, and they can be used by minecraft. This is somewhat similar to mods like ARRP, and QSL's InMemoryPack, except this is independent to the resource loader (and minecraft version).

Adding .class files in this way doesn't work, as quilt-loader has optimizations in place to make searching for classes faster. I don't expect this to be a major problem since mods can already define new classes with their own class loader.

A related new feature this adds to all quilt extended filesystems is dynamic files - these are defined as a Supplier<byte[]>, and generate the file contents every time they are accessed.

Mods must opt-in to this feature at the moment, by adding this to their quilt_loader block inside their quilt.mod.json file:

"required_features": [ "modifiable_filesystem_overlay" ]

The file system overlay can be accessed via ModContainer.getMutableFileOverlay(), which throws an UnsupportedOperationException if the mod hasn't requested the feature. Attempting to modify the mod via ModContainer.rootPath() will not work.

I originally wanted to support modifying the mod's entire filesystem, which would allow removing files and folders rather than just adding them. Unfortunately this would likely require mounting folders inside of an ExtendedFileSystem (to allow mods to reload resources inside a development environment) but this is a lot harder to implement than I first thought, so I'll leave that until later.

This also needs to be actually defined in the quilt.mod.json spec.

…ing-in for modifiable file systems. Also add support for modifiable overlays.
…m now, and I'd rather not clutter the main package with more in the future.
…ntable folders aren't implemented yet, which is needed to make that feature work in a development environment).
@eristhea eristhea added the enhancement new feature or improvement label Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement new feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants