Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: instant click-gui #4505

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: cache option
  • Loading branch information
1zun4 committed Nov 15, 2024
commit e771167aac12c843d11e9e6964ac42761540f153
Original file line number Diff line number Diff line change
@@ -49,6 +49,14 @@ object ModuleClickGui :
EventManager.callEvent(ClickGuiScaleChangeEvent(it))
}

private val cache by boolean("Cache", true).onChanged { cache ->
if (cache) {
createView()
} else {
closeView()
}
}

@Suppress("UnusedPrivateProperty")
private val searchBarAutoFocus by boolean("SearchBarAutoFocus", true)

@@ -73,11 +81,26 @@ object ModuleClickGui :
priority = EventPriorityConvention.OBJECTION_AGAINST_EVERYTHING,
ignoreCondition = true
) {
if (cache) {
createView()
}
}

private fun createView() {
if (clickGuiTab != null) {
return
}

clickGuiTab = ThemeManager.openInputAwareImmediate(VirtualScreenType.CLICK_GUI, true) {
mc.currentScreen is ClickScreen
}.preferOnTop()
}

private fun closeView() {
clickGuiTab?.closeTab()
clickGuiTab = null
}

@Suppress("unused")
private val gameRenderHandler = handler<GameRenderEvent>(
priority = EventPriorityConvention.OBJECTION_AGAINST_EVERYTHING,
Loading