Merge pull request #3991 from ZacSharp/pr/guiclick/fixSelectionPreview

Fix `GuiClick` not rendering the outline of the selection being made
This commit is contained in:
leijurv
2023-06-16 20:29:25 -07:00
committed by GitHub
2 changed files with 4 additions and 14 deletions

View File

@@ -117,21 +117,11 @@ public class GuiClick extends GuiScreen {
// drawSingleSelectionBox WHEN?
PathRenderer.drawManySelectionBoxes(e, Collections.singletonList(currentMouseOver), Color.CYAN);
if (clickStart != null && !clickStart.equals(currentMouseOver)) {
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
GlStateManager.color(Color.RED.getColorComponents(null)[0], Color.RED.getColorComponents(null)[1], Color.RED.getColorComponents(null)[2], 0.4F);
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidthPixels.value);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
GlStateManager.disableDepth();
IRenderer.startLines(Color.RED, Baritone.settings().pathRenderLineWidthPixels.value, true);
BetterBlockPos a = new BetterBlockPos(currentMouseOver);
BetterBlockPos b = new BetterBlockPos(clickStart);
IRenderer.drawAABB(new AxisAlignedBB(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z), Math.max(a.x, b.x) + 1, Math.max(a.y, b.y) + 1, Math.max(a.z, b.z) + 1));
GlStateManager.enableDepth();
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
IRenderer.emitAABB(new AxisAlignedBB(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z), Math.max(a.x, b.x) + 1, Math.max(a.y, b.y) + 1, Math.max(a.z, b.z) + 1));
IRenderer.endLines(true);
}
}
}

View File

@@ -116,7 +116,7 @@ public interface IRenderer {
}
static void drawAABB(AxisAlignedBB aabb) {
buffer.begin(GL_LINES, DefaultVertexFormats.POSITION);
buffer.begin(GL_LINES, DefaultVertexFormats.POSITION_COLOR);
emitAABB(aabb);
tessellator.draw();
}