aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-16 00:25:42 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-16 00:25:42 +0200
commit26c9ff13df1a7e0a6508d11c98ff994cdc1d8902 (patch)
treef729af2dcba9b58baaed51b574b05209deed52f6
parent2c36de4e212b59a2feca2e1b4c9727d6ed9aea0f (diff)
downloadskyhanni-26c9ff13df1a7e0a6508d11c98ff994cdc1d8902.tar.gz
skyhanni-26c9ff13df1a7e0a6508d11c98ff994cdc1d8902.tar.bz2
skyhanni-26c9ff13df1a7e0a6508d11c98ff994cdc1d8902.zip
Added Fishing Hook Display
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/core/config/Position.java8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt70
6 files changed, 110 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 790cf2a6a..8343a2a48 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -269,6 +269,7 @@ class SkyHanniMod {
loadModule(CompactBingoChat())
loadModule(BrewingStandOverlay())
loadModule(FishingTimer())
+ loadModule(FishingHookDisplay())
loadModule(CrimsonIsleReputationHelper(this))
loadModule(SharkFishCounter())
loadModule(SkyBlockLevelGuideHelper())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/Position.java b/src/main/java/at/hannibal2/skyhanni/config/core/config/Position.java
index 232faba8b..329bcd028 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/core/config/Position.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/Position.java
@@ -44,6 +44,14 @@ public class Position {
this(x, y, false, false);
}
+ public Position(int x, int y, float scale) {
+ this.x = x;
+ this.y = y;
+ this.centerX = false;
+ this.centerY = true;
+ this.scale = scale;
+ }
+
public Position(int x, int y, boolean centerX, boolean centerY) {
this.x = x;
this.y = y;
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
index 8dff4260b..d69fbeeae 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
@@ -25,6 +25,7 @@ import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize
import at.hannibal2.skyhanni.data.OtherInventoryData
import at.hannibal2.skyhanni.utils.GuiRenderUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.round
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.gui.ScaledResolution
@@ -86,7 +87,7 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde
}
val pos = positions[displayPos]
- val location = "§7x: §e${pos.rawX}§7, y: §e${pos.rawY}"
+ val location = "§7x: §e${pos.rawX}§7, y: §e${pos.rawY}§7, scale: §e${pos.scale.round(2)}"
GuiRenderUtils.drawStringCentered("§b" + pos.internalName, getScaledWidth() / 2, 18)
GuiRenderUtils.drawStringCentered(location, getScaledWidth() / 2, 28)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
index 32ed45386..50e60191a 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
@@ -200,6 +200,28 @@ public class FishingConfig {
}
@Expose
+ @ConfigOption(name = "Fishing Hook Display", desc = "")
+ @Accordion
+ public FishingHookDisplay fishingHookDisplay = new FishingHookDisplay();
+
+ public static class FishingHookDisplay {
+
+ @Expose
+ @ConfigOption(name = "Enabled", desc = "Display the hypixel timer until the fishing hook can be pulled out of the water, only bigger and on your screen.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean enabled = true;
+
+ @Expose
+ @ConfigOption(name = "Hide Armor Stand", desc = "Hide the original armor stand from hypixel when the Skyhanni display is enabled.")
+ @ConfigEditorBoolean
+ public boolean hideArmorStand = true;
+
+ @Expose
+ public Position position = new Position(460, -240, 3.4f);
+ }
+
+ @Expose
@ConfigOption(name = "Highlight Rare", desc = "Highlight rare sea creatures in blue color.")
@ConfigEditorBoolean
@FeatureToggle
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
new file mode 100644
index 000000000..973d7ac1e
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
@@ -0,0 +1,7 @@
+package at.hannibal2.skyhanni.features.fishing
+
+import at.hannibal2.skyhanni.utils.InventoryUtils
+
+object FishingAPI {
+ fun hasFishingRodInHand() = InventoryUtils.itemInHandId.toString().contains("ROD")
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
new file mode 100644
index 000000000..b91d74f26
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
@@ -0,0 +1,70 @@
+package at.hannibal2.skyhanni.features.fishing
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.utils.EntityUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.getLorenzVec
+import net.minecraft.client.entity.EntityPlayerSP
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.entity.item.EntityXPOrb
+import net.minecraft.entity.projectile.EntityFishHook
+import net.minecraftforge.event.entity.EntityJoinWorldEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class FishingHookDisplay {
+ private val config get() = SkyHanniMod.feature.fishing.fishingHookDisplay
+ private var bobberLocation: LorenzVec? = null
+ private var armorStand: EntityArmorStand? = null
+ private var display = ""
+
+ @SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ if (!isEnabled()) return
+ if (!event.repeatSeconds(1)) return
+
+ val entities = EntityUtils.getEntities<EntityFishHook>()
+ bobberLocation = entities.firstOrNull { it.angler is EntityPlayerSP }?.getLorenzVec()
+ }
+
+ @SubscribeEvent
+ fun onJoinWorld(event: EntityJoinWorldEvent) {
+ if (!isEnabled()) return
+ val entity = event.entity ?: return
+ if (entity is EntityXPOrb) return
+ val bobberLocation = bobberLocation ?: return
+
+ val distance = entity.getLorenzVec().distance(bobberLocation)
+ if (distance > 0.1) return
+ if (entity is EntityArmorStand) {
+ armorStand = entity
+ }
+ }
+
+ @SubscribeEvent
+ fun onCheckRender(event: CheckRenderEntityEvent<*>) {
+ if (!isEnabled()) return
+ if (!config.hideArmorStand) return
+
+ if (event.entity == armorStand) {
+ event.isCanceled = true
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) {
+ if (!isEnabled()) return
+
+ val armorStand = armorStand ?: return
+ if (armorStand.isDead) return
+ if (!armorStand.hasCustomName()) return
+
+ config.position.renderString(armorStand.name, posLabel = "Fishing Hook Display")
+ }
+
+ fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && FishingAPI.hasFishingRodInHand()
+}