Skip to content

Commit

Permalink
Fixed AutoClicker not clicking properly due to minecraft being weird
Browse files Browse the repository at this point in the history
Changed CratePriority logic
  • Loading branch information
odtheking committed Oct 24, 2024
1 parent b71023b commit 7587d35
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import me.odinclient.utils.skyblock.PlayerUtils.rightClick
import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.impl.BooleanSetting
import me.odinmain.features.settings.impl.KeybindSetting
import me.odinmain.features.settings.impl.NumberSetting
import me.odinmain.utils.skyblock.isHolding
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import org.lwjgl.input.Keyboard

object AutoClicker : Module(
name = "Auto Clicker",
Expand All @@ -20,6 +22,8 @@ object AutoClicker : Module(
private val leftCps by NumberSetting("Left Clicks Per Second", 5.0, 3.0, 15.0, .5, false, description = "The amount of left clicks per second to perform.")
private val rightCps by NumberSetting("Right Clicks Per Second", 5.0, 3.0, 15.0, .5, false, description = "The amount of right clicks per second to perform.")
private val terminatorOnly by BooleanSetting("Terminator Only", false, description = "Only click when the terminator is enabled.")
private val leftClickKeybind by KeybindSetting("Left Click", Keyboard.KEY_NONE, description = "The keybind to hold for the auto clicker to click left click.")
private val rightClickKeybind by KeybindSetting("Right Click", Keyboard.KEY_NONE, description = "The keybind to hold for the auto clicker to click right click.")

private var nextLeftClick = .0
private var nextRightClick = .0
Expand All @@ -29,12 +33,12 @@ object AutoClicker : Module(
val nowMillis = System.currentTimeMillis()
if (terminatorOnly && !isHolding("TERMINATOR")) return

if (enableLeftClick && mc.gameSettings.keyBindAttack.isKeyDown && nowMillis >= nextLeftClick) {
if (enableLeftClick && leftClickKeybind.isDown() && nowMillis >= nextLeftClick) {
nextLeftClick = nowMillis + ((1000 / leftCps) + ((Math.random() - .5) * 60.0))
leftClick()
}

if (enableRightClick && mc.gameSettings.keyBindUseItem.isKeyDown && nowMillis >= nextRightClick) {
if (enableRightClick && rightClickKeybind.isDown() && nowMillis >= nextRightClick) {
nextRightClick = nowMillis + ((1000 / rightCps) + ((Math.random() - .5) * 60.0))
rightClick()
}
Expand Down
67 changes: 45 additions & 22 deletions odinmain/src/main/kotlin/me/odinmain/features/impl/nether/NoPre.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,40 +78,63 @@ object NoPre : Module(
fun cratePriority(): String {
return when {
// Shop Missing
missing == PreSpot.Shop && (preSpot == PreSpot.Triangle || preSpot == PreSpot.X) -> "Go X Cannon"
missing == PreSpot.Shop && (preSpot == PreSpot.Equals || preSpot == PreSpot.Slash) -> "Go Square"
missing == PreSpot.Shop -> when (preSpot) {
PreSpot.Triangle, PreSpot.X -> "Go X Cannon"
PreSpot.Equals -> if (advanced) "Go X Cannon" else "Go Shop"
PreSpot.Slash -> "Go Square"
else -> ""
}

// Triangle Missing
missing == PreSpot.Triangle && preSpot == PreSpot.Triangle -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
missing == PreSpot.Triangle && preSpot == PreSpot.X -> "Go X Cannon"
missing == PreSpot.Triangle && preSpot == PreSpot.Equals -> if (advanced) "Go Shop" else "Go X Cannon"
missing == PreSpot.Triangle && preSpot == PreSpot.Slash -> "Go Square"
missing == PreSpot.Triangle -> when (preSpot) {
PreSpot.Triangle -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
PreSpot.X, PreSpot.Equals -> "Go X Cannon"
PreSpot.Slash -> "Go Square, place on Triangle"
else -> ""
}

// Equals Missing
missing == PreSpot.Equals && preSpot == PreSpot.Triangle -> if (advanced) "Go Shop" else "Go X Cannon"
missing == PreSpot.Equals && preSpot == PreSpot.X -> "Go X Cannon"
missing == PreSpot.Equals && preSpot == PreSpot.Equals -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
missing == PreSpot.Equals && preSpot == PreSpot.Slash -> "Go Square"
missing == PreSpot.Equals -> when (preSpot) {
PreSpot.Triangle -> if (advanced) "Go Shop" else "Go X Cannon"
PreSpot.X -> "Go X Cannon"
PreSpot.Equals -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
PreSpot.Slash -> "Go Square, place on Equals"
else -> ""
}

// Slash Missing
missing == PreSpot.Slash && preSpot == PreSpot.Triangle -> "Go Square"
missing == PreSpot.Slash && preSpot == PreSpot.X -> "Go X Cannon"
missing == PreSpot.Slash && preSpot == PreSpot.Equals -> if (advanced) "Go Shop" else "Go X Cannon"
missing == PreSpot.Slash && preSpot == PreSpot.Slash -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
missing == PreSpot.Slash -> when (preSpot) {
PreSpot.Triangle -> "Go Square, place on Triangle"
PreSpot.X -> "Go X Cannon"
PreSpot.Equals -> "Go Square, place on Equals"
PreSpot.Slash -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
else -> ""
}

// Square Missing
missing == PreSpot.Square && (preSpot == PreSpot.Triangle || preSpot == PreSpot.Equals) -> "Go Shop"
missing == PreSpot.Square && (preSpot == PreSpot.X || preSpot == PreSpot.Slash) -> "Go X Cannon"
missing == PreSpot.Square -> when (preSpot) {
PreSpot.Triangle, PreSpot.Equals -> "Go Shop"
PreSpot.X -> "Go X Cannon"
PreSpot.Slash -> "Go X Cannon"
else -> ""
}

// X Cannon Missing
missing == PreSpot.xCannon && (preSpot == PreSpot.Triangle || preSpot == PreSpot.Equals) -> "Go Shop"
missing == PreSpot.xCannon && (preSpot == PreSpot.X || preSpot == PreSpot.Slash) -> "Go Square"
missing == PreSpot.xCannon -> when (preSpot) {
PreSpot.Triangle, PreSpot.Equals -> "Go Shop"
PreSpot.X -> "Go Square"
PreSpot.Slash -> "Go Square, place on X Cannon"
else -> ""
}

// X Missing
missing == PreSpot.X && preSpot == PreSpot.Triangle -> "Go X Cannon"
missing == PreSpot.X && preSpot == PreSpot.X -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
missing == PreSpot.X && preSpot == PreSpot.Equals -> if (advanced) "Go Shop" else "X Cannon"
missing == PreSpot.X && preSpot == PreSpot.Slash -> "Go Square"
missing == PreSpot.X -> when (preSpot) {
PreSpot.Triangle -> "Go X Cannon"
PreSpot.X -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
PreSpot.Equals -> if (advanced) "Go Shop" else "Go X Cannon"
PreSpot.Slash -> "Go Square, place on X"
else -> ""
}

else -> ""
}
Expand Down

0 comments on commit 7587d35

Please sign in to comment.