aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-21 00:24:33 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-21 00:24:53 +0200
commit43575ec3781bc617975f853df85294575875cfab (patch)
treed48742b9f8ffc883a79c26789763483293a94f0d /src/main/java/at/hannibal2/skyhanni/utils
parent5ecf7f0e14f148f5c14952d98969f4033060bb88 (diff)
downloadskyhanni-43575ec3781bc617975f853df85294575875cfab.tar.gz
skyhanni-43575ec3781bc617975f853df85294575875cfab.tar.bz2
skyhanni-43575ec3781bc617975f853df85294575875cfab.zip
Control + click in composter overlay opens bazaar search and copies required amount to clipboard.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index c84710fe0..526d2a3c7 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -15,6 +15,7 @@ import net.minecraft.entity.SharedMonsterAttributes
import net.minecraft.event.ClickEvent
import net.minecraft.event.HoverEvent
import net.minecraft.util.ChatComponentText
+import org.lwjgl.input.Keyboard
import java.text.DecimalFormat
import java.text.NumberFormat
import java.text.SimpleDateFormat
@@ -224,4 +225,17 @@ object LorenzUtils {
return this
}
+ private var lastCommandSent = 0L
+
+ fun sendCommandToServer(command: String) {
+ if (System.currentTimeMillis() > lastCommandSent + 2_000) {
+ lastCommandSent = System.currentTimeMillis()
+ val thePlayer = Minecraft.getMinecraft().thePlayer
+ thePlayer.sendChatMessage("/$command")
+ }
+ }
+
+ fun isShiftKeyDown() = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)
+
+ fun isControlKeyDown() = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)
} \ No newline at end of file