aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-16 11:31:21 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-16 11:31:21 +0200
commit5db60e5167bf8f172f0aae41a4ee21c0c86705e3 (patch)
treec72c40648a00cef4e818cfcf5a34ec2ff5a90f3d /src/main
parent5ebcfe5b19f7bc30c730c69aa4a44c2168218863 (diff)
downloadskyhanni-5db60e5167bf8f172f0aae41a4ee21c0c86705e3.tar.gz
skyhanni-5db60e5167bf8f172f0aae41a4ee21c0c86705e3.tar.bz2
skyhanni-5db60e5167bf8f172f0aae41a4ee21c0c86705e3.zip
Fishing hook display no longer calculates distance, removed debug values, and added support for multiple timers without recasting the bobber.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt37
2 files changed, 16 insertions, 46 deletions
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 edca0b432..b161f356a 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
@@ -229,31 +229,6 @@ public class FishingConfig {
@Expose
public Position position = new Position(460, -240, 3.4f);
-
- @Expose
- @ConfigOption(
- name = "Debug: Update Interval",
- desc = "Changes the time in ticks between updates (should be as high as possible). Default is 20"
- )
- @ConfigEditorSlider(
- minValue = 1,
- maxValue = 80,
- minStep = 1
- )
- public int debugUpdateInterval = 20;
-
- @Expose
- @ConfigOption(
- name = "Debug: Distance",
- desc = "Changes the maximal detection distance between the fishing rod bobber and " +
- "the armor stand that shows the hypixel timer (should be as low as possible). Default is 0.1"
- )
- @ConfigEditorSlider(
- minValue = 0.01f,
- maxValue = 5f,
- minStep = 0.01f
- )
- public double debugMaxDistance = 0.1;
}
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
index 30a55a0ea..3f10944d3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
@@ -7,9 +7,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
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.projectile.EntityFishHook
@@ -19,15 +17,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class FishingHookDisplay {
private val config get() = SkyHanniMod.feature.fishing.fishingHookDisplay
private var bobber: EntityFishHook? = null
- private var bobberLocation: LorenzVec? = null
private var armorStand: EntityArmorStand? = null
private val potentionArmorStands = mutableListOf<EntityArmorStand>()
- private var display = ""
@SubscribeEvent
fun onWorldChange(event: LorenzWorldChangeEvent) {
- display = ""
- bobberLocation = null
bobber = null
armorStand = null
potentionArmorStands.clear()
@@ -36,7 +30,6 @@ class FishingHookDisplay {
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
if (!isEnabled()) return
- if (!event.isMod(config.debugUpdateInterval)) return
if (armorStand == null) {
val filter = potentionArmorStands.filter { it.hasCustomName() && it.hasCorrectName() }
@@ -45,17 +38,20 @@ class FishingHookDisplay {
}
}
- val entities = EntityUtils.getEntities<EntityFishHook>()
- val foundBobber = entities.firstOrNull { it.angler is EntityPlayerSP }
- if (foundBobber != bobber) {
- bobber = foundBobber
- potentionArmorStands.clear()
- armorStand = null
+ if (event.isMod(5)) {
+ val entities = EntityUtils.getEntities<EntityFishHook>()
+ val foundBobber = entities.firstOrNull { it.angler is EntityPlayerSP }
+ if (foundBobber != bobber) {
+ bobber = foundBobber
+ reset()
+ }
}
- if (bobber != null) {
- bobberLocation = bobber?.getLorenzVec()
- }
+ }
+
+ private fun reset() {
+ potentionArmorStands.clear()
+ armorStand = null
}
@SubscribeEvent
@@ -63,10 +59,6 @@ class FishingHookDisplay {
if (!isEnabled()) return
val entity = event.entity ?: return
if (entity !is EntityArmorStand) return
- val bobberLocation = bobberLocation ?: return
-
- val distance = entity.getLorenzVec().distance(bobberLocation)
- if (distance > config.debugMaxDistance) return
potentionArmorStands.add(entity)
}
@@ -86,7 +78,10 @@ class FishingHookDisplay {
if (!isEnabled()) return
val armorStand = armorStand ?: return
- if (armorStand.isDead) return
+ if (armorStand.isDead) {
+ reset()
+ return
+ }
if (!armorStand.hasCustomName()) return
config.position.renderString(armorStand.name, posLabel = "Fishing Hook Display")