package ru.dbotthepony.mc.otm.config

import net.neoforged.neoforge.common.ModConfigSpec
import kotlin.reflect.KProperty

operator fun <T : Any> ModConfigSpec.ConfigValue<T>.setValue(config: Any, property: KProperty<*>, value: T) {
	set(value)
}

operator fun <T : Any> ModConfigSpec.ConfigValue<T>.getValue(config: Any, property: KProperty<*>): T {
	return get()
}

fun ModConfigSpec.Builder.defineInRange(path: String, value: Int, minValue: Int): ModConfigSpec.IntValue {
	return defineInRange(path, value, minValue, Int.MAX_VALUE)
}

fun ModConfigSpec.Builder.defineInRange(path: String, value: Double, minValue: Double): ModConfigSpec.DoubleValue {
	return defineInRange(path, value, minValue, Double.MAX_VALUE)
}
