aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-10-01 17:30:44 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-10-01 17:30:44 +0200
commitf10eca6f72b919f91c835e4ed78dacf3fb5c7bfb (patch)
tree9be7ef80e770a4116f16a71b13f0470ebe688d45 /src/main/java/at/hannibal2/skyhanni/features
parentbf7c3c880b4cbb52e0119f02f745da613ffae386 (diff)
downloadSkyHanni-f10eca6f72b919f91c835e4ed78dacf3fb5c7bfb.tar.gz
SkyHanni-f10eca6f72b919f91c835e4ed78dacf3fb5c7bfb.tar.bz2
SkyHanni-f10eca6f72b919f91c835e4ed78dacf3fb5c7bfb.zip
added MilleniaAgedBlazeColor
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt58
2 files changed, 63 insertions, 12 deletions
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<EntityEnderman>()
+ .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<EntityEnderman>()
- .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<EntityBlaze>()
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (!isEnabled()) return
+
+ if (tick++ % 60 == 0) {
+ Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance<EntityBlaze>()
+ .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