From ee0ae23560e911fbec5e5262feaaa58dc5d52e7a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 2 Feb 2023 20:38:55 +0100 Subject: Created EntityMaxHealthUpdateEvent, started with better logic for colored mobs. --- .../features/nether/MilleniaAgedBlazeColor.kt | 59 ---------------------- .../features/nether/ashfang/AshfangBlazes.kt | 2 +- 2 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features/nether') diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt deleted file mode 100644 index 8a9cad4fa..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/MilleniaAgedBlazeColor.kt +++ /dev/null @@ -1,59 +0,0 @@ -package at.hannibal2.skyhanni.features.nether - -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.data.IslandType -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 == IslandType.CRIMSON_ISLE && SkyHanniMod.feature.misc.milleniaAgedBlazeColor -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt index ef3f965a1..4e9382d8f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt @@ -64,7 +64,7 @@ class AshfangBlazes { val entityId = event.entity.entityId if (entityId !in blazeArmorStand.keys.map { it.entityId }) return - if (event.health % 10_000_000 != 0F) { + if (event.health % 10_000_000 != 0) { blazeArmorStand.keys.removeIf { it.entityId == entityId } } } -- cgit