Skip to content

Commit

Permalink
update moulconfig version
Browse files Browse the repository at this point in the history
  • Loading branch information
catgirlseraid committed Oct 14, 2024
1 parent 79620d3 commit e3f5e39
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
libautoupdate = "1.3.1"
moulconfig = "3.0.0-beta.7"
moulconfig = "3.0.0-beta.15"
headlessLwjgl = "1.7.2"
jbAnnotations = "24.1.0"

Expand Down
16 changes: 15 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,21 @@ object ConfigGuiManager {

var editor: MoulConfigEditor<Features>? = null

fun getEditorInstance() = editor ?: MoulConfigEditor(SkyHanniMod.configManager.processor).also { editor = it }
private val replacedSearchTerms = mapOf(
"color" to "colour",
"armor" to "armour",
"endermen" to "enderman",
"enderman" to "endermen",
"hotkey" to "keybind",
"gray" to "grey"
)

fun getEditorInstance() = editor ?: MoulConfigEditor(SkyHanniMod.configManager.processor).also {
it.setSearchFunction { optionEditor, word ->
return@setSearchFunction optionEditor.fulfillsSearch(replacedSearchTerms[word] ?: word)
}
editor = it
}

fun openConfigGui(search: String? = null) {
val editor = getEditorInstance()
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/config/Features.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.github.notenoughupdates.moulconfig.Config;
import io.github.notenoughupdates.moulconfig.Social;
import io.github.notenoughupdates.moulconfig.annotations.Category;
import io.github.notenoughupdates.moulconfig.common.MyResourceLocation;
import io.github.notenoughupdates.moulconfig.gui.HorizontalAlign;
import io.github.notenoughupdates.moulconfig.processor.ProcessedCategory;
import net.minecraft.util.ResourceLocation;
Expand All @@ -32,9 +33,9 @@


public class Features extends Config {
public static final ResourceLocation DISCORD = new ResourceLocation("notenoughupdates:social/discord.png");
public static final ResourceLocation GITHUB = new ResourceLocation("notenoughupdates:social/github.png");
public static final ResourceLocation PATREON = new ResourceLocation("notenoughupdates:social/patreon.png");
public static final MyResourceLocation DISCORD = new MyResourceLocation("notenoughupdates", "social/discord.png");
public static final MyResourceLocation GITHUB = new MyResourceLocation("notenoughupdates", "social/github.png");
public static final MyResourceLocation PATREON = new MyResourceLocation("notenoughupdates", "social/patreon.png");

@Override
public boolean shouldAutoFocusSearchbar() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,4 @@ class FeatureToggleProcessor : ConfigStructureReader {
)
)
}

@Suppress("EmptyFunctionBlock")
override fun emitGuiOverlay(baseObject: Any?, field: Field?, option: ConfigOption?) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc.update

import at.hannibal2.skyhanni.SkyHanniMod
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementButton
import io.github.notenoughupdates.moulconfig.common.RenderContext
import io.github.notenoughupdates.moulconfig.gui.GuiOptionEditor
import io.github.notenoughupdates.moulconfig.internal.TextRenderUtils
import io.github.notenoughupdates.moulconfig.processor.ProcessedOption
Expand All @@ -15,7 +16,7 @@ class GuiOptionEditorUpdateCheck(option: ProcessedOption) : GuiOptionEditor(opti

val button = GuiElementButton("", -1) { }

override fun render(x: Int, y: Int, width: Int) {
override fun render(context: RenderContext?, x: Int, y: Int, width: Int) {
val fr = Minecraft.getMinecraft().fontRendererObj

GlStateManager.pushMatrix()
Expand Down

0 comments on commit e3f5e39

Please sign in to comment.