From 59b63813d81f92a7586f3ae38a22adb035ce35ce Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 1 Oct 2022 17:30:44 +0200 Subject: added MilleniaAgedBlazeColor --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 2 + .../hannibal2/skyhanni/config/features/Misc.java | 6 +++ .../features/end/VoidlingExtremistColor.kt | 17 ++----- .../features/nether/MilleniaAgedBlazeColor.kt | 58 ++++++++++++++++++++++ 4 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index b70587509..4c1d19168 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -25,6 +25,7 @@ import at.hannibal2.skyhanni.features.inventory.*; import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles; import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown; import at.hannibal2.skyhanni.features.minion.MinionFeatures; +import at.hannibal2.skyhanni.features.nether.MilleniaAgedBlazeColor; import at.hannibal2.skyhanni.features.nether.ashfang.*; import at.hannibal2.skyhanni.features.slayer.EndermanSlayerBeacon; import at.hannibal2.skyhanni.features.slayer.HideMobNames; @@ -130,6 +131,7 @@ public class SkyHanniMod { registerEvent(new WikiCommand()); registerEvent(new SummoningMobManager()); registerEvent(new VoidlingExtremistColor()); + registerEvent(new MilleniaAgedBlazeColor()); registerEvent(new CorruptedMobHighlight()); registerEvent(new MarkedPlayerManager()); registerEvent(new HighlightSlayerMiniboss()); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 52e512a35..5420aec36 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -51,6 +51,12 @@ public class Misc { @ConfigAccordionId(id = 2) public boolean voidlingExtremistColor = false; + @Expose + @ConfigOption(name = "Millenia Aged Blaze Color", desc = "Highlight the millenia aged blaze in red color") + @ConfigEditorBoolean + @ConfigAccordionId(id = 2) + public boolean milleniaAgedBlazeColor = false; + @Expose @ConfigOption(name = "Corrupted Mob Highlight", desc = "Highlight corrupted mobs in purple color") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt index 7e5f95f64..f020590e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt @@ -22,8 +22,9 @@ class VoidlingExtremistColor { fun onTick(event: TickEvent.ClientTickEvent) { if (!isEnabled()) return - if (tick++ % 20 == 0) { - find() + if (tick++ % 60 == 0) { + Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance() + .filter { it !in extremists && it.hasMaxHealth(8_000_000) }.forEach { extremists.add(it) } } } @@ -52,14 +53,6 @@ class VoidlingExtremistColor { extremists.clear() } - private fun find() { - Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance() - .filter { it !in extremists && it.hasMaxHealth(8_000_000) }.forEach { extremists.add(it) } - } - - private fun isEnabled(): Boolean { - - return LorenzUtils.inSkyblock && LorenzUtils.skyBlockIsland == "The End" && - SkyHanniMod.feature.misc.voidlingExtremistColor - } + private fun isEnabled(): Boolean = + LorenzUtils.inSkyblock && LorenzUtils.skyBlockIsland == "The End" && SkyHanniMod.feature.misc.milleniaAgedBlazeColor } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt new file mode 100644 index 000000000..123e7a54b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt @@ -0,0 +1,58 @@ +package at.hannibal2.skyhanni.features.nether + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RenderMobColoredEvent +import at.hannibal2.skyhanni.events.ResetEntityHurtEvent +import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.Minecraft +import net.minecraft.entity.monster.EntityBlaze +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class MilleniaAgedBlazeColor { + + private var tick = 0 + private val blazes = mutableListOf() + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + + if (tick++ % 60 == 0) { + Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance() + .filter { it !in blazes && it.hasMaxHealth(30_000_000) }.forEach { blazes.add(it) } + } + } + + @SubscribeEvent + fun onRenderMobColored(event: RenderMobColoredEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in blazes) { + event.color = LorenzColor.DARK_RED.toColor().withAlpha(60) + } + } + + @SubscribeEvent + fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { + if (!isEnabled()) return + val entity = event.entity + + if (entity in blazes) { + event.shouldReset = true + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + blazes.clear() + } + + private fun isEnabled() = + LorenzUtils.inSkyblock && LorenzUtils.skyBlockIsland == "Crimson Isle" && SkyHanniMod.feature.misc.milleniaAgedBlazeColor +} \ No newline at end of file -- cgit