diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-07 01:29:22 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-07 01:29:22 +0200 |
commit | 9a3e868e8c66f2995b4ccf7d474974c58f8c08bf (patch) | |
tree | a7d86ae0a74f99790364a5391bd7dcbf68d327e0 | |
parent | 899a0e350ce2a0491d0105a19dbb4b9f9556d0d4 (diff) | |
download | skyhanni-9a3e868e8c66f2995b4ccf7d474974c58f8c08bf.tar.gz skyhanni-9a3e868e8c66f2995b4ccf7d474974c58f8c08bf.tar.bz2 skyhanni-9a3e868e8c66f2995b4ccf7d474974c58f8c08bf.zip |
add support for eman tier 3
5 files changed, 61 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossDamageIndicator.kt b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossDamageIndicator.kt index cdf828405..313a24cc3 100644 --- a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossDamageIndicator.kt +++ b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossDamageIndicator.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import net.minecraft.client.Minecraft import net.minecraft.client.renderer.GlStateManager import net.minecraft.entity.EntityLivingBase +import net.minecraft.entity.monster.EntityEnderman import net.minecraft.util.Vec3 import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.event.entity.EntityJoinWorldEvent @@ -54,6 +55,7 @@ class BossDamageIndicator { if (!data.ignoreBlocks) { if (!player.canEntityBeSeen(data.entity)) continue } + if (data.hidden) continue val entity = data.entity @@ -155,7 +157,29 @@ class BossDamageIndicator { } } - val percentage = health.toDouble() / maxHealth.toDouble() + var calcHealth = health + var calcMaxHealth = maxHealth + + + if (entityData.bossType == BossType.END_ENDERMAN_SLAYER) { + if (maxHealth == 66_666_666) { + calcMaxHealth = 22_222_222 + if (health > 44_444_444) { + calcHealth -= 44_444_444 + } else if (health > 22_222_222) { + calcHealth -= 22_222_222 + } else { + calcHealth = health + } + } else { + println("maxHealth: $maxHealth") + } + if (entity is EntityEnderman) { + entityData.hidden = entity.hasNameTagWith(0, 3, 0, " Hits") + } + } + + val percentage = calcHealth.toDouble() / calcMaxHealth.toDouble() val color = when { percentage > 0.9 -> LorenzColor.DARK_GREEN percentage > 0.75 -> LorenzColor.GREEN @@ -212,7 +236,7 @@ class BossDamageIndicator { } entityData.lastHealth = health - entityData.text = NumberUtil.format(health) + entityData.text = NumberUtil.format(calcHealth) entityData.color = color entityData.timeLastTick = System.currentTimeMillis() data[entity.uniqueID] = entityData diff --git a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossFinder.kt b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossFinder.kt index f192f41ff..7c6412f07 100644 --- a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossFinder.kt @@ -11,6 +11,8 @@ import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase +import net.minecraft.entity.boss.EntityDragon +import net.minecraft.entity.boss.EntityWither import net.minecraft.entity.item.EntityArmorStand import net.minecraft.entity.monster.* import net.minecraft.util.AxisAlignedBB @@ -208,6 +210,25 @@ class BossFinder { } } + //TODO testing and make right and so + if (entity is EntityWither) { + if (entity.hasNameTagWith(0, 4, 0, "§8[§7Lv100§8] §c§5Vanquisher§r ")) { + return EntityResult(bossType = BossType.NETHER_VANQUISHER) + } + } + + if (entity is EntityEnderman) { + if (entity.hasNameTagWith(0, 3, 0, "§c☠ §bVoidgloom Seraph ")) { + return EntityResult(bossType = BossType.END_ENDERMAN_SLAYER) + } + } + + //TODO testing and make right and so + if (entity is EntityDragon) { +// if (entity.hasNameTagWith(0, 3, 0, "§c☠ §bVoidgloom Seraph ")) { + return EntityResult(bossType = BossType.END_ENDER_DRAGON) +// } + } } return null @@ -410,11 +431,11 @@ class BossFinder { } } -private fun EntityMob.hasNameTagWith(x: Int, y: Int, z: Int, startName: String): Boolean { +fun EntityMob.hasNameTagWith(x: Int, y: Int, z: Int, contains: String): Boolean { val center = getLorenzVec().add(x, y, z) val a = center.add(-1.6, -1.6, -1.6).toBlocPos() val b = center.add(1.6, 1.6, 1.6).toBlocPos() val alignedBB = AxisAlignedBB(a, b) val clazz = EntityArmorStand::class.java - return worldObj.getEntitiesWithinAABB(clazz, alignedBB).any { it.name.startsWith(startName) } + return worldObj.getEntitiesWithinAABB(clazz, alignedBB).any { it.name.contains(contains) } } diff --git a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossType.kt b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossType.kt index 5ed9bf38f..8a6abc651 100644 --- a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossType.kt +++ b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossType.kt @@ -8,10 +8,12 @@ enum class BossType { NETHER_MAGMA_BOSS, NETHER_ASHFANG, NETHER_BARBARIAN_DUKE, - NETHER_MAGE_OUTLAW,//TODO add real name + NETHER_MAGE_OUTLAW, + + NETHER_VANQUISHER, - END_ENDER_DRAGON, END_OBSIDIAN_DEFENDER, - END_VOIDGLOOM_SLAYER_4 + END_ENDERMAN_SLAYER, + END_ENDER_DRAGON, }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/EntityData.kt index 25c30dd71..f073045b8 100644 --- a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/EntityData.kt @@ -14,4 +14,5 @@ class EntityData( var text: String = "", var color: LorenzColor = LorenzColor.DARK_GREEN, var timeLastTick: Long = 0, + var hidden: Boolean = false )
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index 58346fd07..54aa15534 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -124,6 +124,12 @@ class LorenzTest { resultList.add("rotationYaw: $rotationYaw") resultList.add("rotationPitch: $rotationPitch") + val riddenByEntity = entity.riddenByEntity + resultList.add("riddenByEntity: $riddenByEntity") + val ridingEntity = entity.ridingEntity + resultList.add("ridingEntity: $ridingEntity") + + if (entity is EntityArmorStand) { resultList.add("armor stand data:") val headRotation = entity.headRotation.toLorenzVec() |