-
[Solved] [1.20.2] Is there an alternative to RenderWorldLastEvent?
After some research I've found RenderLevelStageEvent which fits my needs.
-
[Solved] [1.20.2] How do I draw a line using BufferBuilder and Tesselator?
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:
-
[Solved] [1.20.2] Is there an alternative to RenderWorldLastEvent?
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)
-
[Solved] [1.20.2] How do I draw a line using BufferBuilder and Tesselator?
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.
-
[Solved] [1.20.2] How do I draw a line using BufferBuilder and Tesselator?
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.
-
[Solved] [1.20.2] How do I draw a line using BufferBuilder and Tesselator?
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.
-
[1.20]How to use Tesselator for line drawing
I am having a similar problem. Could you solve it?
IPS spam blocked by CleanTalk.