aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/features/dungeon/ShortbowClicker.kt
diff options
context:
space:
mode:
authorAppability <appable@icloud.com>2022-10-12 20:48:51 -0700
committerAppability <appable@icloud.com>2022-10-12 20:48:51 -0700
commitc599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8 (patch)
treef362a5f60f31e27f1567c7319a78d861b19430a7 /src/main/kotlin/com/ambientaddons/features/dungeon/ShortbowClicker.kt
parent03728b81851af00cd265fadd4ce6eaa3a8066dcb (diff)
downloadAmbientAddons-c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8.tar.gz
AmbientAddons-c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8.tar.bz2
AmbientAddons-c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8.zip
uh a lot of things
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/features/dungeon/ShortbowClicker.kt')
-rw-r--r--src/main/kotlin/com/ambientaddons/features/dungeon/ShortbowClicker.kt32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/features/dungeon/ShortbowClicker.kt b/src/main/kotlin/com/ambientaddons/features/dungeon/ShortbowClicker.kt
new file mode 100644
index 0000000..9ff5d48
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/features/dungeon/ShortbowClicker.kt
@@ -0,0 +1,32 @@
+package com.ambientaddons.features.dungeon
+
+import AmbientAddons.Companion.config
+import AmbientAddons.Companion.mc
+import com.ambientaddons.utils.Extensions.skyblockID
+import com.ambientaddons.utils.SkyBlock
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.math.roundToLong
+
+// credit Floppa
+object ShortbowClicker {
+ private var lastClickTime = System.currentTimeMillis()
+ private val shortbows = listOf("TERMINATOR", "JUJU_SHORTBOW", "ITEM_SPIRIT_BOW")
+
+ @SubscribeEvent
+ fun onRender(event: RenderWorldLastEvent) {
+ if (!SkyBlock.inSkyblock) return
+ if (config.terminatorCps == 0) return
+ if (!mc.gameSettings.keyBindUseItem.isKeyDown) return
+ val itemStack = mc.thePlayer?.inventory?.getCurrentItem()
+ if (itemStack?.skyblockID?.let { shortbows.contains(it) } != true) return
+ val delay = (1000.0 / config.terminatorCps).roundToLong()
+ val currentTime = System.currentTimeMillis()
+ if ((currentTime - lastClickTime) >= delay) {
+ lastClickTime = currentTime - (currentTime - lastClickTime) % delay
+ if (mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, itemStack)) {
+ mc.entityRenderer.itemRenderer.resetEquippedProgress2()
+ }
+ }
+ }
+} \ No newline at end of file