From 4f51a13e699fd35acf6ca4c72db8bd1b103788c8 Mon Sep 17 00:00:00 2001 From: dragon99z Date: Wed, 19 Jul 2023 19:43:41 +0200 Subject: Eman slayer Features (#325) --- .../hannibal2/skyhanni/config/features/Slayer.java | 12 ++++++ .../features/slayer/EndermanSlayerBeacon.kt | 50 +++++++++++++++++++--- 2 files changed, 57 insertions(+), 5 deletions(-) (limited to 'src/main') 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 36a4c6e3d..55b6059c9 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Slayer.java @@ -17,6 +17,18 @@ public class Slayer { @ConfigAccordionId(id = 0) public boolean slayerEndermanBeacon = false; + @Expose + @ConfigOption(name = "Enderman Beacon Warnig", desc = "Displays a warning mid-screen then the enderman Slayer throws a Yang Glyph (beacon).") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean slayerEndermanBeaconWaring = false; + + @Expose + @ConfigOption(name = "Enderman Highlight Nukekebi Skulls", desc = "Highlights the enderman Slayer Nukekebi Skulls.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean slayerEndermanHighlightNukekebiSkulls = false; + @Expose @ConfigOption(name = "Phase Display", desc = "Show the current phase of the enderman slayer.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt index 12e66c313..7683b30d1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/EndermanSlayerBeacon.kt @@ -2,19 +2,23 @@ package at.hannibal2.skyhanni.features.slayer import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ServerBlockChangeEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager +import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.RenderUtils.drawColor import at.hannibal2.skyhanni.utils.RenderUtils.drawString import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.EntityEnderman import net.minecraft.init.Blocks +import net.minecraft.init.Items import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.EventPriority @@ -24,6 +28,7 @@ class EndermanSlayerBeacon { private val endermenWithBeacons = mutableListOf() private val flyingBeacons = mutableListOf() + private val nukekebiSkulls = mutableListOf() private val sittingBeacon = mutableListOf() private val logger = LorenzLogger("slayer/voildgloom_beacon") @@ -43,8 +48,20 @@ class EndermanSlayerBeacon { val stack = entity.inventory[4] ?: return if (stack.name == "Beacon" && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) { flyingBeacons.add(entity) + if(isBeaconWarningEnabled()) + TitleUtils.sendTitle("§4Beacon", 1_000) logger.log("Added flying beacons at ${entity.getLorenzVec()}") } + + if (entity.inventory.any { + it?.takeIf { it.item == Items.skull } + ?.let { it.getSkullTexture() } == "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0=" + }) { + nukekebiSkulls.add(entity) + logger.log("Added nukekebi skulls at ${entity.getLorenzVec()}") + nukekebiSkulls.also { it.removeAll { it.isDead } } + + } } } @@ -58,16 +75,20 @@ class EndermanSlayerBeacon { @SubscribeEvent fun onRenderMobColored(event: RenderMobColoredEvent) { - if (!isEnabled()) return + if(!isBeaconEnabled() && !isHighlightNukekebiSkullsEnabled()) return + + if (isBeaconEnabled() && event.entity in flyingBeacons) { + event.color = LorenzColor.DARK_RED.toColor().withAlpha(1) + } - if (event.entity in flyingBeacons) { + if (isHighlightNukekebiSkullsEnabled() && event.entity in nukekebiSkulls) { event.color = LorenzColor.DARK_RED.toColor().withAlpha(1) } } @SubscribeEvent(priority = EventPriority.HIGH) fun onWorldRender(event: RenderWorldLastEvent) { - if (!isEnabled()) return + if (!isBeaconEnabled()) return endermenWithBeacons.removeIf { it.isDead || !hasBeaconInHand(it) } @@ -76,13 +97,16 @@ class EndermanSlayerBeacon { for (location in sittingBeacon.toMutableList()) { event.drawColor(location, LorenzColor.DARK_RED, alpha = 1f) + event.drawWaypointFilled(location, LorenzColor.RED.toColor(),true,true) event.drawString(location.add(0.5, 0.5, 0.5), "§4Beacon", true) + + } } @SubscribeEvent fun onBlockChange(event: ServerBlockChangeEvent) { - if (!isEnabled()) return + if (!isBeaconEnabled()) return val location = event.location if (event.new == "beacon") { @@ -100,7 +124,7 @@ class EndermanSlayerBeacon { } } - private fun isEnabled(): Boolean = LorenzUtils.inSkyBlock && + private fun isBeaconEnabled(): Boolean = LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.slayerEndermanBeacon && LorenzUtils.skyBlockIsland == IslandType.THE_END && DamageIndicatorManager.isBossSpawned( @@ -108,11 +132,27 @@ class EndermanSlayerBeacon { BossType.SLAYER_ENDERMAN_3, BossType.SLAYER_ENDERMAN_4 ) + private fun isBeaconWarningEnabled(): Boolean = LorenzUtils.inSkyBlock && + SkyHanniMod.feature.slayer.slayerEndermanBeaconWaring && + LorenzUtils.skyBlockIsland == IslandType.THE_END && + DamageIndicatorManager.isBossSpawned( + BossType.SLAYER_ENDERMAN_2, + BossType.SLAYER_ENDERMAN_3, + BossType.SLAYER_ENDERMAN_4 + ) + private fun isHighlightNukekebiSkullsEnabled(): Boolean = LorenzUtils.inSkyBlock && + SkyHanniMod.feature.slayer.slayerEndermanHighlightNukekebiSkulls && + LorenzUtils.skyBlockIsland == IslandType.THE_END && + DamageIndicatorManager.isBossSpawned( + BossType.SLAYER_ENDERMAN_3, + BossType.SLAYER_ENDERMAN_4 + ) @SubscribeEvent fun onWorldChange(event: WorldEvent.Load) { endermenWithBeacons.clear() flyingBeacons.clear() + nukekebiSkulls.clear() sittingBeacon.clear() logger.log("Reset everything (world change)") } -- cgit