Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

In 1.18 I used this code, but it no longer works. Could you give me some hints or example from other mods source code? I know I can look into Minecraft source, but they use VertexFormat.Mode.LINES and vertex format with normal.

var tesselator = Tesselator.getInstance();
var buffer = tesselator.getBuilder();
buffer.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
buffer.vertex(x1, y1, z1).color(1f, 1f, 1f, 1f).endVertex();
buffer.vertex(x2, y2, z2).color(1f, 1f, 1f, 1f).endVertex();
buffer.end();
vertexBuffer.upload(buffer);

RenderSystem.depthMask(false);
RenderSystem.disableCull();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.disableTexture();
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(GL11.GL_DEPTH_TEST);

PoseStack poseStack = event.getPoseStack();
poseStack.pushPose();
poseStack.translate(-view.x, -view.y, -view.z);
var shader = GameRenderer.getPositionColorShader();
vertexBuffer.drawWithShader(poseStack.last().pose(), event.getProjectionMatrix().copy(), shader);
poseStack.popPose();

RenderSystem.depthMask(true);
RenderSystem.disableBlend();
RenderSystem.enableCull();
RenderSystem.enableTexture();

 

  • Author

Working code for 1.19:

 

Vec3 view = mc.gameRenderer.getMainCamera().getPosition();

RenderSystem.depthMask(false);
RenderSystem.disableCull();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.disableTexture();
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);

var tesselator = Tesselator.getInstance();
var buffer = tesselator.getBuilder();
buffer.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR);
buffer.vertex(0, 0, 0).color(1f, 1f, 1f, 1f).endVertex();
buffer.vertex(100, 200, 100).color(1f, 1f, 1f, 1f).endVertex();
vertexBuffer.bind();
vertexBuffer.upload(buffer.end());

PoseStack matrix = event.getPoseStack();
matrix.pushPose();
matrix.translate(-view.x, -view.y, -view.z);
var shader = GameRenderer.getPositionColorShader();
vertexBuffer.drawWithShader(matrix.last().pose(), event.getProjectionMatrix().copy(), shader);
matrix.popPose();

VertexBuffer.unbind();

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.