SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Allow opt-in mod asset interception

Pathoschild opened this issue ยท 2 comments

commented

Mods using IAssetLoader/IAssetEditor can intercept vanilla assets loaded from the Content folder (including an asset provided by another IAssetLoader), but they can't intercept private mod assets.

Consider rewriting the content pipeline so a mod can explicitly allow interception.

commented

A mod could possibly opt in like this:

helper.Content.Load<Texture2D>("assets/mod-file.png", allowModEdits: true);

Then other mods could intercept the file using its internal asset key, including through Content Patcher:

{
   "Action": "EditImage",
   "Target": "SMAPI/mod-id/assets/mod-file.png",
   "FromFile": "assets/content-pack-file.png",
   "PatchMode": "Overlay"
}
commented

I looked into this a bit, but I don't think it's worth the added complexity and edge cases so I kept it out of the planned content API redesign. Instead I'll document how to do it using the new asset events once the new API is implemented.