aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/slayer
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt94
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt16
4 files changed, 60 insertions, 62 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt
index 2880d183b..20edbf285 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemsOnGround.kt
@@ -42,7 +42,7 @@ object SlayerItemsOnGround {
if (!isEnabled()) return
for ((item, text) in itemsOnGround) {
- val location = event.exactLocation(item).add(y = 0.8)
+ val location = event.exactLocation(item).up(0.8)
event.drawString(location, text)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt
index 4798a9432..11a335a63 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerMiniBossFeatures.kt
@@ -14,8 +14,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
-import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
+import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.entity.EntityCreature
import net.minecraft.entity.monster.EntityBlaze
@@ -63,12 +62,11 @@ object SlayerMiniBossFeatures {
if (mob.isDead) continue
if (mob.distanceToPlayer() > 10) continue
- event.draw3DLine(
- event.exactPlayerEyeLocation(),
- mob.getLorenzVec().add(y = 1),
+ event.drawLineToEye(
+ mob.getLorenzVec().up(),
LorenzColor.AQUA.toColor(),
config.slayerMinibossLineWidth,
- true
+ true,
)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
index 57aa65e53..df7ab69d9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt
@@ -22,12 +22,14 @@ import at.hannibal2.skyhanni.utils.EntityUtils.getAllNameTagsInRadiusWith
import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
import at.hannibal2.skyhanni.utils.EntityUtils.isNPC
import at.hannibal2.skyhanni.utils.LocationUtils
+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.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
+import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye
import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation
import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
@@ -115,15 +117,17 @@ object VampireSlayerFeatures {
it.name.contains(username)
}
val containCoop = getAllNameTagsInRadiusWith("Spawned by").any {
- coopList.isNotEmpty() && configCoopBoss.highlight && coopList.any { it2 ->
- var contain = false
- if (".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*).*".toRegex().matches(it.name)) {
- val name = ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*)".toRegex()
- .find(it.name)?.groupValues?.get(1)
- contain = it2 == name
+ coopList.isNotEmpty() &&
+ configCoopBoss.highlight &&
+ coopList.any { it2 ->
+ var contain = false
+ if (".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*).*".toRegex().matches(it.name)) {
+ val name = ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*)".toRegex()
+ .find(it.name)?.groupValues?.get(1)
+ contain = it2 == name
+ }
+ contain
}
- contain
- }
}
val shouldSendTitle =
if (containUser && configOwnBoss.twinClawsTitle) true
@@ -146,22 +150,23 @@ object VampireSlayerFeatures {
for (it in getAllNameTagsInRadiusWith("Spawned by")) {
val coopList = configCoopBoss.coopMembers.split(",").toList()
val containUser = it.name.contains(username)
- val containCoop = coopList.isNotEmpty() && coopList.any { it2 ->
- var contain = false
- if (".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*).*".toRegex().matches(it.name)) {
- val name =
- ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*)".toRegex().find(it.name)?.groupValues?.get(1)
- contain = it2 == name
+ val containCoop = coopList.isNotEmpty() &&
+ coopList.any { it2 ->
+ var contain = false
+ if (".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*).*".toRegex().matches(it.name)) {
+ val name =
+ ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*)".toRegex().find(it.name)?.groupValues?.get(1)
+ contain = it2 == name
+ }
+ contain
}
- contain
- }
val neededHealth = baseMaxHealth * 0.2f
- if (containUser && taggedEntityList.contains(this.entityId)) {
- taggedEntityList.remove(this.entityId)
+ if (containUser && taggedEntityList.contains(entityId)) {
+ taggedEntityList.remove(entityId)
}
val canUseSteak = health <= neededHealth
val ownBoss = configOwnBoss.highlight && containUser && isNPC()
- val otherBoss = configOtherBoss.highlight && taggedEntityList.contains(this.entityId) && isNPC()
+ val otherBoss = configOtherBoss.highlight && taggedEntityList.contains(entityId) && isNPC()
val coopBoss = configCoopBoss.highlight && containCoop && isNPC()
val shouldRender = if (ownBoss) true else if (otherBoss) true else coopBoss
@@ -176,7 +181,7 @@ object VampireSlayerFeatures {
val shouldSendSteakTitle =
if (canUseSteak && configOwnBoss.steakAlert && containUser) true
- else if (canUseSteak && configOtherBoss.steakAlert && taggedEntityList.contains(this.entityId)) true
+ else if (canUseSteak && configOtherBoss.steakAlert && taggedEntityList.contains(entityId)) true
else canUseSteak && configCoopBoss.steakAlert && containCoop
if (shouldSendSteakTitle) {
@@ -191,7 +196,7 @@ object VampireSlayerFeatures {
}
private fun EntityOtherPlayerMP.isHighlighted(): Boolean {
- return entityList.contains(this) || taggedEntityList.contains(this.entityId)
+ return entityList.contains(this) || taggedEntityList.contains(entityId)
}
private fun String.color(): Int {
@@ -208,14 +213,15 @@ object VampireSlayerFeatures {
val regexA = ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*).*".toRegex()
val regexB = ".*§(?:\\d|\\w)+Spawned by: §(?:\\d|\\w)(\\w*)".toRegex()
for (armorStand in event.clickedEntity.getAllNameTagsInRadiusWith("Spawned by")) {
- val containCoop = coopList.isNotEmpty() && coopList.any { it2 ->
- var contain = false
- if (regexA.matches(armorStand.name)) {
- val name = regexB.find(armorStand.name)?.groupValues?.get(1)
- contain = it2 == name
+ val containCoop = coopList.isNotEmpty() &&
+ coopList.any {
+ var contain = false
+ if (regexA.matches(armorStand.name)) {
+ val name = regexB.find(armorStand.name)?.groupValues?.get(1)
+ contain = it == name
+ }
+ contain
}
- contain
- }
if (armorStand.name.contains(username) || containCoop) return
if (!taggedEntityList.contains(event.clickedEntity.entityId)) {
taggedEntityList.add(event.clickedEntity.entityId)
@@ -256,27 +262,25 @@ object VampireSlayerFeatures {
@SubscribeEvent
fun onWorldRender(event: LorenzRenderWorldEvent) {
if (!isEnabled()) return
- val start = LocationUtils.playerLocation()
if (config.drawLine) {
for (it in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityOtherPlayerMP>()) {
if (!it.isHighlighted()) continue
val vec = event.exactLocation(it)
- val distance = start.distance(vec)
- if (distance > 15) continue
- event.draw3DLine(
- event.exactPlayerEyeLocation(),
- vec.add(y = 1.54),
- config.lineColor.toChromaColor(),
- config.lineWidth,
- true
- )
+ if (vec.distanceToPlayer() < 15) {
+ event.drawLineToEye(
+ vec.up(1.54),
+ config.lineColor.toChromaColor(),
+ config.lineWidth,
+ true,
+ )
+ }
}
}
if (!configBloodIchor.highlight && !configKillerSpring.highlight) return
for (stand in Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityArmorStand>()) {
val vec = stand.position.toLorenzVec()
- val distance = start.distance(vec)
+ val distance = vec.distanceToPlayer()
val isIchor = stand.hasSkullTexture(BLOOD_ICHOR_TEXTURE)
val isSpring = stand.hasSkullTexture(KILLER_SPRING_TEXTURE)
if (!(isIchor && config.bloodIchor.highlight) && !(isSpring && config.killerSpring.highlight)) continue
@@ -292,9 +296,9 @@ object VampireSlayerFeatures {
(if (isIchor) configBloodIchor.linesColor else configKillerSpring.linesColor).toChromaColor()
val text = if (isIchor) "§4Ichor" else "§4Spring"
event.drawColor(
- stand.position.toLorenzVec().add(y = 2.0),
+ stand.position.toLorenzVec().up(2.0),
LorenzColor.DARK_RED,
- alpha = 1f
+ alpha = 1f,
)
event.drawDynamicText(
stand.position.toLorenzVec().add(0.5, 2.5, 0.5),
@@ -305,13 +309,13 @@ object VampireSlayerFeatures {
for ((player, stand2) in standList) {
if ((configBloodIchor.showLines && isIchor) || (configKillerSpring.showLines && isSpring))
event.draw3DLine(
- event.exactLocation(player).add(y = 1.5),
- event.exactLocation(stand2).add(y = 1.5),
- // stand2.position.toLorenzVec().add(0.0, 1.5, 0.0),
+ event.exactPlayerEyeLocation(player),
+ event.exactPlayerEyeLocation(stand2),
linesColorStart,
3,
- true
+ true,
)
+
}
}
if (configBloodIchor.renderBeam && isIchor && stand.isEntityAlive) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
index dd63fdd96..684d06cd4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
@@ -24,12 +24,11 @@ import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzVec
-import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
+import at.hannibal2.skyhanni.utils.RenderUtils.drawLineToEye
import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation
-import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.TimeUtils.format
import at.hannibal2.skyhanni.utils.getLorenzVec
@@ -135,12 +134,11 @@ object EndermanSlayerFeatures {
val skullLocation = event.exactLocation(skull)
if (skullLocation.distanceToPlayer() > 20) continue
if (!skullLocation.canBeSeen()) continue
- event.draw3DLine(
- event.exactPlayerEyeLocation(),
- skullLocation.add(y = 1),
+ event.drawLineToEye(
+ skullLocation.up(),
LorenzColor.GOLD.toColor(),
3,
- true,
+ true
)
}
}
@@ -156,8 +154,7 @@ object EndermanSlayerFeatures {
if (beaconConfig.showLine) {
val beaconLocation = event.exactLocation(beacon)
- event.draw3DLine(
- event.exactPlayerEyeLocation(),
+ event.drawLineToEye(
beaconLocation.add(0.5, 1.0, 0.5),
beaconConfig.lineColor.toChromaColor(),
beaconConfig.lineWidth,
@@ -171,8 +168,7 @@ object EndermanSlayerFeatures {
for ((location, time) in sittingBeacon) {
if (location.distanceToPlayer() > 20) continue
if (beaconConfig.showLine) {
- event.draw3DLine(
- event.exactPlayerEyeLocation(),
+ event.drawLineToEye(
location.add(0.5, 1.0, 0.5),
beaconConfig.lineColor.toChromaColor(),
beaconConfig.lineWidth,