Navigation

    CCBlueX Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    a Minor changes to the original TargetHUD

    Kotlin/Java
    2
    2
    256
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Larissa
      Larissa last edited by

      this is a very brief TargetHUD。this is cod:

      • LiquidBounce Hacked Client
      • A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
      • https://github.com/CCBlueX/LiquidBounce/
        */

      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.extensions.getDistanceToEntityBox
      import net.ccbluex.liquidbounce.utils.render.RenderUtils
      import net.ccbluex.liquidbounce.value.FloatValue
      import net.minecraft.client.gui.Gui
      import net.minecraft.entity.Entity
      import net.minecraft.entity.player.EntityPlayer
      import net.minecraft.util.ResourceLocation
      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

      /**

      • A target hud
        */
        @ElementInfo(name = "Target")
        class Target : Element() {

        private val decimalFormat = DecimalFormat("##0.00", DecimalFormatSymbols(Locale.ENGLISH))
        private val fadeSpeed = FloatValue("FadeSpeed", 3F, 1F, 9F)

        private var easingHealth: Float = 0F
        private var lastTarget: Entity? = null

        override fun drawElement(): Border {
        val target = (LiquidBounce.moduleManager[KillAura::class.java] as KillAura).target

         if (target is EntityPlayer) {
             if (target != lastTarget || easingHealth < 0 || easingHealth > target.maxHealth ||
                     abs(easingHealth - target.health) < 0.01) {
                 easingHealth = target.health
             }
        
             val width = (38 + Fonts.font40.getStringWidth(target.name))
                     .coerceAtLeast(118)
                     .toFloat()
        
             // Draw rect box
             RenderUtils.drawBorderedRect(0F, 0F, width, 30F, 3F, Color.darkGray.rgb, Color.darkGray.rgb)
        
             // Damage animation
             if (easingHealth > target.health)
                 RenderUtils.drawRect(0F, 34F, (easingHealth / target.maxHealth) * width,
                         34F, Color(212, 107, 107).rgb)
        
             // Health bar
             RenderUtils.drawRect(0F, 34F, (target.health / target.maxHealth) * width,
                     45F, Color(250, 0, 0).rgb)
        
             // Heal animation
             if (easingHealth < target.health)
                 RenderUtils.drawRect((easingHealth / target.maxHealth) * width, 34F,
                         (target.health / target.maxHealth) * width, 45F, Color(250, 250, 250).rgb)
        
             easingHealth += ((target.health - easingHealth) / 2.0F.pow(10.0F - fadeSpeed.get())) * RenderUtils.deltaTime
        
             Fonts.font40.drawString(target.name, 36, 3, 0xffffff)
             Fonts.font35.drawString("Distance: ${decimalFormat.format(mc.thePlayer.getDistanceToEntityBox(target))}", 36, 15, 0xffffff);
         }
         // Draw head
        

      lastTarget = target
      return Border(0F, 0F, 120F, 50F)
      }

      private fun drawHead(skin: ResourceLocation, width: Int, height: Int) {
      GL11.glColor4f(1F, 1F, 1F, 4F)
      mc.textureManager.bindTexture(skin)
      Gui.drawScaledCustomSizeModalRect(2, 2, 8F, 8F, 8, 8, width, height,
      64F, 64F)
      }

      }

      FartCheese 1 Reply Last reply Reply Quote 2
      • FartCheese
        FartCheese @Larissa last edited by

        @lar1ssadu6u you can use inline code on the forums

        1 Reply Last reply Reply Quote 0
        • First post
          Last post