WoShi999 ->target hud like Astolfo
*/
@ElementInfo(name = "Target")
class Target : Element() {
private val decimalFormat = DecimalFormat("##0.00", DecimalFormatSymbols(Locale.ENGLISH))
private val fontValue = FontValue("Font", Fonts.minecraftFont)
private val fadeSpeed = FloatValue("FadeSpeed", 2F, 1F, 9F)
private var easingHealth: Float = 0F
private var lastTarget: Entity? = null
override fun drawElement(): Border {
val target = (LiquidBounce.moduleManager[Aura::class.java] as Aura).target
if (target is EntityPlayer) {
if (target != lastTarget || easingHealth < 0 || easingHealth > target.maxHealth ||
abs(easingHealth - target.health) < 0.01) {
easingHealth = target.health
}
val font=fontValue.get()
val width = (38 + Fonts.font40.getStringWidth(target.name))
.coerceAtLeast(118)
.toFloat()
RenderUtils.drawBorderedRect(0F, 0F, 120F, 52F, 0F, Color(0,0,0,0).rgb, Color(0,0,0,110).rgb)
if (easingHealth > target.health)
RenderUtils.drawRect(2F, 41F, (easingHealth / target.maxHealth) * width,
49F, Colors.getHealthColor(target).rgb)
RenderUtils.drawRect(2F, 41F, (target.health / target.maxHealth) * width,
49F,Colors.getHealthColor(target).rgb)
Fonts.minecraftFont.drawString(target.name, 37, 3, 0xffffff)
easingHealth += ((target.health - easingHealth) / 2.0F.pow(10.0F - fadeSpeed.get())) * RenderUtils.deltaTime
val playerInfo = mc.netHandler.getPlayerInfo(target.uniqueID)
if (playerInfo != null) {
GL11.glPushMatrix()
GL11.glScalef(2F,2F,2F)
font.drawString("${getHealth2(target).roundToInt()} ", 19,9,Colors.getHealthColor(target).rgb)
GL11.glPopMatrix()
} // Draw player
GlStateManager.resetColor()
drawEntityOnScreen(19,40,20,target)
}
lastTarget = target
return Border(0F, 0F, 130F, 45F)
}
private fun getHealth2(entity: EntityLivingBase?):Float{
return if(entity==null || entity.isDead){ 0f }else{ entity.health }
}
}