aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-10-13 21:46:46 +0200
committerLinnea Gräf <nea@nea.moe>2024-10-13 21:46:46 +0200
commit4e9b0ded27df8b6ce7f5b2fa1b4b1ddbc1cbd452 (patch)
treea489fdd97e6c4dde1bd77bf216ed9c2ec2657db3 /src
parent0cc77949c907d38497f8cdf6fd8198fe5f0a9440 (diff)
downloadFirmament-4e9b0ded27df8b6ce7f5b2fa1b4b1ddbc1cbd452.tar.gz
Firmament-4e9b0ded27df8b6ce7f5b2fa1b4b1ddbc1cbd452.tar.bz2
Firmament-4e9b0ded27df8b6ce7f5b2fa1b4b1ddbc1cbd452.zip
Add config categories
Diffstat (limited to 'src')
-rw-r--r--src/compat/configured/java/BaseConfigNode.kt5
-rw-r--r--src/compat/configured/java/ConfiguredCompat.kt3
-rw-r--r--src/compat/yacl/java/YaclIntegration.kt24
-rw-r--r--src/main/kotlin/commands/rome.kt7
-rw-r--r--src/main/kotlin/features/chat/AutoCompletions.kt76
-rw-r--r--src/main/kotlin/features/chat/ChatLinks.kt2
-rw-r--r--src/main/kotlin/features/debug/DeveloperFeatures.kt2
-rw-r--r--src/main/kotlin/features/debug/PowerUserTools.kt2
-rw-r--r--src/main/kotlin/features/diana/DianaWaypoints.kt2
-rw-r--r--src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt2
-rw-r--r--src/main/kotlin/features/events/carnival/CarnivalFeatures.kt2
-rw-r--r--src/main/kotlin/features/fixes/CompatibliltyFeatures.kt2
-rw-r--r--src/main/kotlin/features/fixes/Fixes.kt2
-rw-r--r--src/main/kotlin/features/inventory/ItemRarityCosmetics.kt2
-rw-r--r--src/main/kotlin/features/inventory/PetFeatures.kt3
-rw-r--r--src/main/kotlin/features/inventory/PriceData.kt2
-rw-r--r--src/main/kotlin/features/inventory/SaveCursorPosition.kt2
-rw-r--r--src/main/kotlin/features/inventory/SlotLocking.kt2
-rw-r--r--src/main/kotlin/features/inventory/buttons/InventoryButtons.kt2
-rw-r--r--src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt2
-rw-r--r--src/main/kotlin/features/mining/PickaxeAbility.kt2
-rw-r--r--src/main/kotlin/features/mining/PristineProfitTracker.kt2
-rw-r--r--src/main/kotlin/features/texturepack/CustomSkyBlockTextures.kt2
-rw-r--r--src/main/kotlin/features/world/FairySouls.kt2
-rw-r--r--src/main/kotlin/features/world/Waypoints.kt2
-rw-r--r--src/main/kotlin/gui/config/AllConfigsGui.kt46
-rw-r--r--src/main/kotlin/gui/config/ManagedConfig.kt340
-rw-r--r--src/main/kotlin/gui/config/ManagedOption.kt2
-rw-r--r--src/main/kotlin/repo/RepoManager.kt4
-rw-r--r--src/main/resources/assets/firmament/gui/config/category.xml42
-rw-r--r--src/main/resources/assets/firmament/gui/config/main.xml6
-rw-r--r--src/main/resources/assets/firmament/lang/en_us.json13
32 files changed, 363 insertions, 246 deletions
diff --git a/src/compat/configured/java/BaseConfigNode.kt b/src/compat/configured/java/BaseConfigNode.kt
index 7330990..afe0375 100644
--- a/src/compat/configured/java/BaseConfigNode.kt
+++ b/src/compat/configured/java/BaseConfigNode.kt
@@ -4,11 +4,12 @@ import com.mrcrayfish.configured.api.IConfigEntry
import com.mrcrayfish.configured.api.IConfigValue
import net.minecraft.text.Text
import moe.nea.firmament.gui.config.AllConfigsGui
+import moe.nea.firmament.gui.config.ManagedConfig
object BaseConfigNode : IConfigEntry {
override fun getChildren(): List<IConfigEntry> {
- return AllConfigsGui.allConfigs.map {
- ConfigNode(it)
+ return ManagedConfig.allManagedConfigs.getAll().map {
+ ConfigNode(it) // TODO: fix add categories here
}
}
diff --git a/src/compat/configured/java/ConfiguredCompat.kt b/src/compat/configured/java/ConfiguredCompat.kt
index a5b78bb..8e8b022 100644
--- a/src/compat/configured/java/ConfiguredCompat.kt
+++ b/src/compat/configured/java/ConfiguredCompat.kt
@@ -6,6 +6,7 @@ import com.mrcrayfish.configured.api.IModConfigProvider
import com.mrcrayfish.configured.api.ModContext
import moe.nea.firmament.Firmament
import moe.nea.firmament.gui.config.AllConfigsGui
+import moe.nea.firmament.gui.config.ManagedConfig
/**
* Registered in `fabric.mod.json` at `custom.configured.providers`
@@ -23,7 +24,7 @@ class ConfiguredCompat : IModConfigProvider {
return "firmament.config.all-configs"
}
})
- AllConfigsGui.allConfigs.mapTo(this) { ConfigCategory(it) }
+ ManagedConfig.allManagedConfigs.getAll().mapTo(this) { ConfigCategory(it) }
}
}
}
diff --git a/src/compat/yacl/java/YaclIntegration.kt b/src/compat/yacl/java/YaclIntegration.kt
index 6c9354a..fc5ff59 100644
--- a/src/compat/yacl/java/YaclIntegration.kt
+++ b/src/compat/yacl/java/YaclIntegration.kt
@@ -6,6 +6,7 @@ import dev.isxander.yacl3.api.ButtonOption
import dev.isxander.yacl3.api.ConfigCategory
import dev.isxander.yacl3.api.LabelOption
import dev.isxander.yacl3.api.Option
+import dev.isxander.yacl3.api.OptionGroup
import dev.isxander.yacl3.api.YetAnotherConfigLib
import dev.isxander.yacl3.api.controller.ControllerBuilder
import dev.isxander.yacl3.api.controller.DoubleSliderControllerBuilder
@@ -17,7 +18,6 @@ import kotlin.time.Duration.Companion.seconds
import kotlin.time.DurationUnit
import net.minecraft.client.gui.screen.Screen
import net.minecraft.text.Text
-import moe.nea.firmament.gui.config.AllConfigsGui
import moe.nea.firmament.gui.config.BooleanHandler
import moe.nea.firmament.gui.config.ClickHandler
import moe.nea.firmament.gui.config.DurationHandler
@@ -36,15 +36,20 @@ import moe.nea.firmament.util.FirmFormatters
@AutoService(FirmamentConfigScreenProvider::class)
class YaclIntegration : FirmamentConfigScreenProvider {
fun buildCategories() =
- AllConfigsGui.allConfigs
+ ManagedConfig.Category.entries
.map(::buildCategory)
- private fun buildCategory(managedConfig: ManagedConfig): ConfigCategory {
+ private fun buildCategory(category: ManagedConfig.Category): ConfigCategory {
return ConfigCategory.createBuilder()
- .name(managedConfig.labelText)
- .also {
- it.rootGroupBuilder()
- .options(buildOptions(managedConfig.sortedOptions))
+ .name(category.labelText)
+ .also { categoryB ->
+ category.configs.forEach {
+ categoryB.group(
+ OptionGroup.createBuilder()
+ .name(it.labelText)
+ .options(buildOptions(it.sortedOptions))
+ .build())
+ }
}
.build()
}
@@ -54,7 +59,10 @@ class YaclIntegration : FirmamentConfigScreenProvider {
private fun <T : Any> buildOption(managedOption: ManagedOption<T>): Option<*> {
val handler = managedOption.handler
- val binding = Binding.generic(managedOption.default(), managedOption::value, managedOption::value.setter)
+ val binding = Binding.generic(managedOption.default(),
+ managedOption::value,
+ { managedOption.value = it; managedOption.element.save() })
+
fun <T> createDefaultBinding(function: (Option<T>) -> ControllerBuilder<T>): Option.Builder<T> {
return Option.createBuilder<T>()
.name(managedOption.labelText)
diff --git a/src/main/kotlin/commands/rome.kt b/src/main/kotlin/commands/rome.kt
index cc4f4ba..4f54872 100644
--- a/src/main/kotlin/commands/rome.kt
+++ b/src/main/kotlin/commands/rome.kt
@@ -17,6 +17,7 @@ import moe.nea.firmament.features.inventory.storageoverlay.StorageOverlayScreen
import moe.nea.firmament.features.inventory.storageoverlay.StorageOverviewScreen
import moe.nea.firmament.gui.config.AllConfigsGui
import moe.nea.firmament.gui.config.BooleanHandler
+import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.gui.config.ManagedOption
import moe.nea.firmament.init.MixinPlugin
import moe.nea.firmament.repo.HypixelStaticData
@@ -39,11 +40,11 @@ fun firmamentCommand() = literal("firmament") {
thenLiteral("toggle") {
thenArgument("config", string()) { config ->
suggestsList {
- AllConfigsGui.allConfigs.asSequence().map { it.name }.asIterable()
+ ManagedConfig.allManagedConfigs.getAll().asSequence().map { it.name }.asIterable()
}
thenArgument("property", string()) { property ->
suggestsList {
- (AllConfigsGui.allConfigs.find { it.name == this[config] } ?: return@suggestsList listOf())
+ (ManagedConfig.allManagedConfigs.getAll().find { it.name == this[config] } ?: return@suggestsList listOf())
.allOptions.entries.asSequence().filter { it.value.handler is BooleanHandler }
.map { it.key }
.asIterable()
@@ -52,7 +53,7 @@ fun firmamentCommand() = literal("firmament") {
val config = this[config]
val property = this[property]
- val configObj = AllConfigsGui.allConfigs.find { it.name == config }
+ val configObj = ManagedConfig.allManagedConfigs.getAll().find { it.name == config }
if (configObj == null) {
source.sendFeedback(
Text.stringifiedTranslatable(
diff --git a/src/main/kotlin/features/chat/AutoCompletions.kt b/src/main/kotlin/features/chat/AutoCompletions.kt
index 9144898..9e0de40 100644
--- a/src/main/kotlin/features/chat/AutoCompletions.kt
+++ b/src/main/kotlin/features/chat/AutoCompletions.kt
@@ -1,5 +1,3 @@
-
-
package moe.nea.firmament.features.chat
import com.mojang.brigadier.arguments.StringArgumentType.string
@@ -17,41 +15,41 @@ import moe.nea.firmament.util.MC
object AutoCompletions : FirmamentFeature {
- object TConfig : ManagedConfig(identifier) {
- val provideWarpTabCompletion by toggle("warp-complete") { true }
- val replaceWarpIsByWarpIsland by toggle("warp-is") { true }
- }
-
- override val config: ManagedConfig?
- get() = TConfig
- override val identifier: String
- get() = "auto-completions"
-
- @Subscribe
- fun onMaskCommands(event: MaskCommands) {
- if (TConfig.provideWarpTabCompletion) {
- event.mask("warp")
- }
- }
-
- @Subscribe
- fun onCommandEvent(event: CommandEvent) {
- if (!TConfig.provideWarpTabCompletion) return
- event.deleteCommand("warp")
- event.register("warp") {
- thenArgument("to", string()) { toArg ->
- suggestsList {
- RepoManager.neuRepo.constants?.islands?.warps?.flatMap { listOf(it.warp) + it.aliases } ?: listOf()
- }
- thenExecute {
- val warpName = get(toArg)
- if (warpName == "is" && TConfig.replaceWarpIsByWarpIsland) {
- MC.sendServerCommand("warp island")
- } else {
- MC.sendServerCommand("warp $warpName")
- }
- }
- }
- }
- }
+ object TConfig : ManagedConfig(identifier, Category.CHAT) {
+ val provideWarpTabCompletion by toggle("warp-complete") { true }
+ val replaceWarpIsByWarpIsland by toggle("warp-is") { true }
+ }
+
+ override val config: ManagedConfig?
+ get() = TConfig
+ override val identifier: String
+ get() = "auto-completions"
+
+ @Subscribe
+ fun onMaskCommands(event: MaskCommands) {
+ if (TConfig.provideWarpTabCompletion) {
+ event.mask("warp")
+ }
+ }
+
+ @Subscribe
+ fun onCommandEvent(event: CommandEvent) {
+ if (!TConfig.provideWarpTabCompletion) return
+ event.deleteCommand("warp")
+ event.register("warp") {
+ thenArgument("to", string()) { toArg ->
+ suggestsList {
+ RepoManager.neuRepo.constants?.islands?.warps?.flatMap { listOf(it.warp) + it.aliases } ?: listOf()
+ }
+ thenExecute {
+ val warpName = get(toArg)
+ if (warpName == "is" && TConfig.replaceWarpIsByWarpIsland) {
+ MC.sendServerCommand("warp island")
+ } else {
+ MC.sendServerCommand("warp $warpName")
+ }
+ }
+ }
+ }
+ }
}
diff --git a/src/main/kotlin/features/chat/ChatLinks.kt b/src/main/kotlin/features/chat/ChatLinks.kt
index f2cb78a..0681f57 100644
--- a/src/main/kotlin/features/chat/ChatLinks.kt
+++ b/src/main/kotlin/features/chat/ChatLinks.kt
@@ -35,7 +35,7 @@ object ChatLinks : FirmamentFeature {
override val identifier: String
get() = "chat-links"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.CHAT) {
val enableLinks by toggle("links-enabled") { true }
val imageEnabled by toggle("image-enabled") { true }
val allowAllHosts by toggle("allow-all-hosts") { false }
diff --git a/src/main/kotlin/features/debug/DeveloperFeatures.kt b/src/main/kotlin/features/debug/DeveloperFeatures.kt
index 56ee398..2001a3f 100644
--- a/src/main/kotlin/features/debug/DeveloperFeatures.kt
+++ b/src/main/kotlin/features/debug/DeveloperFeatures.kt
@@ -26,7 +26,7 @@ object DeveloperFeatures : FirmamentFeature {
.iterate { it.parent }
.find { it.resolve("settings.gradle.kts").exists() }
- object TConfig : ManagedConfig("developer") {
+ object TConfig : ManagedConfig("developer", Category.DEV) {
val autoRebuildResources by toggle("auto-rebuild") { false }
}
diff --git a/src/main/kotlin/features/debug/PowerUserTools.kt b/src/main/kotlin/features/debug/PowerUserTools.kt
index 529f011..83e3aff 100644
--- a/src/main/kotlin/features/debug/PowerUserTools.kt
+++ b/src/main/kotlin/features/debug/PowerUserTools.kt
@@ -37,7 +37,7 @@ object PowerUserTools : FirmamentFeature {
override val identifier: String
get() = "power-user"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.DEV) {
val showItemIds by toggle("show-item-id") { false }
val copyItemId by keyBindingWithDefaultUnbound("copy-item-id")
val copyTexturePackId by keyBindingWithDefaultUnbound("copy-texture-pack-id")
diff --git a/src/main/kotlin/features/diana/DianaWaypoints.kt b/src/main/kotlin/features/diana/DianaWaypoints.kt
index 205e237..6d87262 100644
--- a/src/main/kotlin/features/diana/DianaWaypoints.kt
+++ b/src/main/kotlin/features/diana/DianaWaypoints.kt
@@ -10,7 +10,7 @@ object DianaWaypoints : FirmamentFeature {
override val identifier get() = "diana"
override val config get() = TConfig
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.EVENTS) {
val ancestralSpadeSolver by toggle("ancestral-spade") { true }
val ancestralSpadeTeleport by keyBindingWithDefaultUnbound("ancestral-teleport")
val nearbyWaypoints by toggle("nearby-waypoints") { true }
diff --git a/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt b/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt
index 8926a95..825cd6c 100644
--- a/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt
+++ b/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt
@@ -28,7 +28,7 @@ object AnniversaryFeatures : FirmamentFeature {
override val identifier: String
get() = "anniversary"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.EVENTS) {
val enableShinyPigTracker by toggle("shiny-pigs") {true}
val trackPigCooldown by position("pig-hud", 200, 300) { Point(0.1, 0.2) }
}
diff --git a/src/main/kotlin/features/events/carnival/CarnivalFeatures.kt b/src/main/kotlin/features/events/carnival/CarnivalFeatures.kt
index 1e6d97a..840fb8c 100644
--- a/src/main/kotlin/features/events/carnival/CarnivalFeatures.kt
+++ b/src/main/kotlin/features/events/carnival/CarnivalFeatures.kt
@@ -5,7 +5,7 @@ import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig
object CarnivalFeatures : FirmamentFeature {
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.EVENTS) {
val enableBombSolver by toggle("bombs-solver") { true }
val displayTutorials by toggle("tutorials") { true }
}
diff --git a/src/main/kotlin/features/fixes/CompatibliltyFeatures.kt b/src/main/kotlin/features/fixes/CompatibliltyFeatures.kt
index 7c43cf6..fa9cdda 100644
--- a/src/main/kotlin/features/fixes/CompatibliltyFeatures.kt
+++ b/src/main/kotlin/features/fixes/CompatibliltyFeatures.kt
@@ -16,7 +16,7 @@ object CompatibliltyFeatures : FirmamentFeature {
override val identifier: String
get() = "compatibility"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.INTEGRATIONS) {
val enhancedExplosions by toggle("explosion-enabled") { false }
val explosionSize by integer("explosion-power", 10, 50) { 1 }
}
diff --git a/src/main/kotlin/features/fixes/Fixes.kt b/src/main/kotlin/features/fixes/Fixes.kt
index d7b7a1c..5d70b1a 100644
--- a/src/main/kotlin/features/fixes/Fixes.kt
+++ b/src/main/kotlin/features/fixes/Fixes.kt
@@ -21,7 +21,7 @@ object Fixes : FirmamentFeature {
override val identifier: String
get() = "fixes"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.MISC) { // TODO: split this config
val fixUnsignedPlayerSkins by toggle("player-skins") { true }
var autoSprint by toggle("auto-sprint") { false }
val autoSprintKeyBinding by keyBindingWithDefaultUnbound("auto-sprint-keybinding")
diff --git a/src/main/kotlin/features/inventory/ItemRarityCosmetics.kt b/src/main/kotlin/features/inventory/ItemRarityCosmetics.kt
index 424f13b..77f5071 100644
--- a/src/main/kotlin/features/inventory/ItemRarityCosmetics.kt
+++ b/src/main/kotlin/features/inventory/ItemRarityCosmetics.kt
@@ -22,7 +22,7 @@ object ItemRarityCosmetics : FirmamentFeature {
override val identifier: String
get() = "item-rarity-cosmetics"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val showItemRarityBackground by toggle("background") { false }
val showItemRarityInHotbar by toggle("background-hotbar") { false }
}
diff --git a/src/main/kotlin/features/inventory/PetFeatures.kt b/src/main/kotlin/features/inventory/PetFeatures.kt
index 81124f3..2c11e76 100644
--- a/src/main/kotlin/features/inventory/PetFeatures.kt
+++ b/src/main/kotlin/features/inventory/PetFeatures.kt
@@ -7,7 +7,6 @@ import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.petData
-import moe.nea.firmament.util.unformattedString
import moe.nea.firmament.util.useMatch
object PetFeatures : FirmamentFeature {
@@ -17,7 +16,7 @@ object PetFeatures : FirmamentFeature {
override val config: ManagedConfig?
get() = TConfig
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val highlightEquippedPet by toggle("highlight-pet") { true }
}
diff --git a/src/main/kotlin/features/inventory/PriceData.kt b/src/main/kotlin/features/inventory/PriceData.kt
index c61f8e8..4477203 100644
--- a/src/main/kotlin/features/inventory/PriceData.kt
+++ b/src/main/kotlin/features/inventory/PriceData.kt
@@ -15,7 +15,7 @@ object PriceData : FirmamentFeature {
override val identifier: String
get() = "price-data"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val tooltipEnabled by toggle("enable-always") { true }
val enableKeybinding by keyBindingWithDefaultUnbound("enable-keybind")
}
diff --git a/src/main/kotlin/features/inventory/SaveCursorPosition.kt b/src/main/kotlin/features/inventory/SaveCursorPosition.kt
index 1c55753..c47867b 100644
--- a/src/main/kotlin/features/inventory/SaveCursorPosition.kt
+++ b/src/main/kotlin/features/inventory/SaveCursorPosition.kt
@@ -15,7 +15,7 @@ object SaveCursorPosition : FirmamentFeature {
override val identifier: String
get() = "save-cursor-position"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val enable by toggle("enable") { true }
val tolerance by duration("tolerance", 10.milliseconds, 5000.milliseconds) { 500.milliseconds }
}
diff --git a/src/main/kotlin/features/inventory/SlotLocking.kt b/src/main/kotlin/features/inventory/SlotLocking.kt
index 9f13af8..611b7e4 100644
--- a/src/main/kotlin/features/inventory/SlotLocking.kt
+++ b/src/main/kotlin/features/inventory/SlotLocking.kt
@@ -46,7 +46,7 @@ object SlotLocking : FirmamentFeature {
val lockedUUIDs: MutableSet<UUID> = mutableSetOf(),
)
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val lockSlot by keyBinding("lock") { GLFW.GLFW_KEY_L }
val lockUUID by keyBindingWithOutDefaultModifiers("lock-uuid") {
SavedKeyBinding(GLFW.GLFW_KEY_L, shift = true)
diff --git a/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt b/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt
index fa90d21..ca64f80 100644
--- a/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt
+++ b/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt
@@ -20,7 +20,7 @@ object InventoryButtons : FirmamentFeature {
override val identifier: String
get() = "inventory-buttons"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val _openEditor by button("open-editor") {
openEditor()
}
diff --git a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt
index b615c73..333b0fb 100644
--- a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt
+++ b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt
@@ -27,7 +27,7 @@ object StorageOverlay : FirmamentFeature {
override val identifier: String
get() = "storage-overlay"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val alwaysReplace by toggle("always-replace") { true }
val columns by integer("rows", 1, 10) { 3 }
val scrollSpeed by integer("scroll-speed", 1, 50) { 10 }
diff --git a/src/main/kotlin/features/mining/PickaxeAbility.kt b/src/main/kotlin/features/mining/PickaxeAbility.kt
index 1853d65..1444284 100644
--- a/src/main/kotlin/features/mining/PickaxeAbility.kt
+++ b/src/main/kotlin/features/mining/PickaxeAbility.kt
@@ -39,7 +39,7 @@ object PickaxeAbility : FirmamentFeature {
get() = "pickaxe-info"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.MINING) {
val cooldownEnabled by toggle("ability-cooldown") { true }
val cooldownScale by integer("ability-scale", 16, 64) { 16 }
val drillFuelBar by toggle("fuel-bar") { true }
diff --git a/src/main/kotlin/features/mining/PristineProfitTracker.kt b/src/main/kotlin/features/mining/PristineProfitTracker.kt
index f1bc7e5..dd9be42 100644
--- a/src/main/kotlin/features/mining/PristineProfitTracker.kt
+++ b/src/main/kotlin/features/mining/PristineProfitTracker.kt
@@ -49,7 +49,7 @@ object PristineProfitTracker : FirmamentFeature {
override val config: ManagedConfig?
get() = TConfig
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.MINING) {
val timeout by duration("timeout", 0.seconds, 120.seconds) { 30.seconds }
val gui by position("position", 80, 30) { Point(0.05, 0.2) }
}
diff --git a/src/main/kotlin/features/texturepack/CustomSkyBlockTextures.kt b/src/main/kotlin/features/texturepack/CustomSkyBlockTextures.kt
index 2aca8e8..b641959 100644
--- a/src/main/kotlin/features/texturepack/CustomSkyBlockTextures.kt
+++ b/src/main/kotlin/features/texturepack/CustomSkyBlockTextures.kt
@@ -26,7 +26,7 @@ object CustomSkyBlockTextures : FirmamentFeature {
override val identifier: String
get() = "custom-skyblock-textures"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.INTEGRATIONS) { // TODO: should this be its own thing?
val enabled by toggle("enabled") { true }
val skullsEnabled by toggle("skulls-enabled") { true }
val cacheForever by toggle("cache-forever") { true }
diff --git a/src/main/kotlin/features/world/FairySouls.kt b/src/main/kotlin/features/world/FairySouls.kt
index 8a8291a..eec9b04 100644
--- a/src/main/kotlin/features/world/FairySouls.kt
+++ b/src/main/kotlin/features/world/FairySouls.kt
@@ -38,7 +38,7 @@ object FairySouls : FirmamentFeature {
object DConfig : ProfileSpecificDataHolder<Data>(serializer(), "found-fairysouls", ::Data)
- object TConfig : ManagedConfig("fairy-souls") {
+ object TConfig : ManagedConfig("fairy-souls", Category.MISC) {
val displaySouls by toggle("show") { false }
val resetSouls by button("reset") {
DConfig.data?.foundSouls?.clear() != null
diff --git a/src/main/kotlin/features/world/Waypoints.kt b/src/main/kotlin/features/world/Waypoints.kt
index 91a06da..d535b4e 100644
--- a/src/main/kotlin/features/world/Waypoints.kt
+++ b/src/main/kotlin/features/world/Waypoints.kt
@@ -38,7 +38,7 @@ object Waypoints : FirmamentFeature {
override val identifier: String
get() = "waypoints"
- object TConfig : ManagedConfig(identifier) {
+ object TConfig : ManagedConfig(identifier, Category.MINING) { // TODO: add to misc
val tempWaypointDuration by duration("temp-waypoint-duration", 0.seconds, 1.hours) { 30.seconds }
val showIndex by toggle("show-index") { true }
val skipToNearest by toggle("skip-to-nearest") { false }
diff --git a/src/main/kotlin/gui/config/AllConfigsGui.kt b/src/main/kotlin/gui/config/AllConfigsGui.kt
index c72b8b0..0e68bc8 100644
--- a/src/main/kotlin/gui/config/AllConfigsGui.kt
+++ b/src/main/kotlin/gui/config/AllConfigsGui.kt
@@ -4,24 +4,35 @@ import io.github.notenoughupdates.moulconfig.observer.ObservableList
import io.github.notenoughupdates.moulconfig.xml.Bind
import net.minecraft.client.gui.screen.Screen
import net.minecraft.text.Text
-import moe.nea.firmament.features.FeatureManager
import moe.nea.firmament.repo.RepoManager
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.MoulConfigUtils
import moe.nea.firmament.util.ScreenUtil.setScreenLater
object AllConfigsGui {
+//
+// val allConfigs
+// get() = listOf(
+// RepoManager.Config
+// ) + FeatureManager.allFeatures.mapNotNull { it.config }
- val allConfigs
- get() = listOf(
- RepoManager.Config
- ) + FeatureManager.allFeatures.mapNotNull { it.config }
+ object ConfigConfig : ManagedConfig("configconfig", Category.META) {
+ val enableYacl by toggle("enable-yacl") { false }
+ }
fun <T> List<T>.toObservableList(): ObservableList<T> = ObservableList(this)
- class MainMapping(val allConfigs: List<ManagedConfig>) {
+ class CategoryMapping(val category: ManagedConfig.Category) {
@get:Bind("configs")
- val configs = allConfigs.map { EntryMapping(it) }.toObservableList()
+ val configs = category.configs.map { EntryMapping(it) }.toObservableList()
+
+ @Bind
+ fun name() = category.labelText.string
+
+ @Bind
+ fun close() {
+ MC.screen?.close()
+ }
class EntryMapping(val config: ManagedConfig) {
@Bind
@@ -34,12 +45,29 @@ object AllConfigsGui {
}
}
+ class CategoryView {
+ @get:Bind("categories")
+ val categories = ManagedConfig.Category.entries
+ .map { CategoryEntry(it) }
+ .toObservableList()
+
+ class CategoryEntry(val category: ManagedConfig.Category) {
+ @Bind
+ fun name() = category.labelText.string
+
+ @Bind
+ fun open() {
+ MC.screen = MoulConfigUtils.loadScreen("config/category", CategoryMapping(category), MC.screen)
+ }
+ }
+ }
+
fun makeBuiltInScreen(parent: Screen? = null): Scree