A dynamic Crosshair and Add method.
-
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
当静止时和疾跑时