aboutsummaryrefslogtreecommitdiff
path: root/src/compat/configured/java/ConfigCategory.kt
blob: 4e33b8bff3df5b9deecc7e33c58b7e956ff0d5d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package moe.nea.firmament.compat.configured

import com.mrcrayfish.configured.api.ConfigType
import com.mrcrayfish.configured.api.IConfigEntry
import com.mrcrayfish.configured.api.IModConfig
import com.mrcrayfish.configured.util.ConfigHelper
import java.nio.file.Path
import java.util.function.Consumer
import moe.nea.firmament.Firmament
import moe.nea.firmament.gui.config.ManagedConfig

class ConfigCategory(
    val category: ManagedConfig
) : BaseConfig() {

    override fun getRoot(): IConfigEntry {
        return ConfigNode(category)
    }

    override fun getTranslationKey(): String? {
        return category.translationKey
    }
}

abstract class BaseConfig : IModConfig {
    override fun update(p0: IConfigEntry) {
        ConfigHelper.getChangedValues(p0).forEach {
            it as ConfigValue
            it.saveValue()
        }
    }

    override fun getType(): ConfigType {
        return ConfigType.CLIENT
    }

    override fun getFileName(): String {
        return ""
    }

    override fun getModId(): String {
        return Firmament.MOD_ID
    }

    override fun loadWorldConfig(p0: Path?, p1: Consumer<IModConfig>?) {
    }

}