aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-29 21:32:56 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-29 21:32:56 +0200
commite477e43af5f771d31301c51a26340666120ef7f6 (patch)
treeeedccfe77cc3baef3b51e691e61613147b5b2616 /src/main/java
parent68c9844d02e7ceb13b8dcf6f090cef5a8ce6f037 (diff)
downloadskyhanni-e477e43af5f771d31301c51a26340666120ef7f6.tar.gz
skyhanni-e477e43af5f771d31301c51a26340666120ef7f6.tar.bz2
skyhanni-e477e43af5f771d31301c51a26340666120ef7f6.zip
Added option to change the eman slayer beacon color.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt13
3 files changed, 23 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java
index d05dcd06d..b3678464c 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java
@@ -29,6 +29,11 @@ public class SlayerConfig {
public boolean highlightBeacon = true;
@Expose
+ @ConfigOption(name = "Beacon Color", desc = "Color of the beacon.")
+ @ConfigEditorColour
+ public String beaconColor = "0:255:255:0:88";
+
+ @Expose
@ConfigOption(name = "Show Warning", desc = "Displays a warning mid-screen then the Enderman Slayer throws a Yang Glyph (beacon).")
@ConfigEditorBoolean
@FeatureToggle
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 5a154c7cd..b534945af 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
@@ -86,7 +86,7 @@ class EndermanSlayerFeatures {
if (!IslandType.THE_END.isInIsland()) return
if (beaconConfig.highlightBeacon && event.entity in flyingBeacons) {
- event.color = LorenzColor.DARK_RED.toColor().withAlpha(1)
+ event.color = beaconConfig.beaconColor.toChromaColor().withAlpha(1)
}
if (config.endermanHighlightNukekebi && event.entity in nukekubiSkulls) {
@@ -99,11 +99,11 @@ class EndermanSlayerFeatures {
if (!IslandType.THE_END.isInIsland()) return
- if (showBeacon()) {
+ if (beaconConfig.highlightBeacon) {
endermenWithBeacons.removeIf { it.isDead || !hasBeaconInHand(it) }
endermenWithBeacons.map { it.getLorenzVec().add(-0.5, 0.2, -0.5) }
- .forEach { event.drawColor(it, LorenzColor.DARK_RED, alpha = 1f) }
+ .forEach { event.drawColor(it, beaconConfig.beaconColor.toChromaColor(), alpha = 0.5f) }
}
for ((location, time) in sittingBeacon) {
@@ -121,8 +121,8 @@ class EndermanSlayerFeatures {
if (beaconConfig.highlightBeacon) {
val duration = 5.seconds - time.passedSince()
val durationFormat = duration.format(showMilliSeconds = true)
- event.drawColor(location, LorenzColor.DARK_RED, alpha = 1f)
- event.drawWaypointFilled(location, LorenzColor.RED.toColor(), true, true)
+ event.drawColor(location, beaconConfig.beaconColor.toChromaColor(), alpha = 1f)
+ event.drawWaypointFilled(location, beaconConfig.beaconColor.toChromaColor(), true, true)
event.drawDynamicText(location.add(0, 1, 0), "§4Beacon §b$durationFormat", 1.8)
}
}
@@ -163,8 +163,8 @@ class EndermanSlayerFeatures {
if (!IslandType.THE_END.isInIsland()) return
if (!event.repeatSeconds(1)) return
- nukekubiSkulls.also { it.removeAll { it.isDead } }
- flyingBeacons.also { it.removeAll { it.isDead } }
+ nukekubiSkulls.also { skulls -> skulls.removeAll { it.isDead } }
+ flyingBeacons.also { beacons -> beacons.removeAll { it.isDead } }
// Removing the beacon if It's still there after 7 sesconds.
// This is just a workaround for the cases where the ServerBlockChangeEvent don't detect the beacon despawn info.
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 22d6cdaf3..7544e7934 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -59,6 +59,15 @@ object RenderUtils {
beacon: Boolean = false,
alpha: Float = -1f,
) {
+ drawColor(location, color.toColor(), beacon, alpha)
+ }
+
+ fun RenderWorldLastEvent.drawColor(
+ location: LorenzVec,
+ color: Color,
+ beacon: Boolean = false,
+ alpha: Float = -1f,
+ ) {
val (viewerX, viewerY, viewerZ) = getViewerPos(partialTicks)
val x = location.x - viewerX
val y = location.y - viewerY
@@ -73,11 +82,11 @@ object RenderUtils {
GlStateManager.disableCull()
drawFilledBoundingBox(
AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1).expandBlock(),
- color.toColor(),
+ color,
realAlpha
)
GlStateManager.disableTexture2D()
- if (distSq > 5 * 5 && beacon) renderBeaconBeam(x, y + 1, z, color.toColor().rgb, 1.0f, partialTicks)
+ if (distSq > 5 * 5 && beacon) renderBeaconBeam(x, y + 1, z, color.rgb, 1.0f, partialTicks)
GlStateManager.disableLighting()
GlStateManager.enableTexture2D()
GlStateManager.enableDepth()