Bulk commit

This commit is contained in:
nea
2023-07-11 21:01:58 +02:00
parent 4444fcca44
commit 4d93f475aa
39 changed files with 951 additions and 40 deletions

View File

@@ -30,6 +30,7 @@ import kotlin.io.path.readText
import kotlin.io.path.writeText
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
import kotlin.time.Duration
import net.minecraft.client.gui.screen.Screen
import net.minecraft.text.Text
import moe.nea.firmament.Firmament
@@ -139,6 +140,25 @@ abstract class ManagedConfig(val name: String) {
return option(propertyName, default, BooleanHandler(this))
}
protected fun duration(
propertyName: String,
min: Duration,
max: Duration,
default: () -> Duration,
): Option<Duration> {
return option(propertyName, default, DurationHandler(this, min, max))
}
protected fun integer(
propertyName: String,
min: Int,
max: Int,
default: () -> Int,
): Option<Int> {
return option(propertyName, default, IntegerHandler(this, min, max))
}
protected fun button(propertyName: String, runnable: () -> Unit): Option<Unit> {
return option(propertyName, { }, ClickHandler(this, runnable))
}