aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/gui/config/FirmamentConfigScreenProvider.kt
blob: faad1cc03a2fc00dd4004a5d72ec1478acbeaa90 (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
package moe.nea.firmament.gui.config

import net.minecraft.client.gui.screen.Screen
import moe.nea.firmament.util.compatloader.CompatLoader

interface FirmamentConfigScreenProvider {
	val key: String
	val isEnabled: Boolean get() = true

	fun open(parent: Screen?): Screen

	companion object : CompatLoader<FirmamentConfigScreenProvider>(FirmamentConfigScreenProvider::class) {
		val providers by lazy {
			allValidInstances
				.filter { it.isEnabled }
				.sortedWith(
					Comparator
						.comparing<FirmamentConfigScreenProvider, Boolean>({ it.key == "builtin" })
						.reversed()
						.then(Comparator.comparing({ it.key }))
				).toList()
		}
	}
}