aboutsummaryrefslogtreecommitdiff
path: root/src/compat/configured/java/ConfiguredCompat.kt
blob: a5b78bb2aa685603c0166acbb89c736b6d0aefad (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
package moe.nea.firmament.compat.configured

import com.mrcrayfish.configured.api.IConfigEntry
import com.mrcrayfish.configured.api.IModConfig
import com.mrcrayfish.configured.api.IModConfigProvider
import com.mrcrayfish.configured.api.ModContext
import moe.nea.firmament.Firmament
import moe.nea.firmament.gui.config.AllConfigsGui

/**
 * Registered in `fabric.mod.json` at `custom.configured.providers`
 */
class ConfiguredCompat : IModConfigProvider {
    override fun getConfigurationsForMod(modContext: ModContext): Set<IModConfig> {
        if (modContext.modId != Firmament.MOD_ID) return emptySet()
        return buildSet {
            add(object : BaseConfig() {
                override fun getRoot(): IConfigEntry {
                    return BaseConfigNode
                }

                override fun getTranslationKey(): String? {
                    return "firmament.config.all-configs"
                }
            })
            AllConfigsGui.allConfigs.mapTo(this) { ConfigCategory(it) }
        }
    }
}