aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorValo <87186719+Emzudemil@users.noreply.github.com>2023-06-27 23:06:41 +0200
committerGitHub <noreply@github.com>2023-06-27 23:06:41 +0200
commitb455aea562059cb4eac1201b2f1b058fbc4c1691 (patch)
tree8ebdea741228a836ceb63ab4c13a1616ac094135 /src/main/java/at/hannibal2/skyhanni/features
parent8b4cf7d640d2941026625b54f849a143dff871e9 (diff)
downloadskyhanni-b455aea562059cb4eac1201b2f1b058fbc4c1691.tar.gz
skyhanni-b455aea562059cb4eac1201b2f1b058fbc4c1691.tar.bz2
skyhanni-b455aea562059cb4eac1201b2f1b058fbc4c1691.zip
Merge pull request #262
* Added DungeonLividFinder and implemented it into the mod * Merge branch 'beta' into livid_finder
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/BossType.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt65
3 files changed, 70 insertions, 12 deletions
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