aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-29 19:36:01 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-29 19:36:01 +0200
commit7c4744d520ba965f3bd937f4511a6873d69701c6 (patch)
tree8e3b5e63f76a497e8ab5c5807f3498572cf98175 /src/main/java
parentf94ed94adc7bb33d5a766e782f06a3ffc5730c78 (diff)
downloadskyhanni-7c4744d520ba965f3bd937f4511a6873d69701c6.tar.gz
skyhanni-7c4744d520ba965f3bd937f4511a6873d69701c6.tar.bz2
skyhanni-7c4744d520ba965f3bd937f4511a6873d69701c6.zip
right dagger overlay
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java50
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt102
2 files changed, 117 insertions, 35 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
index a108e6c8c..4e1884f00 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java
@@ -29,36 +29,60 @@ public class Slayer {
public boolean blaze = false;
@Expose
- @ConfigOption(name = "Pillar Display", desc = "Cooldown when the Fire Pillar from the Blaze Slayer will kill you.")
+ @ConfigOption(name = "Hellion Shields", desc = "")
+ @ConfigEditorAccordion(id = 2)
+ @ConfigAccordionId(id = 1)
+ public boolean blazeHellion = false;
+
+ @Expose
+ @ConfigOption(name = "Colored Mobs", desc = "Color the blaze slayer boss and the demons in the right hellion shield color.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean blazeColoredMobs = false;
+
+ @Expose
+ @ConfigOption(name = "Blaze Daggers", desc = "Faster and permanent display for the Blaze Slayer daggers.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean blazeDaggers = false;
+
+ @Expose
+ @ConfigOption(name = "Right Dagger", desc = "Mark the right dagger to use for blaze slayer in the dagger overlay.")
@ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean blazeMarkRightHellionShield = false;
+
+ @Expose
+ @ConfigOption(name = "Fire Pillars", desc = "")
+ @ConfigEditorAccordion(id = 3)
@ConfigAccordionId(id = 1)
+ public boolean blazePillars = false;
+
+ @Expose
+ @ConfigOption(name = "Pillar Display", desc = "Cooldown when the Fire Pillar from the Blaze Slayer will kill you.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
public boolean firePillarDisplay = false;
@Expose
@ConfigOption(name = "Pillar Display Position", desc = "")
@ConfigEditorButton(runnableId = "firePillar", buttonText = "Edit")
- @ConfigAccordionId(id = 1)
+ @ConfigAccordionId(id = 3)
public Position firePillarPos = new Position(10, 10, false, true);
@Expose
@ConfigOption(name = "Pillar Sound", desc = "Custom countdown sound for the Fire Pillar timer for the Blaze Slayer.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 1)
+ @ConfigAccordionId(id = 3)
public boolean firePillarSound = false;
@Expose
@ConfigOption(name = "Hide Pillar", desc = "Hide sound and entities when building the Fire Pillar for the Blaze Slayer.")
@ConfigEditorBoolean
- @ConfigAccordionId(id = 1)
+ @ConfigAccordionId(id = 3)
public boolean firePillarBuildHider = false;
@Expose
- @ConfigOption(name = "Blaze Daggers", desc = "Faster and permanent display for the Blaze Slayer daggers.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 1)
- public boolean blazeDaggers = false;
-
- @Expose
@ConfigOption(name = "Fire Pits", desc = "Warning when the fire pit phase starts for the Blaze Slayer tier 3 and 4.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
@@ -71,12 +95,6 @@ public class Slayer {
public boolean blazePhaseDisplay = false;
@Expose
- @ConfigOption(name = "Colored Mobs", desc = "Color the blaze slayer boss and the demons in the right hellion shield color.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 1)
- public boolean blazeColoredMobs = false;
-
- @Expose
@ConfigOption(name = "Miniboss Highlight", desc = "Highlight slayer miniboss in blue color")
@ConfigEditorBoolean
public boolean slayerMinibossHighlight = false;
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
index bcdbbc8e2..a16d85a00 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
@@ -5,8 +5,10 @@ import at.hannibal2.skyhanni.config.core.util.render.TextRenderUtils
import at.hannibal2.skyhanni.events.ItemClickInHandEvent
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision
+import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.ScaledResolution
import net.minecraft.client.renderer.GlStateManager
@@ -19,13 +21,15 @@ import org.lwjgl.input.Keyboard
class BlazeSlayerDaggerHelper {
- var clientSideClicked = false
- var textTopLeft = ""
- var textTopRight = ""
- var textBottomLeft = ""
- var textBottomRight = ""
+ private var clientSideClicked = false
+ private var textTopLeft = ""
+ private var textTopRight = ""
+ private var textBottomLeft = ""
+ private var textBottomRight = ""
- var lastCheck = 0L
+ private var lastDaggerCheck = 0L
+ private var lastNearestCheck = 0L
+ private var lastNearest: HellionShield? = null
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
@@ -46,17 +50,33 @@ class BlazeSlayerDaggerHelper {
private fun setDaggerText(holding: Dagger) {
checkActiveDagger()
+ lastNearest = findNearest()
val first = Dagger.TWILIGHT
val second = Dagger.FIREDUST
- textTopLeft = format(holding, true, first)
- textTopRight = format(holding, true, second)
- textBottomLeft = format(holding, false, first)
- textBottomRight = format(holding, false, second)
+ textTopLeft = format(holding, true, first, lastNearest)
+ textTopRight = format(holding, true, second, lastNearest)
+ textBottomLeft = format(holding, false, first, lastNearest)
+ textBottomRight = format(holding, false, second, lastNearest)
}
- private fun format(dagger: Dagger, active: Boolean, compareInHand: Dagger): String {
+ private fun findNearest(): HellionShield? {
+ if (!SkyHanniMod.feature.slayer.blazeMarkRightHellionShield) return null
+
+ if (lastNearestCheck + 100 > System.currentTimeMillis()) return lastNearest
+ lastNearestCheck = System.currentTimeMillis()
+
+
+ val playerLocation = LocationUtils.playerLocation()
+ return HellionShieldHelper.hellionShieldMobs
+ .filter { it.key.getLorenzVec().distance(playerLocation) < 10 && it.key.health > 0 }
+ .toSortedMap { a, b ->
+ if (a.getLorenzVec().distance(playerLocation) < b.getLorenzVec().distance(playerLocation)) 1 else 0
+ }.firstNotNullOfOrNull { it.value }
+ }
+
+ private fun format(dagger: Dagger, active: Boolean, compareInHand: Dagger, nearestShield: HellionShield?): String {
var daggerInHand = dagger
val inHand = dagger == compareInHand
@@ -70,16 +90,28 @@ class BlazeSlayerDaggerHelper {
}
return if (inHand && active) {
- "§7[" + shield.chatColor + shield.cleanName + "§7]"
+ if (nearestShield == null) {
+ "§7[" + shield.chatColor + shield.cleanName + "§7]"
+ } else {
+ if ((shield == nearestShield)) {
+ "§a[" + shield.chatColor + shield.cleanName.uppercase() + "§a]"
+ } else {
+ "§c[§m" + shield.chatColor + shield.cleanName + "§c]"
+ }
+ }
} else {
- shield.chatColor + shield.cleanName
+ if (shield == nearestShield) {
+ "§6[" + shield.chatColor + shield.cleanName + "§6]"
+ } else {
+ shield.chatColor + shield.cleanName
+ }
}
}
private fun checkActiveDagger() {
- if (lastCheck + 1_000 > System.currentTimeMillis()) return
- lastCheck = System.currentTimeMillis()
+ if (lastDaggerCheck + 1_000 > System.currentTimeMillis()) return
+ lastDaggerCheck = System.currentTimeMillis()
for (dagger in Dagger.values()) {
val first = dagger.shields[0]
@@ -191,25 +223,57 @@ class BlazeSlayerDaggerHelper {
GlStateManager.pushMatrix()
GlStateManager.translate(((width / 2) / 1.18).toFloat(), (height / 3.8).toFloat(), 0.0f)
GlStateManager.scale(4.0f, 4.0f, 4.0f)
- TextRenderUtils.drawStringCenteredScaledMaxWidth(textTopLeft, renderer, 0f, 0f, false, (60f * sizeFactor).toInt(), 0)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ textTopLeft,
+ renderer,
+ 0f,
+ 0f,
+ false,
+ (60f * sizeFactor).toInt(),
+ 0
+ )
GlStateManager.popMatrix()
GlStateManager.pushMatrix()
GlStateManager.translate(((width / 2) * 1.18).toFloat(), (height / 3.8).toFloat(), 0.0f)
GlStateManager.scale(4.0f, 4.0f, 4.0f)
- TextRenderUtils.drawStringCenteredScaledMaxWidth(textTopRight, renderer, 0f, 0f, false, (60f * sizeFactor).toInt(), 0)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ textTopRight,
+ renderer,
+ 0f,
+ 0f,
+ false,
+ (60f * sizeFactor).toInt(),
+ 0
+ )
GlStateManager.popMatrix()
GlStateManager.pushMatrix()
GlStateManager.translate(((width / 2) / 1.18).toFloat(), (height / 3.0).toFloat(), 0.0f)
GlStateManager.scale(4.0f, 4.0f, 4.0f)
- TextRenderUtils.drawStringCenteredScaledMaxWidth(textBottomLeft, renderer, 0f, 0f, false, (20f * sizeFactor).toInt(), 0)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ textBottomLeft,
+ renderer,
+ 0f,
+ 0f,
+ false,
+ (20f * sizeFactor).toInt(),
+ 0
+ )
GlStateManager.popMatrix()
GlStateManager.pushMatrix()
GlStateManager.translate(((width / 2) * 1.18).toFloat(), (height / 3.0).toFloat(), 0.0f)
GlStateManager.scale(4.0f, 4.0f, 4.0f)
- TextRenderUtils.drawStringCenteredScaledMaxWidth(textBottomRight, renderer, 0f, 0f, false, (20f * sizeFactor).toInt(), 0)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ textBottomRight,
+ renderer,
+ 0f,
+ 0f,
+ false,
+ (20f * sizeFactor).toInt(),
+ 0
+ )
GlStateManager.popMatrix()
}
}