Navigation

    CCBlueX Forum

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

    NCP target hud

    Scripts
    18
    39
    1121
    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.
    • skidma
      skidma last edited by skidma

      yes the code with the animation was ctrl + v from the lb code:axocooler: :axocooler:
      the design was also copied from flux
      im bad at opengl

      About

      The size of TargetHud depends on the width of the target name

      Changelog

      [25-02-2021]

      • Optimized code
      • Removed unnecessary code
      • Slightly redesigned color and changed code

      [26-02-2021]

      • Some code has been reworked
      • Now if the target has no armor, the armor line will not be rendered

      Showcase

      2021-02-25_13.30.09.png

      Code

      var RenderUtils = Java.type('net.ccbluex.liquidbounce.utils.render.RenderUtils');
      var ScaledResolution = Java.type('net.minecraft.client.gui.ScaledResolution');
      var EntityPlayer = Java.type('net.minecraft.entity.player.EntityPlayer');
      var Gui = Java.type('net.minecraft.client.gui.Gui');
      var GL11 = Java.type('org.lwjgl.opengl.GL11');
      var Color = Java.type('java.awt.Color');
      
      var Fonts = Java.type('net.ccbluex.liquidbounce.ui.font.Fonts');
      var fonts = Fonts.getFonts();
      var font = undefined;
      
      var easingHealth = 0;
      function drawHead(skin, width, height) {
          GL11.glColor4f(1, 1, 1, 1);
          mc.getTextureManager().bindTexture(skin);
          Gui.drawScaledCustomSizeModalRect(width, height, 8, 8, 8, 8, 16, 16, 64, 64);
      }
      function drawRect(paramXStart, paramYStart, paramXEnd, paramYEnd, color) {
          var alpha = (color >> 24 & 0xFF) / 255;
          var red = (color >> 16 & 0xFF) / 255;
          var green = (color >> 8 & 0xFF) / 255;
          var blue = (color & 0xFF) / 255;
      
          GL11.glEnable(GL11.GL_BLEND);
          GL11.glDisable(GL11.GL_TEXTURE_2D);
          GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
          GL11.glEnable(GL11.GL_LINE_SMOOTH);
      
          GL11.glPushMatrix();
          GL11.glColor4f(red, green, blue, alpha);
          GL11.glBegin(GL11.GL_TRIANGLE_FAN);
          GL11.glVertex2d(paramXEnd, paramYStart);
          GL11.glVertex2d(paramXStart, paramYStart);
          GL11.glVertex2d(paramXStart, paramYEnd);
          GL11.glVertex2d(paramXEnd, paramYEnd);
      
          GL11.glEnd();
          GL11.glPopMatrix();
      
          GL11.glEnable(GL11.GL_TEXTURE_2D);
          GL11.glDisable(GL11.GL_BLEND);
          GL11.glDisable(GL11.GL_LINE_SMOOTH);
      
          GL11.glColor4f(1, 1, 1, 1);
      }
      function getScaledWidth() {
          var scaledWidth = new ScaledResolution(mc).getScaledWidth();
          return scaledWidth;
      }
      function getScaledHeight() {
          var scaledHeight = new ScaledResolution(mc).getScaledHeight();
          return scaledHeight;
      }
      var script = registerScript({
          name: 'TargetInfo',
          version: '0.0.3',
          authors: ['Shurpe']
      });
      script.registerModule({
          name: 'TargetInfo',
          description: '',
          category: 'Fun',
          settings: {
              fadeTime: Setting.integer({
                  name: 'FadeTime',
                  default: 25,
                  min: 10,
                  max: 50
              }),
              fadeDist: Setting.integer({
                  name: 'FadeDistance',
                  default: 3,
                  min: 3,
                  max: 10
              }),
              fontIndex: Setting.integer({
                  name: 'Font',
                  default: 0,
                  min: 0,
                  max: fonts.length - 1
              })
          }
      }, function (module) {
          module.on('render2D', function () {
              if (target != null) {
                  GL11.glPushMatrix();
                  GL11.glTranslated(mcWidth / 2 + 10, mcHeight / 2, mcWidth / 2 + 10); // Pos
      
                  drawRect(-2, 34, 2 + width, target.getTotalArmorValue() != 0 ? 66 : 60, new Color(35, 35, 40, 230).getRGB()); // Draw background
                  font.drawString(target.getName(), 20, 40, 0xFFFFFF); // Draw target name
                  drawHead(mc.getNetHandler().getPlayerInfo(target.getUniqueID()).getLocationSkin(), 0, 36); // Draw target head
      
                  drawRect(0, 56, width, 58, new Color(25, 25, 35, 255).getRGB()); // Draw health bar background
      
                  easingHealth += ((target.getHealth() - easingHealth) / Math.pow(2, 10.0 - 3)) * RenderUtils.deltaTime;
                  if (easingHealth < 0 || easingHealth > target.getMaxHealth()) {
                      easingHealth = target.getHealth();
                  }
                  if (easingHealth > target.getHealth()) {
                      drawRect(0, 56, (easingHealth / target.getMaxHealth()) * width, 58, new Color(231, 182, 0, 255).getRGB());
                  } // Damage animation
                  if (easingHealth < target.getHealth()) {
                      drawRect((easingHealth / target.getMaxHealth()) * width, 56, (easingHealth / target.getMaxHealth()) * width, 58, new Color(231, 182, 0, 255).getRGB());
                  } // Heal animation
      
                  drawRect(0, 56, (target.getHealth() / target.getMaxHealth()) * width, 58, new Color(0, 224, 84, 255).getRGB()); // Draw health bar
                  
                  if (target.getTotalArmorValue() != 0) {
                      drawRect(0, 62, width, 64, new Color(25, 25, 35, 255).getRGB()); // Draw armor bar background
                      drawRect(0, 62, (target.getTotalArmorValue() / 20) * width, 64, new Color(77, 128, 255, 255).getRGB()); // Draw armor bar
                  }
      
                  GL11.glPopMatrix();
              }
          });
          module.on('update', function () {
              if (target != null) {
                  if (target.getHealth() > 1024 || isNaN(target.getHealth()) || target.getHealth() <= 0 || fadeTimer >= module.settings.fadeTime.get() || mc.thePlayer.getDistanceToEntity(target).toFixed() >= module.settings.fadeDist.get()) {
                      target = null;
                  } else {
                      fadeTimer++;
      
                      mcWidth = getScaledWidth(); mcHeight = getScaledHeight();
                      font = fonts[module.settings.fontIndex.get()];
                      width = 20 + font.getStringWidth(target.getName());
                  }
              } else {
                  fadeTimer = null;
              }
          });
          module.on('attack', function(e) {
              if (e.getTargetEntity() instanceof EntityPlayer) {
                  target = e.getTargetEntity(); fadeTimer = 0;
              }
          });
          module.on('disable', function() {
              target = undefined;
              fadeTimer = null;
          });
      });
      
      A G Legrand Dev Mustish M 5 Replies Last reply Reply Quote 0
      • I
        idkmyname last edited by

        nice flux paste :)))))))))))))))))))))) :axodrugs: :axodrugs: :axocooler: :axocooler: :axocooler: :axocooler:

        skidma 1 Reply Last reply Reply Quote 0
        • A
          Aftery @skidma last edited by

          @skidma does it support multitarget

          skidma 1 Reply Last reply Reply Quote 0
          • skidma
            skidma @Aftery last edited by

            @aftery no multitarget:axocooler:

            1 Reply Last reply Reply Quote 0
            • skidma
              skidma @idkmyname last edited by

              @idkmyname ezzzzz ctrl v:axocooler: :axofast: :axofast:

              IdkWhoMe_fake 1 Reply Last reply Reply Quote 0
              • G
                Gabriel @skidma last edited by

                @skidma

                Introduction

                You should've put it in HUD Elements (LiquidBounce Source Code)
                This would allow the community to improve the code, and to improve liquidbounce itself. Scripts don't do much.

                skidma 1 Reply Last reply Reply Quote 0
                • Legrand Dev
                  Legrand Dev @skidma last edited by

                  @skidma skidding for life

                  1 Reply Last reply Reply Quote 0
                  • skidma
                    skidma @Gabriel last edited by

                    @gabriel I dont know how to import liquidbounce into ide

                    G 1 Reply Last reply Reply Quote 0
                    • G
                      Gabriel @skidma last edited by

                      @skidma Skid your target hud to https://forums.ccbluex.net/topic/1286/kotlin-targethud, great base to do the same, cause both are similar.

                      skidma M 2 Replies Last reply Reply Quote 0
                      • skidma
                        skidma @Gabriel last edited by

                        @gabriel lazy moment:axocooler:

                        1 Reply Last reply Reply Quote 0
                        • M
                          mems @Gabriel last edited by

                          @gabriel said in NCP target hud:

                          @skidma Skid your target hud to https://forums.ccbluex.net/topic/1286/kotlin-targethud, great base to do the same, cause both are similar.

                          ye, wanna add this target hud too to your liquidbounce mr gabriel? thank god mr skidma here responded in a nice way of saying no, f you do it urself

                          G 1 Reply Last reply Reply Quote 0
                          • G
                            Gabriel @mems last edited by

                            @mems

                            Introduction

                            Yes, i'm working on trying to port it.

                            Conclusion

                            I'm not good at coding, but i will try.
                            I'm not sure its possible though.

                            M 1 Reply Last reply Reply Quote 0
                            • M
                              mems @Gabriel last edited by

                              @gabriel

                              Introduction

                              Yes, I'm trying to make you get off your lazy ass and start doing this kind of stuff yourself. You literally have the code on your hands.

                              Conclusion

                              It's not working out, yet I will try.
                              Probably you will never listen.

                              G 1 Reply Last reply Reply Quote 0
                              • G
                                Gabriel @mems last edited by

                                @mems

                                Introduction

                                I'm not lazy, how can i try to port this TargetHUD script to a HUD element, while trying to find out how to create fly modes also while creating speed modes?

                                Conclusion

                                I cannot code alot of stuff at the same time, im not lazy at all.

                                M 1 Reply Last reply Reply Quote 0
                                • M
                                  mems @Gabriel last edited by

                                  @gabriel

                                  Introduction

                                  Stick to single tasking. Prioritize the thing you REALLY want to add over the rest.

                                  Conclusion

                                  Probably you won't, leading to inability to finish any task.

                                  G 1 Reply Last reply Reply Quote 0
                                  • G
                                    Gabriel @mems last edited by

                                    @mems

                                    Introduction

                                    I'm used to multi-tasking in real life, so its wierd that it's not working.

                                    Conclusion

                                    We also need to stop talking like that.

                                    M 1 Reply Last reply Reply Quote 0
                                    • M
                                      mems @Gabriel last edited by

                                      @gabriel

                                      Introduction

                                      But sometimes, you gotta make some changes when it comes to coding stuff you start months ago, if not years.

                                      Conclusion

                                      I can do this all day, but once you stop talking like that first, I will too.

                                      1 Reply Last reply Reply Quote 0
                                      • IdkWhoMe_fake
                                        IdkWhoMe_fake @skidma last edited by

                                        @skidma the best :axocooler: :axocooler: :axocooler: :axocooler: :axodance: :axodance: :axodance: :axoeater: :axoeater: :axofast: :axofast: :axofast:

                                        1 Reply Last reply Reply Quote 0
                                        • A
                                          Aftery last edited by Aftery

                                          before making a request, consider the following:

                                          can you do it

                                          is it in the wrong place

                                          is it googlable

                                          is the source code not very complicated

                                          if you meet any of these conditions you should not make a request

                                          1 Reply Last reply Reply Quote 0
                                          • yorik100
                                            yorik100 last edited by

                                            Does it bypass AGC????

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Powered by NodeBB | Contributors