aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-02 13:27:16 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-02 13:27:16 +0100
commitbe343281315c8afc10b6d91f75afc94ee001c14d (patch)
tree0315a442eef36b1d7fc391cd3e02c04bd0a5e169 /src/main/java/at/hannibal2/skyhanni
parentd431ec1e4f70a6159aa20a8dd071bc85788b9422 (diff)
downloadskyhanni-be343281315c8afc10b6d91f75afc94ee001c14d.tar.gz
skyhanni-be343281315c8afc10b6d91f75afc94ee001c14d.tar.bz2
skyhanni-be343281315c8afc10b6d91f75afc94ee001c14d.zip
Moved the key setting for diana `warp to nearest burrow waypoint` from vanilla mc (esc -> config -> controls -> scroll all the way down to skyhanni category) to simply `/sh diana`
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Diana.java25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt29
2 files changed, 26 insertions, 28 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Diana.java b/src/main/java/at/hannibal2/skyhanni/config/features/Diana.java
index f783358c1..984cc4165 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Diana.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Diana.java
@@ -1,40 +1,43 @@
package at.hannibal2.skyhanni.config.features;
-import at.hannibal2.skyhanni.config.core.config.annotations.ConfigAccordionId;
-import at.hannibal2.skyhanni.config.core.config.annotations.ConfigEditorAccordion;
import at.hannibal2.skyhanni.config.core.config.annotations.ConfigEditorBoolean;
+import at.hannibal2.skyhanni.config.core.config.annotations.ConfigEditorKeybind;
import at.hannibal2.skyhanni.config.core.config.annotations.ConfigOption;
import com.google.gson.annotations.Expose;
+import org.lwjgl.input.Keyboard;
public class Diana {
@Expose
- @ConfigOption(name = "Griffin Burrows", desc = "")
- @ConfigEditorAccordion(id = 0)
- public boolean griffinBurrows = false;
-
- @Expose
@ConfigOption(name = "Soopy Guess", desc = "Uses §eSoopy's Guess Logic §7to find the next burrow. Does not require SoopyV2 or chat triggers to be installed.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
public boolean burrowsSoopyGuess = false;
@Expose
@ConfigOption(name = "Nearby Detection", desc = "Show burrows near you.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
public boolean burrowsNearbyDetection = false;
@Expose
@ConfigOption(name = "Smooth Transition", desc = "Show the way from one burrow to another smoothly.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
public boolean burrowSmoothTransition = false;
@Expose
+ @ConfigOption(name = "Griffin Burrows", desc = "")
+ public boolean griffinBurrows = false;
+
+ @Expose
@ConfigOption(name = "Nearest Warp", desc = "Warps to the nearest warp point on the hub, if closer to the next burrow.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 0)
public boolean burrowNearestWarp = false;
+ @Expose
+ @ConfigOption(
+ name = "Warp Key",
+ desc = "Press this key to warp to nearest burrow waypoint."
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE)
+ public int keyBindWarp = Keyboard.KEY_NONE;
+
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
index 949b3c4e3..ef1cc5cec 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
@@ -1,42 +1,37 @@
package at.hannibal2.skyhanni.features.event.diana
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import at.hannibal2.skyhanni.utils.LorenzVec
-import at.hannibal2.skyhanni.utils.OSUtils.isActive
import net.minecraft.client.Minecraft
-import net.minecraft.client.settings.KeyBinding
-import net.minecraftforge.fml.client.registry.ClientRegistry
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import net.minecraftforge.fml.common.gameevent.TickEvent
+import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent
import org.lwjgl.input.Keyboard
class BurrowWarpHelper {
- private val keyBinding = KeyBinding(
- "Nearest Burrow Warp",
- Keyboard.KEY_X,
- "SkyHanni"
- )
-
private var lastWarpTime = 0L
private var lastWarp: WarpPoint? = null
- init {
- ClientRegistry.registerKeyBinding(keyBinding)
- }
-
@SubscribeEvent
- fun onClientTick(event: TickEvent.ClientTickEvent) {
- if (keyBinding.isActive()) {
+ fun onKeyBindPressed(event: KeyInputEvent?) {
+ if (!LorenzUtils.inSkyBlock) return
+ if(LorenzUtils.skyBlockIsland != IslandType.HUB) return
+ if (!SkyHanniMod.feature.diana.burrowNearestWarp) return
+
+ if (!Keyboard.getEventKeyState()) return
+ val key = if (Keyboard.getEventKey() == 0) Keyboard.getEventCharacter().code + 256 else Keyboard.getEventKey()
+ if (SkyHanniMod.feature.diana.keyBindWarp == key) {
currentWarp?.let {
if (System.currentTimeMillis() > lastWarpTime + 5_000) {
+ lastWarpTime = System.currentTimeMillis()
val thePlayer = Minecraft.getMinecraft().thePlayer
thePlayer.sendChatMessage("/warp " + currentWarp?.name)
lastWarp = currentWarp
- lastWarpTime = System.currentTimeMillis()
}
}
}