WooShi999
Posts
-
Share my Session Info(Picture -
TargetHUDStill feel ugly...
Code:
package net.ccbluex.liquidbounce.ui.client.hud.element.elements
import megatron.Client.combat.Aura
import net.ccbluex.liquidbounce.LiquidBounce
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.Colors
import net.ccbluex.liquidbounce.utils.render.RenderUtils
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawEntityOnScreen
import net.ccbluex.liquidbounce.value.FloatValue
import net.ccbluex.liquidbounce.value.FontValue
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.player.EntityPlayer
import org.lwjgl.opengl.GL11
import java.awt.Color
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
import kotlin.math.abs
import kotlin.math.pow
import kotlin.math.roundToInt
/**-
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? = nulloverride 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 }
}
}
-
-
Share my Session Info(Picture@ali-ccfakex-0 my self-made liquidbounce