diff options
Diffstat (limited to 'src/main')
3 files changed, 59 insertions, 29 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/slayer/SlayerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/slayer/SlayerConfig.java index f0b3174f0..74f61be7f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/slayer/SlayerConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/slayer/SlayerConfig.java @@ -13,8 +13,9 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; public class SlayerConfig { @Expose - @Category(name = "Endermen", desc = "Endermen Slayer Feature") + @Category(name = "Enderman", desc = "Enderman Slayer Feature") @Accordion + // TODO rename to "enderman" public EndermanConfig endermen = new EndermanConfig(); @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/slayer/endermen/EndermanConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/slayer/endermen/EndermanConfig.java index a28b7afa8..1ff8b49d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/slayer/endermen/EndermanConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/slayer/endermen/EndermanConfig.java @@ -19,6 +19,12 @@ public class EndermanConfig { public boolean highlightNukekebi = false; @Expose + @ConfigOption(name = "Line to Nukekubi Skulls", desc = "Draw a line to the Enderman Slayer Nukekubi Skulls.") + @ConfigEditorBoolean + @FeatureToggle + public boolean drawLineToNukekebi = false; + + @Expose @ConfigOption(name = "Phase Display", desc = "Show the current phase of the Enderman Slayer in damage indicator.") @ConfigEditorBoolean public boolean phaseDisplay = false; 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 c57c473c5..72ab05195 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 @@ -70,7 +70,7 @@ object EndermanSlayerFeatures { flyingBeacons.add(entity) RenderLivingEntityHelper.setEntityColor( entity, - beaconConfig.beaconColor.toChromaColor().withAlpha(1) + beaconConfig.beaconColor.toChromaColor().withAlpha(1), ) { beaconConfig.highlightBeacon } @@ -85,7 +85,7 @@ object EndermanSlayerFeatures { nukekubiSkulls.add(entity) RenderLivingEntityHelper.setEntityColor( entity, - LorenzColor.GOLD.toColor().withAlpha(1) + LorenzColor.GOLD.toColor().withAlpha(1), ) { config.highlightNukekebi } logger.log("Added Nukekubi skulls at ${entity.getLorenzVec()}") } @@ -102,7 +102,6 @@ object EndermanSlayerFeatures { fun onWorldRender(event: LorenzRenderWorldEvent) { if (!IslandType.THE_END.isInIsland()) return - if (beaconConfig.highlightBeacon) { endermenWithBeacons.removeIf { it.isDead || !hasBeaconInHand(it) } @@ -111,26 +110,39 @@ object EndermanSlayerFeatures { } } - for ((location, time) in sittingBeacon) { - if (location.distanceToPlayer() > 20) continue - if (beaconConfig.showLine) { + drawSittingBeacon(event) + drawFlyingBeacon(event) + drawNukekubiSkulls(event) + } + + private fun drawNukekubiSkulls(event: LorenzRenderWorldEvent) { + for (skull in nukekubiSkulls) { + if (skull.isDead) continue + if (config.highlightNukekebi) { + event.drawDynamicText( + skull.getLorenzVec().add(-0.5, 1.5, -0.5), + "§6Nukekubi Skull", + 1.6, + ignoreBlocks = false, + maxDistance = 20, + ) + } + if (config.drawLineToNukekebi) { + val skullLocation = event.exactLocation(skull) + if (skullLocation.distanceToPlayer() > 20) continue + if (!skullLocation.canBeSeen()) continue event.draw3DLine( event.exactPlayerEyeLocation(), - location.add(0.5, 1.0, 0.5), - beaconConfig.lineColor.toChromaColor(), - beaconConfig.lineWidth, - true + skullLocation.add(y = 1), + LorenzColor.GOLD.toColor(), + 3, + true, ) } - - if (beaconConfig.highlightBeacon) { - val duration = 5.seconds - time.passedSince() - val durationFormat = duration.format(showMilliSeconds = true) - event.drawColor(location, beaconConfig.beaconColor.toChromaColor(), alpha = 1f) - event.drawWaypointFilled(location, beaconConfig.beaconColor.toChromaColor(), true, true) - event.drawDynamicText(location.add(y = 1), "§4Beacon §b$durationFormat", 1.8) - } } + } + + private fun drawFlyingBeacon(event: LorenzRenderWorldEvent) { for (beacon in flyingBeacons) { if (beacon.isDead) continue if (beaconConfig.highlightBeacon) { @@ -145,21 +157,32 @@ object EndermanSlayerFeatures { beaconLocation.add(0.5, 1.0, 0.5), beaconConfig.lineColor.toChromaColor(), beaconConfig.lineWidth, - true + true, ) } } + } - config.highlightNukekebi - for (skull in nukekubiSkulls) { - if (!skull.isDead) { - event.drawDynamicText( - skull.getLorenzVec().add(-0.5, 1.5, -0.5), - "§6Nukekubi Skull", - 1.6, - ignoreBlocks = false + private fun drawSittingBeacon(event: LorenzRenderWorldEvent) { + for ((location, time) in sittingBeacon) { + if (location.distanceToPlayer() > 20) continue + if (beaconConfig.showLine) { + event.draw3DLine( + event.exactPlayerEyeLocation(), + location.add(0.5, 1.0, 0.5), + beaconConfig.lineColor.toChromaColor(), + beaconConfig.lineWidth, + true, ) } + + if (beaconConfig.highlightBeacon) { + val duration = 5.seconds - time.passedSince() + val durationFormat = duration.format(showMilliSeconds = true) + event.drawColor(location, beaconConfig.beaconColor.toChromaColor(), alpha = 1f) + event.drawWaypointFilled(location, beaconConfig.beaconColor.toChromaColor(), true, true) + event.drawDynamicText(location.add(y = 1), "§4Beacon §b$durationFormat", 1.8) + } } } @@ -226,7 +249,7 @@ object EndermanSlayerFeatures { event.move( 3, "slayer.endermanBeaconConfig.highlightBeacon", - "slayer.endermen.endermanBeaconConfig.highlightBeacon" + "slayer.endermen.endermanBeaconConfig.highlightBeacon", ) event.move(3, "slayer.endermanBeaconConfig.beaconColor", "slayer.endermen.endermanBeaconConfig.beaconColor") event.move(3, "slayer.endermanBeaconConfig.showWarning", "slayer.endermen.endermanBeaconConfig.showWarning") |