diff options
Diffstat (limited to 'src/main/java/at')
3 files changed, 85 insertions, 25 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 af8e65647..49b8b15c9 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/SlayerConfig.java @@ -12,19 +12,43 @@ public class SlayerConfig { public boolean enderman = false; @Expose - @ConfigOption(name = "Highlight Yang Glyph", desc = "Highlight the Enderman Slayer Yang Glyph (beacon) in red color and added an timer when he explodes. Supports beacon in hand and beacon flying.") - @ConfigEditorBoolean + @ConfigOption(name = "Yang Glyph (beacon)", desc = "") @ConfigAccordionId(id = 0) - public boolean slayerEndermanBeacon = false; + @Accordion + public EndermanBeaconConfig endermanBeaconConfig = new EndermanBeaconConfig(); - @Expose - @ConfigOption(name = "Beacon Warning", desc = "Displays a warning mid-screen then the Enderman Slayer throws a Yang Glyph (beacon).") - @ConfigEditorBoolean - @ConfigAccordionId(id = 0) - public boolean slayerEndermanBeaconWaring = false; + public static class EndermanBeaconConfig { + + @Expose + @ConfigOption(name = "Enable", + desc = "Highlight the Enderman Slayer Yang Glyph (beacon) in red color and added an timer when he explodes. " + + "Supports beacon in hand and beacon flying.") + @ConfigEditorBoolean + public boolean enabled = true; + + @Expose + @ConfigOption(name = "Show Warning", desc = "Displays a warning mid-screen then the Enderman Slayer throws a Yang Glyph (beacon).") + @ConfigEditorBoolean + public boolean showWarning = false; + + @Expose + @ConfigOption(name = "Show Line", desc = "Draw a line starting at your crosshair to the beacon.") + @ConfigEditorBoolean + public boolean showLine = false; + + @Expose + @ConfigOption(name = "Line color", desc = "Color of the line.") + @ConfigEditorColour + public String lneColor = "0:255:255:0:88"; + + @Expose + @ConfigOption(name = "Line Width", desc = "Width of the line.") + @ConfigEditorSlider(minStep = 1, minValue = 1, maxValue = 10) + public int lineWidth = 1; + } @Expose - @ConfigOption(name = "Highlight Nukekebi Skulls", desc = "Highlights the Enderman Slayer Nukekebi Skulls.") + @ConfigOption(name = "Highlight Nukekebi Skulls", desc = "Highlights the Enderman Slayer Nukekebi Skulls (Eyes).") @ConfigEditorBoolean @ConfigAccordionId(id = 0) public boolean endermanHighlightNukekebi = false; @@ -236,17 +260,17 @@ public class SlayerConfig { public int twinclawsDelay = 0; @Expose - @ConfigOption(name = "Draw line", desc = "Draw a line starting at your crosshair to the boss head") + @ConfigOption(name = "Draw line", desc = "Draw a line starting at your crosshair to the boss head.") @ConfigEditorBoolean public boolean drawLine = false; @Expose - @ConfigOption(name = "Line color", desc = "Color of the line") + @ConfigOption(name = "Line color", desc = "Color of the line.") @ConfigEditorColour public String lineColor = "0:255:255:0:88"; @Expose - @ConfigOption(name = "Line Width", desc = "Width of the line") + @ConfigOption(name = "Line Width", desc = "Width of the line.") @ConfigEditorSlider(minStep = 1, minValue = 1, maxValue = 10) public int lineWidth = 1; 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 0caa2f3be..9948695bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -278,9 +278,15 @@ object VampireSlayerFeatures { val vec = event.exactLocation(it) val distance = start.distance(vec) if (distance <= 15) { - val p = Minecraft.getMinecraft().thePlayer - val add = if (p.isSneaking) LorenzVec(0.0, 1.54, 0.0) else LorenzVec(0.0, 1.62, 0.0) - event.draw3DLine(event.exactLocation(p).add(add), vec.add(0.0, 1.54, 0.0), config.lineColor.toChromaColor(), config.lineWidth, true) + val player = Minecraft.getMinecraft().thePlayer + val add = if (player.isSneaking) LorenzVec(0.0, 1.54, 0.0) else LorenzVec(0.0, 1.62, 0.0) + event.draw3DLine( + event.exactLocation(player).add(add), + vec.add(0.0, 1.54, 0.0), + config.lineColor.toChromaColor(), + config.lineWidth, + true + ) } } } @@ -300,10 +306,20 @@ object VampireSlayerFeatures { color ) { isEnabled() } - val linesColorStart = (if (isIchor) configBloodIcor.linesColor else configKillerSpring.linesColor).toChromaColor() + val linesColorStart = + (if (isIchor) configBloodIcor.linesColor else configKillerSpring.linesColor).toChromaColor() val text = if (isIchor) "§4Ichor" else "§4Spring" - event.drawColor(stand.position.toLorenzVec().add(0.0, 2.0, 0.0), LorenzColor.DARK_RED, alpha = 1f) - event.drawDynamicText(stand.position.toLorenzVec().add(0.5, 2.5, 0.5), text, 1.5, ignoreBlocks = false) + event.drawColor( + stand.position.toLorenzVec().add(0.0, 2.0, 0.0), + LorenzColor.DARK_RED, + alpha = 1f + ) + event.drawDynamicText( + stand.position.toLorenzVec().add(0.5, 2.5, 0.5), + text, + 1.5, + ignoreBlocks = false + ) for ((player, stand2) in standList) { if ((configBloodIcor.showLines && isIchor) || (configKillerSpring.showLines && isSpring)) event.draw3DLine( @@ -312,7 +328,8 @@ object VampireSlayerFeatures { // stand2.position.toLorenzVec().add(0.0, 1.5, 0.0), linesColorStart, 3, - true) + true + ) } } if (configBloodIcor.renderBeam && isIchor) { 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 65c5e6757..3c2db21e6 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 @@ -11,10 +11,13 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor +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.exactLocation import at.hannibal2.skyhanni.utils.TimeUtils.format +import net.minecraft.client.Minecraft import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityEnderman import net.minecraft.init.Blocks @@ -25,6 +28,7 @@ import kotlin.time.Duration.Companion.seconds class EndermanSlayerFeatures { private val config get() = SkyHanniMod.feature.slayer + private val beaconConfig get() = config.endermanBeaconConfig private val endermenWithBeacons = mutableListOf<EntityEnderman>() private val flyingBeacons = mutableListOf<EntityArmorStand>() private val nukekebiSkulls = mutableListOf<EntityArmorStand>() @@ -40,7 +44,7 @@ class EndermanSlayerFeatures { if (entity in endermenWithBeacons || entity in flyingBeacons) return if (entity is EntityEnderman) { - if (config.slayerEndermanBeacon) { + if (beaconConfig.enabled) { if (hasBeaconInHand(entity) && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) { endermenWithBeacons.add(entity) logger.log("Added enderman with beacon at ${entity.getLorenzVec()}") @@ -49,11 +53,11 @@ class EndermanSlayerFeatures { } if (entity is EntityArmorStand) { - if (config.slayerEndermanBeacon) { + if (beaconConfig.showLine) { val stack = entity.inventory[4] ?: return if (stack.name == "Beacon" && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) { flyingBeacons.add(entity) - if (config.slayerEndermanBeaconWaring) + if (beaconConfig.showWarning) TitleUtils.sendTitle("§4Beacon", 2_00) logger.log("Added flying beacons at ${entity.getLorenzVec()}") } @@ -78,7 +82,7 @@ class EndermanSlayerFeatures { fun onRenderMobColored(event: RenderMobColoredEvent) { if (!IslandType.THE_END.isInIsland()) return - if (config.slayerEndermanBeacon && event.entity in flyingBeacons) { + if (beaconConfig.enabled && event.entity in flyingBeacons) { event.color = LorenzColor.DARK_RED.toColor().withAlpha(1) } @@ -90,7 +94,7 @@ class EndermanSlayerFeatures { @SubscribeEvent(priority = EventPriority.HIGH) fun onWorldRender(event: RenderWorldLastEvent) { if (!IslandType.THE_END.isInIsland()) return - if (!config.slayerEndermanBeacon) return + if (!beaconConfig.enabled) return endermenWithBeacons.removeIf { it.isDead || !hasBeaconInHand(it) } @@ -98,6 +102,21 @@ class EndermanSlayerFeatures { .forEach { event.drawColor(it, LorenzColor.DARK_RED, alpha = 1f) } for ((location, time) in sittingBeacon) { + if (beaconConfig.showLine) { + val distance = location.distance(location) + if (distance <= 15) { + val player = Minecraft.getMinecraft().thePlayer + val add = if (player.isSneaking) LorenzVec(0.0, 1.54, 0.0) else LorenzVec(0.0, 1.62, 0.0) + event.draw3DLine( + event.exactLocation(player).add(add), + location.add(0.5, 1.0, 0.5), + beaconConfig.lneColor.toChromaColor(), + beaconConfig.lineWidth, + true + ) + } + } + val duration = 5.seconds - time.passedSince() val durationFormat = duration.format(showMilliSeconds = true) event.drawColor(location, LorenzColor.DARK_RED, alpha = 1f) @@ -144,7 +163,7 @@ class EndermanSlayerFeatures { @SubscribeEvent fun onBlockChange(event: ServerBlockChangeEvent) { if (!IslandType.THE_END.isInIsland()) return - if (!config.slayerEndermanBeacon) return + if (!beaconConfig.enabled) return val location = event.location if (event.new == "beacon") { |