From 43575ec3781bc617975f853df85294575875cfab Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 21 Apr 2023 00:24:33 +0200 Subject: Control + click in composter overlay opens bazaar search and copies required amount to clipboard. --- src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') 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 -- cgit