From 3ef7fc57adcfb0a4692034f4d7075110f5719ce0 Mon Sep 17 00:00:00 2001 From: HiZe_ Date: Tue, 11 Jul 2023 00:44:26 +0200 Subject: Merge pull request #304 * blobbercysts highlight * moved to Colosseum area config * fixed import * fixes * added cansee before enabling depth * removed depth --- .../rift/area/colosseum/BlobbercystsHighlight.kt | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt (limited to 'src/main/java/at/hannibal2/skyhanni/features/rift') diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt new file mode 100644 index 000000000..8c8debba1 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/colosseum/BlobbercystsHighlight.kt @@ -0,0 +1,55 @@ +package at.hannibal2.skyhanni.features.rift.area.colosseum + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.withAlpha +import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.LocationUtils +import at.hannibal2.skyhanni.utils.LocationUtils.canSee +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.getLorenzVec +import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityOtherPlayerMP +import net.minecraft.client.renderer.GlStateManager +import net.minecraftforge.client.event.RenderLivingEvent +import net.minecraftforge.event.entity.living.LivingDeathEvent +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.awt.Color + +class BlobbercystsHighlight { + + private val config get() = SkyHanniMod.feature.rift.area.colosseumConfig + private val entityList = mutableListOf() + private val blobberName = "Blobbercyst " + + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!isEnabled()) return + if (!event.isMod(5)) return + Minecraft.getMinecraft().theWorld.loadedEntityList.filterIsInstance().forEach { + if (it.name == blobberName) { + RenderLivingEntityHelper.setEntityColor(it, Color.RED.withAlpha(80)) { isEnabled() } + RenderLivingEntityHelper.setNoHurtTime(it) { isEnabled() } + entityList.add(it) + } + } + } + + @SubscribeEvent + fun onWorldChange(event: WorldEvent.Load) { + if (!isEnabled()) return + entityList.clear() + } + + @SubscribeEvent + fun onLivingDeath(event: LivingDeathEvent) { + if (!isEnabled()) return + if (entityList.contains(event.entity)) { + entityList.remove(event.entity) + } + } + + fun isEnabled() = RiftAPI.inRift() && config.highlightBlobbercysts && LorenzUtils.skyBlockArea == "Colosseum" +} \ No newline at end of file -- cgit