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/end/VoidlingExtremistColor.kt | 59 ---------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features/end') diff --git a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt b/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt deleted file mode 100644 index c9b02bf5d..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/end/VoidlingExtremistColor.kt +++ /dev/null @@ -1,59 +0,0 @@ -package at.hannibal2.skyhanni.features.end - -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.EntityEnderman -import net.minecraftforge.event.world.WorldEvent -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent - -class VoidlingExtremistColor { - - private var tick = 0 - private val extremists = mutableListOf() - - @SubscribeEvent - fun onTick(event: TickEvent.ClientTickEvent) { - if (!isEnabled()) return - - if (tick++ % 60 == 0) { - Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance() - .filter { it !in extremists && it.hasMaxHealth(8_000_000) }.forEach { extremists.add(it) } - } - } - - @SubscribeEvent - fun onRenderMobColored(event: RenderMobColoredEvent) { - if (!isEnabled()) return - val entity = event.entity - - if (entity in extremists) { - event.color = LorenzColor.LIGHT_PURPLE.toColor().withAlpha(127) - } - } - - @SubscribeEvent - fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { - if (!isEnabled()) return - val entity = event.entity - - if (entity in extremists) { - event.shouldReset = true - } - } - - @SubscribeEvent - fun onWorldChange(event: WorldEvent.Load) { - extremists.clear() - } - - private fun isEnabled(): Boolean = - LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.THE_END && SkyHanniMod.feature.misc.voidlingExtremistColor -} \ No newline at end of file -- cgit