Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

LiquidBounce Forum

  1. Home
  2. Kotlin/Java
  3. A dynamic Crosshair and Add method.

A dynamic Crosshair and Add method.

Scheduled Pinned Locked Moved Kotlin/Java
4 Posts 3 Posters 483 Views
  • 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.
  • LarissaL Offline
    LarissaL Offline
    Larissa
    wrote on last edited by Larissa
    #1

    English: I think the original version of Minecraft is not very good-looking, so I wrote a new crosshair and I will tell you the complete adding method.
    Chinese: 我认为mc原版的指针不是很好看,所以我写了一个新的crosshair并且我会告诉你完整的添加方法.

    First,you should add these to the Renderutils.
    首先,你需要添加这些进入显示工具包.

    
    public static int width() {
            return new ScaledResolution(Minecraft.getMinecraft()).getScaledWidth();
        }
        public static int height() {
            return new ScaledResolution(Minecraft.getMinecraft()).getScaledHeight();
        }
    
    

    Then,add the method called showcrosshair to the mixinguiingame.
    然后,添加展示指针的方法在mixinguiingame中.

    
    @Overwrite
        protected boolean showCrosshair() {
            Minecraft mc = Minecraft.getMinecraft();
            if (mc.gameSettings.showDebugInfo && !mc.thePlayer.hasReducedDebug()
                    && !mc.gameSettings.reducedDebugInfo) {
                return false;
            } else if (mc.playerController.isSpectator()) {
                if (mc.pointedEntity != null) {
                    return true;
                } else {
                    if (mc.objectMouseOver != null
                            && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
                        BlockPos blockpos = mc.objectMouseOver.getBlockPos();
    
                        return mc.theWorld.getTileEntity(blockpos) instanceof IInventory;
                    }
                    return false;
                }
    
            }
            return !LiquidBounce.moduleManager.getModule(HUD.class).getState();
        }
    
    

    Finally,add the codes into the Module:HUD.
    最后,添加代码进入模块:HUD.

    
    @EventTarget
        public void drawRender2D(Render2DEvent render2DEvent){
            int lrs1 = RenderUtils.width();
            int lrs2 = RenderUtils.height();
            if (!mc.thePlayer.isSprinting()) {
                Gui.drawRect(lrs1 / 2 - 3 - 3, lrs2 / 2, lrs1 / 2 + 6 - 8, lrs2 / 2 + 2 - 1, new Color(255,255,255, 255).getRGB());
                RenderUtils.drawBorderedRect(lrs1 / 2 - 6, lrs2 / 2, lrs1 / 2 - 2, lrs2 / 2 + 1,0.7582394175F, new Color(0,0,0,255).getRGB(), new Color(255, 190, 255, 0).getRGB());
                Gui.drawRect(lrs1 / 2 + 6 - 3, lrs2 / 2, lrs1 / 2 + 10 - 3, lrs2 / 2 + 1, new Color(255,255,255, 255).getRGB());
                RenderUtils.drawBorderedRect(lrs1 / 2 + 3, lrs2 / 2, lrs1 / 2 + 7, lrs2 / 2 + 1,0.7635230967F, new Color(0,0,0,255).getRGB(), new Color(255, 190, 255, 0).getRGB());
                Gui.drawRect(lrs1 / 2, lrs2 / 2 - 6, lrs1 / 2 + 1, lrs2 / 2 - 2, new Color(255,255,255, 255).getRGB());
                RenderUtils.drawBorderedRect(lrs1 / 2 + 1 - 1, lrs2 / 2 - 6, lrs1 / 2 + 1, lrs2 / 2 - 2,0.7572856197F, new Color(0,0,0,255).getRGB(), new Color(255, 190, 255, 0).getRGB());
                Gui.drawRect(lrs1 / 2, lrs2 / 2 + 6 - 3, lrs1 / 2 + 1, lrs2 / 2 + 7, new Color(255,255,255, 255).getRGB());
                RenderUtils.drawBorderedRect(lrs1 / 2, lrs2 / 2 + 6 - 3, lrs1 / 2 + 1, lrs2 / 2 + 10 - 3,0.7543869547F, new Color(0,0,0,255).getRGB(), new Color(255, 190, 255, 0).getRGB());
                Gui.drawRect(lrs1 / 2, lrs2 / 2, lrs1 / 2 + 1, lrs2 / 2 + 1, new Color(255,255,255, 255).getRGB());
                RenderUtils.drawBorderedRect(lrs1 / 2, lrs2 / 2, lrs1 / 2 + 1, lrs2 / 2 + 1,0.7543869547F, new Color(0,0,0,255).getRGB(), new Color(255, 190, 255, 0).getRGB());
            } else {
                Gui.drawRect(lrs1 / 2 + 10 - 19, lrs2 / 2, lrs1 / 2 + 5 - 10, lrs2 / 2 + 1, new Color(255,255,255, 255).getRGB());
                RenderUtils.drawBorderedRect(lrs1 / 2 - 9, lrs2 / 2, lrs1 / 2 - 5, lrs2 / 2 + 1,0.7582394175F, new Color(0,0,0,255).getRGB(), new Color(255, 190, 255, 0).getRGB());
                Gui.drawRect(lrs1 / 2 + 6, lrs2 / 2, lrs1 / 2 + 10, lrs2 / 2 + 1, new Color(255,255,255, 255).getRGB());
                RenderUtils.drawBorderedRect(lrs1 / 2 + 6, lrs2 / 2, lrs1 / 2 + 5 + 5, lrs2 / 2 + 1,0.7635230967F, new Color(0,0,0,255).getRGB(), new Color(255, 190, 255, 0).getRGB());
                Gui.drawRect(lrs1 / 2, lrs2 / 2 - 9, lrs1 / 2 + 1, lrs2 / 2 - 5, new Color(255,255,255, 255).getRGB());
                RenderUtils.drawBorderedRect(lrs1 / 2, lrs2 / 2 - 9, lrs1 / 2 + 1, lrs2 / 2 - 5,0.7572856197F, new Color(0,0,0,255).getRGB(), new Color(255, 190, 255, 0).getRGB());
                Gui.drawRect(lrs1 / 2, lrs2 / 2 + 2 + 4, lrs1 / 2 + 1, lrs2 / 2 + 10, new Color(255,255,255, 255).getRGB());
                RenderUtils.drawBorderedRect(lrs1 / 2, lrs2 / 2 + 3 + 3, lrs1 / 2 + 1, lrs2 / 2 + 3 + 7,0.7543869547F, new Color(0,0,0,255).getRGB(), new Color(255, 190, 255, 0).getRGB());
                Gui.drawRect(lrs1 / 2, lrs2 / 2, lrs1 / 2 + 1, lrs2 / 2 + 1, new Color(255,255,255, 255).getRGB());
                RenderUtils.drawBorderedRect(lrs1 / 2, lrs2 / 2, lrs1 / 2 + 1, lrs2 / 2 + 1,0.7543869547F, new Color(0,0,0,255).getRGB(), new Color(255, 190, 255, 0).getRGB());
            }
        }
    
    

    and this is the ending picture,welcome to use!

    when slient or sprinting
    当静止时和疾跑时

    DC51617C-1275-444F-9713-C163943EE284.jpeg 2FB394E3-E465-41B3-AF87-4405308D09BA.jpeg

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Aftery
      wrote on last edited by
      #2
      This post is deleted!
      Ali00035A LarissaL 2 Replies Last reply
      2
      • A Aftery

        This post is deleted!

        Ali00035A Offline
        Ali00035A Offline
        Ali00035
        wrote on last edited by
        #3

        @aftery At least we all can agree that it's better than the normal mc crosshair.

        1 Reply Last reply
        1
        • A Aftery

          This post is deleted!

          LarissaL Offline
          LarissaL Offline
          Larissa
          wrote on last edited by
          #4

          @aftery said in A dynamic Crosshair and Add method.:

          looks very complicated for something that looks worse than the 1.6 crosshair, nice release though

          Thank you, maybe I will improve it in the future!😊

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          About
          • Terms of Service
          • Privacy Policy
          • Status
          • Contact Us
          Downloads
          • Releases
          • Source code
          • License
          Docs
          • Tutorials
          • CustomHUD
          • AutoSettings
          • ScriptAPI
          Community
          • Forum
          • Guilded
          • YouTube
          • Twitter
          • D.Tube
          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups