diff options
Diffstat (limited to 'src')
5 files changed, 100 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index c033b886c..f05f9ce68 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -311,6 +311,7 @@ class SkyHanniMod { loadModule(RiftOdonata()) loadModule(RiftAgaricusCap()) loadModule(EnigmaSoulWaypoints) + loadModule(DungeonLividFinder) init() diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt index 9abed088a..d4ccee634 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt @@ -58,7 +58,7 @@ enum class BossType(val fullName: String, val bossTypeToggle: Int, val shortName DUNGEON_F2("", 12), DUNGEON_F3("", 13), DUNGEON_F4_THORN("§cThorn", 14), - DUNGEON_F5("", 15), + DUNGEON_F5("§dLivid", 15), DUNGEON_F("", 16), DUNGEON_75("", 17), diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt index 4316c895c..1a44a4bc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.damageindicator import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.dungeon.DungeonData +import at.hannibal2.skyhanni.features.dungeon.DungeonLividFinder import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.utils.EntityUtils.hasBossHealth @@ -172,8 +173,8 @@ class MobFinder { if (DungeonData.isOneOf("F5", "M5")) { if (entity is EntityOtherPlayerMP) { - if (entity == floor5lividEntity) { - return EntityResult(floor5lividEntitySpawnTime, true, finalDungeonBoss = true) + if (entity == DungeonLividFinder.livid) { + return EntityResult(bossType=BossType.DUNGEON_F5, ignoreBlocks = true, finalDungeonBoss = true) } } } @@ -579,14 +580,6 @@ class MobFinder { } private fun findLivid(): EntityOtherPlayerMP? { - for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (entity is EntityOtherPlayerMP) { - if (entity.name == "Livid ") { - return entity - } - } - } - - return null + return DungeonLividFinder.livid } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt new file mode 100644 index 000000000..4933ffd21 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt @@ -0,0 +1,65 @@ +package at.hannibal2.skyhanni.features.dungeon + +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper +import at.hannibal2.skyhanni.utils.BlockUtils.getBlockStateAt +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec +import net.minecraft.block.BlockStainedGlass +import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityOtherPlayerMP +import net.minecraft.entity.item.EntityArmorStand +import net.minecraft.potion.Potion +import net.minecraft.util.AxisAlignedBB +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.awt.Color + +object DungeonLividFinder { + var livid : EntityOtherPlayerMP? = null + private var gotBlinded = false + + @SubscribeEvent + fun onTick(tickEvent: LorenzTickEvent) { + if(!LorenzUtils.inDungeons || !DungeonData.inBossRoom) return + if(DungeonData.dungeonFloor != "F5" && DungeonData.dungeonFloor != "M5") return + if(DungeonData.dungeonFloor == "F5" && livid != null) return + if(tickEvent.isMod(100)) return + if(!gotBlinded) { + gotBlinded = Minecraft.getMinecraft().thePlayer.isPotionActive(Potion.blindness) + return + } else if (Minecraft.getMinecraft().thePlayer.isPotionActive(Potion.blindness)) return + + + val blockStateAt = LorenzVec(6, 109, 43).getBlockStateAt() + val color = LorenzColor.getMatchingColor(blockStateAt.getValue(BlockStainedGlass.COLOR)) ?: return + + for(entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { + if(entity is EntityArmorStand && entity.hasCustomName()) { + if(entity.name.startsWith("${color.getChatColor()}﴾ ${color.getChatColor()}§lLivid")) { + val aabb = AxisAlignedBB( + entity.posX - 0.5, + entity.posY - 2, + entity.posZ - 0.5, + entity.posX + 0.5, + entity.posY, + entity.posZ + 0.5 + ) + val entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABB(EntityOtherPlayerMP::class.java, aabb) + livid = entities.takeIf { it.size == 1 }?.firstOrNull() ?: return + livid?.let { + RenderLivingEntityHelper.setEntityColor(it, Color(0xBF00FF).rgb) { true } + LorenzUtils.debug("Livid found!") + } + } + } + } + } + + @SubscribeEvent + fun onWorldLoad(event: WorldEvent.Load) { + livid = null + gotBlinded = false + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt index 69763f0c7..4199dd6d3 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt @@ -1,5 +1,9 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.test.command.CopyErrorCommand +import net.minecraft.client.Minecraft +import net.minecraft.item.EnumDyeColor +import net.minecraft.util.ChatComponentText import java.awt.Color enum class LorenzColor(private var chatColorCode: Char, private val color: Color) { @@ -32,4 +36,29 @@ enum class LorenzColor(private var chatColorCode: Char, private val color: Color val blue = color.blue return Color(red, green, blue, opacity) } + + companion object { + fun getMatchingColor(enumDyeColor: EnumDyeColor): LorenzColor? { + return when(enumDyeColor) { + EnumDyeColor.WHITE -> WHITE + EnumDyeColor.MAGENTA -> LIGHT_PURPLE + EnumDyeColor.PINK -> LIGHT_PURPLE + EnumDyeColor.RED -> RED + EnumDyeColor.SILVER -> GRAY + EnumDyeColor.GRAY -> GRAY + EnumDyeColor.GREEN -> DARK_GREEN + EnumDyeColor.LIME -> GREEN + EnumDyeColor.BLUE -> BLUE + EnumDyeColor.PURPLE -> DARK_PURPLE + EnumDyeColor.YELLOW -> YELLOW + else -> { + CopyErrorCommand.logError( + Exception("Unknown dye color: $enumDyeColor"), + "Unknown dye color: $enumDyeColor" + ) + return null + } + } + } + } }
\ No newline at end of file |