Jump to content

[1.15.2][solved] Render through blocks


Ravenwolf397

Recommended Posts

I am making an "echolocation" helmet that shows wireframes around specific nearby blocks when you wear it (mostly ores).  I have the helmet detection code, but when I render wireframes they are obscured by the intervening blocks (I want them visible through those blocks).

 

I tried using both `RenderSystem` and `GlStateManager`'s methods `disableDepthTest` and `disableCull`, in all combinations, but none of them produce this effect.  How can I make my changes visible on top of everything else?

 

Code:

@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event) {
    // only run if wearing helmet
    // if (!echolocation_active) return;
    ActiveRenderInfo renderInfo = Minecraft.getInstance().gameRenderer.getActiveRenderInfo();
    Vector3d pv = renderInfo.getProjectedView();
    double x = pv.getX(), y = pv.getY(), z = pv.getZ();
    IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
    IVertexBuilder builder = buffer.getBuffer(RenderType.LINES);
    MatrixStack matrixStack = event.getMatrixStack();
    matrixStack.push();
    matrixStack.translate(-x, -y, -z);
		
    // disable depth here, somehow

    // for debugging: put wireframe around 0,0,0
    WorldRenderer.drawBoundingBox(matrixStack, builder, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1);

    buffer.finish(RenderType.LINES);
    matrixStack.pop();
}

 

Edited by Ravenwolf397
clarity
Link to comment
Share on other sites

  • Ravenwolf397 changed the title to [1.15.2][solved] Render through blocks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.