diff options
Diffstat (limited to 'src')
3 files changed, 22 insertions, 27 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt b/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt index e5b6d1b28..0841984d3 100644 --- a/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt +++ b/src/main/java/at/hannibal2/skyhanni/damageindicator/BossDamageIndicator.kt @@ -17,7 +17,6 @@ import net.minecraft.entity.monster.EntityEnderman import net.minecraft.entity.monster.EntityMagmaCube import net.minecraft.entity.monster.EntityZombie import net.minecraft.entity.passive.EntityWolf -import net.minecraft.util.Vec3 import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.event.entity.EntityJoinWorldEvent import net.minecraftforge.event.world.WorldEvent @@ -78,20 +77,21 @@ class BossDamageIndicator { } val partialTicks = event.partialTicks - val pos = Vec3( - RenderUtils.interpolate(entity.posX, entity.lastTickPosX, partialTicks), - RenderUtils.interpolate(entity.posY, entity.lastTickPosY, partialTicks) + 0.5f, - RenderUtils.interpolate(entity.posZ, entity.lastTickPosZ, partialTicks) - ) - if (!data.healthLineHidden) { - RenderUtils.drawLabel( - pos, - healthText, - partialTicks, - true, - 6f + val location = if (data.dead && data.deathLocation != null) { + data.deathLocation!! + } else { + val loc = LorenzVec( + RenderUtils.interpolate(entity.posX, entity.lastTickPosX, partialTicks), + RenderUtils.interpolate(entity.posY, entity.lastTickPosY, partialTicks) + 0.5f, + RenderUtils.interpolate(entity.posZ, entity.lastTickPosZ, partialTicks) ) + if (data.dead) data.deathLocation = loc + loc + } + + if (!data.healthLineHidden) { + RenderUtils.drawLabel(location, healthText, partialTicks, true, 6f) } var bossName = when (SkyHanniMod.feature.misc.damageIndicatorBossName) { @@ -108,14 +108,7 @@ class BossDamageIndicator { bossName += data.nameSuffix } - RenderUtils.drawLabel( - pos, - bossName, - partialTicks, - true, - 3.9f, - -9.0f - ) + RenderUtils.drawLabel(location, bossName, partialTicks, true, 3.9f, -9.0f) } GlStateManager.enableDepth() GlStateManager.enableCull() @@ -416,6 +409,7 @@ class BossDamageIndicator { else -> bossType.fullName } + //TODO fix rounding error (25+4=30) println(bossName + " §healed for $healed❤ ($lastHealth -> $health)") LorenzUtils.chat("$bossName §ehealed for §a$healedFormat❤ §8(§e$formatLastHealth -> $formatHealth§8)") } diff --git a/src/main/java/at/hannibal2/skyhanni/damageindicator/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/damageindicator/EntityData.kt index fd44bfb02..2f2738095 100644 --- a/src/main/java/at/hannibal2/skyhanni/damageindicator/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/damageindicator/EntityData.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.damageindicator +import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraft.entity.EntityLivingBase class EntityData( @@ -15,5 +16,6 @@ class EntityData( var healthLineHidden: Boolean = false, var namePrefix: String = "", var nameSuffix: String = "", - var dead: Boolean = false + var dead: Boolean = false, + var deathLocation: LorenzVec? = null )
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 63eff42f5..71b47f23a 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -9,7 +9,6 @@ import net.minecraft.inventory.Slot import net.minecraft.util.AxisAlignedBB import net.minecraft.util.MathHelper import net.minecraft.util.ResourceLocation -import net.minecraft.util.Vec3 import net.minecraftforge.client.event.RenderWorldLastEvent import org.lwjgl.opengl.GL11 import java.awt.Color @@ -322,7 +321,7 @@ object RenderUtils { * @author Mojang */ fun drawLabel( - pos: Vec3, + pos: LorenzVec, text: String, partialTicks: Float, shadow: Boolean = false, @@ -332,11 +331,11 @@ object RenderUtils { val minecraft = Minecraft.getMinecraft() val player = minecraft.thePlayer val x = - pos.xCoord - player.lastTickPosX + (pos.xCoord - player.posX - (pos.xCoord - player.lastTickPosX)) * partialTicks + pos.x - player.lastTickPosX + (pos.x - player.posX - (pos.x - player.lastTickPosX)) * partialTicks val y = - pos.yCoord - player.lastTickPosY + (pos.yCoord - player.posY - (pos.yCoord - player.lastTickPosY)) * partialTicks + pos.y - player.lastTickPosY + (pos.y - player.posY - (pos.y - player.lastTickPosY)) * partialTicks val z = - pos.zCoord - player.lastTickPosZ + (pos.zCoord - player.posZ - (pos.zCoord - player.lastTickPosZ)) * partialTicks + pos.z - player.lastTickPosZ + (pos.z - player.posZ - (pos.z - player.lastTickPosZ)) * partialTicks val f1 = 0.0266666688 val width = minecraft.fontRendererObj.getStringWidth(text) / 2 GlStateManager.pushMatrix() |