mortuusars/Exposure

[Question] Cache data GC?

juan-90s opened this issue · 3 comments

I noticed that every image shooted store as a .dat file in the directory world/data/exposure. Is there any mechanism in game to clean those unused and dropped image which can not be reached by players. I worry that the world directory size goes larger and larger.

There isn't at the moment. It's a tricky thing to do.
I have planned to add a command to clear unused exposures (exposures are flagged when printed), but rejected it due to fears that some antiviruses can flag the mod as a virus because it deletes many files. Only recently some users reported that Windows Defender was false-flagging some mods as a threat (including exposure) and it was fixed by updating Defender. So I don't want to risk it.

Besides that - there's other issues with it: what if the player just prepared several film rolls but have not yet printed images from it? They would get deleted - as they weren't printed. It's not possible to be certain that specific exposure is not in use anywhere. I can't scan whole world and each end every item.

And another thing: you would need 20k+ exposures to reach 1GB (with default frame size).

I've made an addon that can help manage stored exposures:
https://www.curseforge.com/minecraft/mc-mods/exposure-catalog
https://modrinth.com/mod/exposure-catalog

Even though it's does not really do what you asked for, but it's probably the closest thing to it that I can do.
With Catalog you can easily delete exposures that were not printed, if that's acceptable solution in your case.

Thank you. It does help a lot. It’s a simple and efficient approach. Other method like broad searching the whole world or auto references count might be difficult to implement and maintain.