aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorAzure <156628929+azurejelly@users.noreply.github.com>2024-05-26 10:06:36 -0400
committerGitHub <noreply@github.com>2024-05-26 16:06:36 +0200
commit92fea8e9e211118937905dc56fff9b5faafdef23 (patch)
treea24f1f2dd1b69b5764435847c8cc9a7a35e8d12d /src/main/java/at/hannibal2/skyhanni/features
parentbbf8a530599f84923167ceeab195a39205fa5131 (diff)
downloadskyhanni-92fea8e9e211118937905dc56fff9b5faafdef23.tar.gz
skyhanni-92fea8e9e211118937905dc56fff9b5faafdef23.tar.bz2
skyhanni-92fea8e9e211118937905dc56fff9b5faafdef23.zip
Feature: Line to Arachne (#1888)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt
index 9303fc45e..d5cc0ed9e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/MobHighlight.kt
@@ -3,14 +3,20 @@ package at.hannibal2.skyhanni.features.combat.mobs
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
import at.hannibal2.skyhanni.events.EntityMaxHealthUpdateEvent
+import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
+import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
import at.hannibal2.skyhanni.utils.ColorUtils.withAlpha
import at.hannibal2.skyhanni.utils.EntityUtils.getBlockInHand
import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith
+import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import at.hannibal2.skyhanni.utils.LorenzUtils.ignoreDerpy
+import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
+import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
+import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.monster.EntityCaveSpider
@@ -22,6 +28,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class MobHighlight {
private val config get() = SkyHanniMod.feature.combat.mobs
+ private var arachne: EntityLivingBase? = null
@SubscribeEvent
fun onEntityHealthUpdate(event: EntityHealthUpdateEvent) {
@@ -95,12 +102,40 @@ class MobHighlight {
}
}
- if (config.arachneBossHighlighter && entity is EntitySpider) {
+ if (entity is EntitySpider) {
checkArachne(entity)
}
}
+ @SubscribeEvent
+ fun onWorldRender(event: LorenzRenderWorldEvent) {
+ if (!LorenzUtils.inSkyBlock || !config.lineToArachne) return
+
+ val arachne = arachne ?: return
+ if (arachne.isDead || arachne.health <= 0) {
+ this.arachne = null
+ return
+ }
+
+ if (arachne.distanceToPlayer() > 10) return
+
+ event.draw3DLine(
+ event.exactPlayerEyeLocation(),
+ arachne.getLorenzVec().add(y = 1),
+ LorenzColor.RED.toColor(),
+ 5,
+ true
+ )
+ }
+
+ @SubscribeEvent
+ fun onWorldChange(event: LorenzWorldChangeEvent) {
+ arachne = null
+ }
+
private fun checkArachne(entity: EntitySpider) {
+ if (!config.arachneBossHighlighter && !config.lineToArachne) return
+
if (!entity.hasNameTagWith(1, "[§7Lv300§8] §cArachne") &&
!entity.hasNameTagWith(1, "[§7Lv300§8] §lArachne") &&
!entity.hasNameTagWith(1, "[§7Lv500§8] §cArachne") &&
@@ -110,6 +145,7 @@ class MobHighlight {
if (entity is EntityCaveSpider) {
markArachneMinis(entity)
} else if (entity.baseMaxHealth == 20_000 || entity.baseMaxHealth == 100_000) {
+ this.arachne = entity
markArachne(entity)
}
}