aboutsummaryrefslogtreecommitdiff
path: root/src/compat/moulconfig
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-27 17:26:42 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-27 17:26:42 +0100
commit8df225399f1932b8824d2fc44f4c964bc47fc6aa (patch)
treea2f1d7f64f68242aaaa5b97df2c15665eb7d12ce /src/compat/moulconfig
parentccb5c556def69ea16a52c00b3fbfe3a224f51ac2 (diff)
downloadFirmament-8df225399f1932b8824d2fc44f4c964bc47fc6aa.tar.gz
Firmament-8df225399f1932b8824d2fc44f4c964bc47fc6aa.tar.bz2
Firmament-8df225399f1932b8824d2fc44f4c964bc47fc6aa.zip
feat: Add pickobulus blocker on private island
Diffstat (limited to 'src/compat/moulconfig')
-rw-r--r--src/compat/moulconfig/java/MCConfigEditorIntegration.kt29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/compat/moulconfig/java/MCConfigEditorIntegration.kt b/src/compat/moulconfig/java/MCConfigEditorIntegration.kt
index 20a79a8..dec2559 100644
--- a/src/compat/moulconfig/java/MCConfigEditorIntegration.kt
+++ b/src/compat/moulconfig/java/MCConfigEditorIntegration.kt
@@ -20,6 +20,7 @@ import io.github.notenoughupdates.moulconfig.gui.editors.ComponentEditor
import io.github.notenoughupdates.moulconfig.gui.editors.GuiOptionEditorAccordion
import io.github.notenoughupdates.moulconfig.gui.editors.GuiOptionEditorBoolean
import io.github.notenoughupdates.moulconfig.gui.editors.GuiOptionEditorButton
+import io.github.notenoughupdates.moulconfig.gui.editors.GuiOptionEditorDropdown
import io.github.notenoughupdates.moulconfig.gui.editors.GuiOptionEditorText
import io.github.notenoughupdates.moulconfig.observer.GetSetter
import io.github.notenoughupdates.moulconfig.processor.ProcessedCategory
@@ -31,9 +32,11 @@ import kotlin.time.Duration.Companion.seconds
import kotlin.time.DurationUnit
import net.minecraft.client.gui.screen.Screen
import net.minecraft.util.Identifier
+import net.minecraft.util.StringIdentifiable
import net.minecraft.util.Util
import moe.nea.firmament.Firmament
import moe.nea.firmament.gui.config.BooleanHandler
+import moe.nea.firmament.gui.config.ChoiceHandler
import moe.nea.firmament.gui.config.ClickHandler
import moe.nea.firmament.gui.config.DurationHandler
import moe.nea.firmament.gui.config.FirmamentConfigScreenProvider
@@ -115,7 +118,33 @@ class MCConfigEditorIntegration : FirmamentConfigScreenProvider {
}
}
+ fun <T> helpRegisterChoice() where T : Enum<T>, T : StringIdentifiable {
+ register(ChoiceHandler::class.java as Class<ChoiceHandler<T>>) { handler, option, categoryAccordionId, configObject ->
+ object : ProcessedEditableOptionFirm<T>(option, categoryAccordionId, configObject) {
+ override fun createEditor(): GuiOptionEditor {
+ return GuiOptionEditorDropdown(
+ this,
+ handler.universe.map { handler.renderer.getName(option, it).string }.toTypedArray()
+ )
+ }
+
+ override fun toT(any: Any?): T? {
+ return handler.universe[any as Int]
+ }
+
+ override fun getType(): Type {
+ return Int::class.java
+ }
+
+ override fun fromT(t: T): Any {
+ return t.ordinal
+ }
+ }
+ }
+ }
+
init {
+ helpRegisterChoice<Nothing>()
register(BooleanHandler::class.java) { handler, option, categoryAccordionId, configObject ->
object : ProcessedEditableOptionFirm<Boolean>(option, categoryAccordionId, configObject) {
override fun createEditor(): GuiOptionEditor {