🧹 cleanup: 在调用栈搜索算法稳定后,不再需要向外部提供开关

This commit is contained in:
TheWhiteDog9487
2026-09-16 15:58:38 +08:00
parent 3de1313f9d
commit 2882def6bc
5 changed files with 1 additions and 22 deletions
@@ -23,8 +23,7 @@ val KeyMapping.Provider: ModInfo get() {
val ModContainer = FabricLoader.getInstance().getModContainer(CandidateModId)
if (ModContainer.isPresent) {
return ModContainer.map(::ModInfo).get() } }
if (SettingsInstance.SearchInStackTrace) {
KeyMappingToMod[this]?.let { return it } }
KeyMappingToMod[this]?.let { return it }
if (CandidateModIds.size == 1){
return ModInfo(null) }
return ModInfo(VanillaMinecraftContainer) }
@@ -44,13 +44,6 @@ class ModMenuEntryPoint: ModMenuApi {
.binding( false, { SettingsInstance.ShowDebugInfo }, { SettingsInstance.ShowDebugInfo = it } )
.controller(BooleanControllerBuilder::create )
.build() }
.option {
Option.createBuilder<Boolean>()
.name(Component.translatable("option.SearchInStackTrace"))
.description { OptionDescription.of(Component.translatable("option.SearchInStackTrace.description") ) }
.binding( true, { SettingsInstance.SearchInStackTrace }, { SettingsInstance.SearchInStackTrace = it } )
.controller(BooleanControllerBuilder::create )
.build() }
.option {
Option.createBuilder<Boolean>()
.name(Component.translatable("option.ShowFilePath"))
@@ -62,15 +62,6 @@ class Settings {
""")
var ShowDebugInfo = false
@SerialEntry(comment =
"""
是否注入KeyMapping构造函数,在每次注册按键绑定时查询线程的调用栈信息来进行强力匹配
类型:布尔值
取值范围:true false
默认值:true
""")
var SearchInStackTrace = true
@SerialEntry(comment =
"""
是否在悬停信息中显示Mod的文件路径
@@ -15,8 +15,6 @@
"option.ShowDebugInfo.description": "This information is used to troubleshoot issues related to this mod; it generally does not need to be enabled",
"option.ShowFilePath": "Show File Path",
"option.ShowFilePath.description": "Display the mod file path in the information",
"option.SearchInStackTrace": "Enable aggressive search via stack trace lookup",
"option.SearchInStackTrace.description": "Injects into the KeyMapping class constructor and queries the current thread's call stack each time a keybind is registered for aggressive matching",
"tooltip.provided_by": "Provided by: %s",
"tooltip.provider_mod_id": "Provider Mod ID: %s",
"tooltip.key_id": "Keybind ID: %s",
@@ -15,8 +15,6 @@
"option.ShowDebugInfo.description": "这些信息用于出现和本Mod相关的问题时进行排查,一般情况下不需要开启",
"option.ShowFilePath": "是否显示文件路径",
"option.ShowFilePath.description": "在信息中显示Mod的文件路径",
"option.SearchInStackTrace": "是否要通过查询堆栈信息来进行强力搜索",
"option.SearchInStackTrace.description": "注入KeyMapping类的构造函数,在每次注册按键绑定时查询线程的调用栈信息来进行强力匹配",
"tooltip.provided_by": "提供者:%s",
"tooltip.provider_mod_id": "提供者ID%s",
"tooltip.key_id": "键位ID%s",