From e477e43af5f771d31301c51a26340666120ef7f6 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 29 Aug 2023 21:32:56 +0200 Subject: Added option to change the eman slayer beacon color. --- .../hannibal2/skyhanni/config/features/SlayerConfig.java | 5 +++++ .../features/slayer/enderman/EndermanSlayerFeatures.kt | 14 +++++++------- src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt | 13 +++++++++++-- 3 files changed, 23 insertions(+), 9 deletions(-) (limited to 'src/main/java/at') 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 @@ -28,6 +28,11 @@ public class SlayerConfig { @FeatureToggle 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 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 @@ -58,6 +58,15 @@ object RenderUtils { color: LorenzColor, 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 @@ -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() -- cgit