A Simple HealthBar TargetHUD
-
main codes
package net.ccbluex.liquidbounce.ui.client.hud.element.elements import net.ccbluex.liquidbounce.LiquidBounce import net.ccbluex.liquidbounce.features.module.modules.combat.KillAura import net.ccbluex.liquidbounce.ui.client.hud.element.Border import net.ccbluex.liquidbounce.ui.client.hud.element.Element import net.ccbluex.liquidbounce.ui.client.hud.element.ElementInfo import net.ccbluex.liquidbounce.ui.font.Fonts import net.ccbluex.liquidbounce.utils.render.RenderUtils import net.ccbluex.liquidbounce.value.FloatValue import net.minecraft.entity.Entity import net.minecraft.entity.player.EntityPlayer import java.awt.Color import kotlin.math.abs import kotlin.math.pow @ElementInfo(name = "Target") class Target : Element() { private var Health: Float = 0F private var EndingTarget: Entity? = null private val BarAnimationSpeed = FloatValue("BarAnimationSpeed", 2F, 1F, 9F) override fun drawElement(): Border { val target = (LiquidBounce.moduleManager[KillAura::class.java] as KillAura).target if (target is EntityPlayer) { if (target != EndingTarget || Health < 0 || Health > target.maxHealth || abs(Health - target.health) < 0.01) { Health = target.health } val width = (38 + Fonts.font40.getStringWidth(target.name)) .coerceAtLeast(119) .toFloat() RenderUtils.drawBorderedRect(3F, 37F, 115F, 42F, 4.2F, Color(16, 16, 16, 255).rgb, Color(10, 10, 10, 100).rgb) RenderUtils.drawBorderedRect(3F, 37F, 115F, 42F, 1.2F, Color(255, 255, 255, 180).rgb, Color(255, 180, 255, 0).rgb) if (Health > target.health) RenderUtils.drawRect(3F, 37F, (Health / target.maxHealth) * width - 4F, 42F, Color(250, 0, 0, 120).rgb) RenderUtils.drawRect(3.2F, 37F, (target.health / target.maxHealth) * width - 4F, 42F, Color(220, 0, 0, 220).rgb) if (Health < target.health) RenderUtils.drawRect((Health / target.maxHealth) * width, 37F, (target.health / target.maxHealth) * width, 42F, Color(44, 201, 144).rgb) RenderUtils.drawBorderedRect(3F, 37F, 115F, 42F, 1.2F, Color(255, 255, 255, 180).rgb, Color(255, 180, 255, 0).rgb) Health += ((target.health - Health) / 2.0F.pow(10.0F - BarAnimationSpeed.get())) * RenderUtils.deltaTime mc.fontRendererObj.drawStringWithShadow("" + target.name, 36F, 22F, 0xFFFFFF) } EndingTarget = target return Border(0F, 0F, 120F, 36F) } }This is the final effect. He also has the animation of blood deduction and blood recovery. Welcome to use it

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login