Jump to content

TopSnek

Members
  • Posts

    7
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TopSnek's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. After some research I've found RenderLevelStageEvent which fits my needs.
  2. I've found the solution. My problem(s) were an invalid translation + I called it inside the wrong event. Working code for 1.20.2: SubscribeEvent public static void onRenderLayerPost(RenderLevelStageEvent event) { Vec3 view = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition(); var tesselator = Tesselator.getInstance(); var buffer = tesselator.getBuilder(); VertexBuffer vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); buffer.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); buffer.vertex(0, 0, 0).color(1f, 1f, 1f, 1f).endVertex(); buffer.vertex(10, 10, 10).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(), shader); matrix.popPose(); VertexBuffer.unbind(); } Most of the code is from this post:
  3. As the title says. In the newer versions this event is not supported anymore. What are some decent alternatives? (I'm looking to draw lines in the world)
  4. Thanks, yes I did - it brought me to LevelRenderer.java, which has some great examples. I tried applying some of what Mojang did there, but without success. Here is my code: I try to plot a vertical line close to world coordinates 0, 0, 0 but cannot see it in game, "rendering" is being printed inside the console. I really don't know what I'm missing, I've been looking at code examples for days now - slowly it becomes a bit frustrating.
  5. Every other implementation I've found used BufferBuilder. I'm not sure if it would be a clean solution to project 3D line(s) that are bound to world coordinates to a 2D GUI. If you still suggest using IGuiOverlay for that I'll give it a try. This would also create problems when using the 3rd person cam (F5), because the ray could be theoretically be casted from the back of the player.
  6. I'd like to visualize a ray that I cast from a player. To archieve this, I need to be able to draw a line. Currently, I am using this code for testing purposes, but I cannot see any line drawn around x=0 y=0 z=0: @SubscribeEvent public static void onClientTick(TickEvent.ClientTickEvent event) { // Only call code once as the tick event is called twice every tick if (event.phase == TickEvent.Phase.END) { if(MEASUREMENT_MANAGER.isCurrentlyMeasuring()) { Tesselator tesselator = Tesselator.getInstance(); BufferBuilder bufferBuilder = tesselator.getBuilder(); Color c = new Color(1, 0, 0, 0.4f); bufferBuilder.begin(VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION_COLOR); bufferBuilder.vertex(0, 0, 0).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); bufferBuilder.vertex(0, 2, 2).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); tesselator.end(); } } } There have been many implementations in lower versions, but I could not find any for 1.20.2. What I've found, however, is this implementation on GitHub: https://github.com/cabaletta/baritone/blob/e183dcba1707c991fea1ba55be052dc3ee5d71a6/src/main/java/baritone/utils/IRenderer.java#L149 This also did not work for me. Any help would be appreciated.
  7. I am having a similar problem. Could you solve it?
×
×
  • Create New...

Important Information

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