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

feat(inventory-move): timer option #5307

Merged
merged 4 commits into from
Jan 24, 2025
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ import net.ccbluex.liquidbounce.features.module.Category
import net.ccbluex.liquidbounce.features.module.ClientModule
import net.ccbluex.liquidbounce.features.module.modules.movement.ModuleInventoryMove.Behaviour.NORMAL
import net.ccbluex.liquidbounce.features.module.modules.movement.ModuleInventoryMove.Behaviour.SAFE
import net.ccbluex.liquidbounce.utils.client.Chronometer
import net.ccbluex.liquidbounce.utils.client.PacketQueueManager
import net.ccbluex.liquidbounce.utils.client.formatAsTime
import net.ccbluex.liquidbounce.utils.client.notification
import net.ccbluex.liquidbounce.utils.client.*
import net.ccbluex.liquidbounce.utils.inventory.InventoryManager.isInventoryOpenServerSide
import net.ccbluex.liquidbounce.utils.inventory.closeInventorySilently
import net.ccbluex.liquidbounce.utils.inventory.isInInventoryScreen
import net.ccbluex.liquidbounce.utils.kotlin.Priority
import net.minecraft.client.gui.screen.ChatScreen
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen
import net.minecraft.client.gui.screen.ingame.HandledScreen
Expand Down Expand Up @@ -69,7 +67,20 @@ object ModuleInventoryMove : ClientModule("InventoryMove", Category.MOVEMENT) {
val cancelClicks
get() = behavior == SAFE && movementKeys.any { (key, pressed) -> pressed && shouldHandleInputs(key) }

object Blink : ToggleableConfigurable(this,"Blink", false) {
private object TimerFeature : ToggleableConfigurable(this, "Timer", false) {

private val speed by float("Speed", 1.0f, 0.1f..2.0f)

@Suppress("unused")
private val tickHandler = tickHandler {
if (mc.currentScreen is HandledScreen<*>) {
Timer.requestTimerSpeed(speed, Priority.IMPORTANT_FOR_USAGE_2, ModuleInventoryMove)
}
}

}

private object BlinkFeature : ToggleableConfigurable(this,"Blink", false) {

/**
* After reaching this time, we will close the inventory and blink.
Expand Down Expand Up @@ -115,7 +126,8 @@ object ModuleInventoryMove : ClientModule("InventoryMove", Category.MOVEMENT) {
}

init {
tree(Blink)
tree(TimerFeature)
tree(BlinkFeature)
}

fun shouldHandleInputs(keyBinding: KeyBinding): Boolean {
Expand Down
Loading