mortuusars / Exposure

Camera mod for Minecraft with focus on process and aesthetics.
https://www.curseforge.com/minecraft/mc-mods/exposure
94 stars 20 forks source link

LensFocalRanges config being reset on launch when new lenses are added #59

Closed stalkernaut closed 8 months ago

stalkernaut commented 9 months ago

Ive been adding some custom lenses with kubejs and it works when i update the config while running minecraft. but for some reason when i relaunch minecraft the config gets reset to only have the spyglass

lenses original config: LensFocalRanges = ["minecraft:spyglass,150-150","kubejs:lens_red,18-94","kubejs:lens_purple,57-133","kubejs:lens_blue,96-172","kubejs:lens_teal,135-211","kubejs:lens_green,174-250","kubejs:lens_yellow,213-283","kubejs:lens_creative,18-283"]

lenses config after relaunch: LensFocalRanges = ["minecraft:spyglass,150-150"]

mortuusars commented 9 months ago

This is probably that issue with config loading/reloading thread safety. It's also happenning in my other mod. I have been told by a person on a forge team that I cannot really do anything about it. I think they will fix it in some new NeoForge version.

If that's the issue here, installing ModernFix should fix it.

XezolesS commented 8 months ago

I'm having exact same issue with a 1.19.2 Fabric, Exposure 1.4.0 I tried to add items from vanilla minecraft and kubejs items at the same time, and only the kubejs one got deleted at the startup I have already installed ModernFix but nothing changes Is there any suggestion? If there's no solution I would rather abandon kubejs and try to make addon that adds lenses.

mortuusars commented 8 months ago

Hm. now that you pointed that only kubejs items are failing, maybe it's because kubejs items are not registered at the time of config loading. I'll look into it again, maybe it could be fixed.

XezolesS commented 8 months ago

i think that's right. here is the log of config loading

[04:59:09] [Render thread/ERROR]: Lens property 'kubejs:test_lens,20-160' is not a valid. java.lang.IllegalStateException: air is not a valid item for lens property. Value: kubejs:test_lens,20-160
[04:59:09] [Render thread/WARN]: Configuration file E:\CurseForge\Minecraft\Instances\Takoyaki Fabric\config\exposure-common.toml is not correct. Correcting
[04:59:09] [Render thread/ERROR]: Lens property 'kubejs:test_lens,20-160' is not a valid. java.lang.IllegalStateException: air is not a valid item for lens property. Value: kubejs:test_lens,20-160
[04:59:09] [Render thread/ERROR]: Lens property 'kubejs:test_lens,20-160' is not a valid. java.lang.IllegalStateException: air is not a valid item for lens property. Value: kubejs:test_lens,20-160
[04:59:09] [Render thread/WARN]: Incorrect key Camera.LensFocalRanges was corrected from [minecraft:spyglass,55-200, kubejs:test_lens,20-160, minecraft:emerald,10-300] to its default, [minecraft:spyglass,55-200, minecraft:emerald,10-300]. 
[04:59:09] [Render thread/WARN]: Incorrect key Photographs was corrected from null to its default, SimpleCommentedConfig:{}. 
[04:59:09] [Render thread/WARN]: Incorrect key Photographs.StackedPhotographsMaxSize was corrected from null to its default, 16. 
[04:59:09] [Render thread/INFO]: Exposure: Config updated.
Camera Lenses: {spyglass=FocalRange[min=55, max=200], emerald=FocalRange[min=10, max=300]}

It cannot find kubejs:test_lens and removed it from the config.