The thickness of the lines on the hitbox display F3+B varies depending on whether the F3 menu is open. When F3 is closed, the lines are noticeably thicker than when it is open. Other debug-related renderers, such as F3+G for chunk borders, also change the thickness. Sometimes, the width resets after the F3 menu is closed, and sometimes it stays at the smaller width.
This happens because the line thickness is not set when drawing the hitboxes; instead, the current thickness is used, which is smaller if F3 is open due to drawing the crosshair.
The specific code spots where this occurs are as follows (using MCP with 1.10.2 and 1.10.2 obfuscation):
The crosshair is rendered here:
net.minecraft.client.gui.GuiIngame.renderAttackIndicator(float, ScaledResolution) (bdm.a(float, bdp), lines 347-356)
if (gamesettings.showDebugInfo && !gamesettings.hideGUI && !this.mc.thePlayer.hasReducedDebug() && !gamesettings.reducedDebugInfo) {
GlStateManager.pushMatrix();
GlStateManager.translate((float)(l / 2), (float)(i1 / 2), this.zLevel);
Entity entity = this.mc.getRenderViewEntity();
GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_184045_1_, -1.0F, 0.0F, 0.0F);
GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_184045_1_, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(-1.0F, -1.0F, -1.0F);
OpenGlHelper.renderDirections(10);
GlStateManager.popMatrix();
}The specific rendering of the directions is here. Note the call to GL11.glLineWidth(1) at the end:
net.minecraft.client.renderer.OpenGlHelper.renderDirections(int) (caf.m(int), lines 787-809)
public static void renderDirections(int p_188785_0_) {
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
GL11.glLineWidth(4.0F);
vertexbuffer.begin(1, DefaultVertexFormats.POSITION_COLOR);
vertexbuffer.pos(0.0D, 0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos((double)p_188785_0_, 0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(0.0D, (double)p_188785_0_, 0.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, (double)p_188785_0_).color(0, 0, 0, 255).endVertex();
tessellator.draw();
GL11.glLineWidth(2.0F);
vertexbuffer.begin(1, DefaultVertexFormats.POSITION_COLOR);
vertexbuffer.pos(0.0D, 0.0D, 0.0D).color(255, 0, 0, 255).endVertex();
vertexbuffer.pos((double)p_188785_0_, 0.0D, 0.0D).color(255, 0, 0, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, 0.0D).color(0, 255, 0, 255).endVertex();
vertexbuffer.pos(0.0D, (double)p_188785_0_, 0.0D).color(0, 255, 0, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, 0.0D).color(127, 127, 255, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, (double)p_188785_0_).color(127, 127, 255, 255).endVertex();
tessellator.draw();
GL11.glLineWidth(1.0F);
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
}And the code that renders the bounding box is here. Note the lack of any code setting the line width:
net.minecraft.client.renderer.entity.RenderManager.renderDebugBoundingBox(Entity, double, double, double, float, float) (bsh.a(rw, double, double, double, float, float), lines 404-450)
/**
* Renders the bounding box around an entity when F3+B is pressed
*/
private void renderDebugBoundingBox(Entity entityIn, double x, double y, double z, float entityYaw, float partialTicks) {
GlStateManager.depthMask(false);
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.disableBlend();
float f = entityIn.width / 2.0F;
AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
RenderGlobal.func_189694_a(axisalignedbb.minX - entityIn.posX + x, axisalignedbb.minY - entityIn.posY + y, axisalignedbb.minZ - entityIn.posZ + z, axisalignedbb.maxX - entityIn.posX + x, axisalignedbb.maxY - entityIn.posY + y, axisalignedbb.maxZ - entityIn.posZ + z, 1.0F, 1.0F, 1.0F, 1.0F);
if (entityIn instanceof EntityLivingBase) {
float f1 = 0.01F;
RenderGlobal.func_189694_a(x - (double)f, y + (double)entityIn.getEyeHeight() - 0.009999999776482582D, z - (double)f, x + (double)f, y + (double)entityIn.getEyeHeight() + 0.009999999776482582D, z + (double)f, 1.0F, 0.0F, 0.0F, 1.0F);
}
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
Vec3d vec3d = entityIn.getLook(partialTicks);
vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
vertexbuffer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
vertexbuffer.pos(x + vec3d.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3d.yCoord * 2.0D, z + vec3d.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableCull();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
}This can be fixed by adding a call to GlStateManager.glLineWidth(1) (bob.d(1) - for thin lines) or GlStateManager.glLineWidth(2) (bob.d(2) - for thick lines) to renderDebugBoundingBox.
The thickness change does not happen when in third person (F5).
Attachments
Comments 3
Description updated to include code analysis and a more thorough explanation, plus increased searchability.
Confirmed for
15w47c Every time you look away from the Shulker the hitbox lines become thick again