Skip to content

Commit 949146c

Browse files
committed
Fix debug line rendering
1 parent 3bd5723 commit 949146c

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

src/main/java/net/earthcomputer/clientcommands/command/WaypointCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ private static void renderWaypointBoxes(WorldRenderContext context) {
405405
stack.translate(cameraPosition.scale(-1));
406406

407407
AABB box = new AABB(waypointLocation);
408-
ShapeRenderer.renderLineBox(stack, context.consumers().getBuffer(RenderQueue.NO_DEPTH_LAYER), box, 1, 1, 1, 1);
408+
ShapeRenderer.renderLineBox(stack, context.consumers().getBuffer(RenderQueue.LINES_NO_DEPTH_LAYER), box, 1, 1, 1, 1);
409409

410410
stack.translate(waypointLocation.getCenter().add(new Vec3(0, 1, 0)));
411411
stack.mulPose(context.camera().rotation());

src/main/java/net/earthcomputer/clientcommands/render/RenderQueue.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,16 @@ public class RenderQueue {
3030
private static final List<RemoveQueueEntry> removeQueue = new ArrayList<>();
3131
private static final EnumMap<Layer, Map<Object, Shape>> queue = new EnumMap<>(Layer.class);
3232

33-
private static final RenderPipeline NO_DEPTH_PIPELINE = RenderPipeline.builder(RenderPipelines.MATRICES_COLOR_SNIPPET)
34-
.withLocation(ResourceLocation.fromNamespaceAndPath("clientcommands", "pipeline/no_depth"))
35-
.withVertexShader("core/position_color")
36-
.withFragmentShader("core/position_color")
37-
.withCull(false)
38-
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
39-
.withVertexFormat(DefaultVertexFormat.POSITION_COLOR, VertexFormat.Mode.DEBUG_LINE_STRIP)
40-
.build();
41-
public static final RenderType NO_DEPTH_LAYER = RenderType.create("clientcommands_no_depth", 3 * 512, NO_DEPTH_PIPELINE, RenderType.CompositeState.builder()
33+
private static final RenderPipeline LINES_NO_DEPTH_PIPELINE = RenderPipelines.register(
34+
RenderPipeline.builder(RenderPipelines.LINES_SNIPPET)
35+
.withLocation(ResourceLocation.fromNamespaceAndPath("clientcommands", "pipeline/lines_no_depth"))
36+
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
37+
.build()
38+
);
39+
public static final RenderType LINES_NO_DEPTH_LAYER = RenderType.create("clientcommands_no_depth", 3 * 512, LINES_NO_DEPTH_PIPELINE, RenderType.CompositeState.builder()
4240
.setLayeringState(RenderType.VIEW_OFFSET_Z_LAYERING)
4341
.setLineState(new RenderType.LineStateShard(OptionalDouble.of(Line.THICKNESS)))
44-
.createCompositeState(true));
42+
.createCompositeState(false));
4543

4644
static {
4745
ClientTickEvents.START_CLIENT_TICK.register(RenderQueue::tick);
@@ -50,12 +48,10 @@ public class RenderQueue {
5048

5149
Vec3 cameraPos = context.camera().getPosition();
5250
context.matrixStack().translate(-cameraPos.x, -cameraPos.y, -cameraPos.z);
53-
RenderQueue.render(RenderQueue.Layer.ON_TOP, Objects.requireNonNull(context.consumers()).getBuffer(RenderQueue.NO_DEPTH_LAYER), context.matrixStack(), context.tickCounter().getRealtimeDeltaTicks());
51+
RenderQueue.render(RenderQueue.Layer.ON_TOP, Objects.requireNonNull(context.consumers()).getBuffer(RenderQueue.LINES_NO_DEPTH_LAYER), context.matrixStack(), context.tickCounter().getRealtimeDeltaTicks());
5452

5553
context.matrixStack().popPose();
5654
});
57-
58-
RenderPipelines.register(NO_DEPTH_PIPELINE);
5955
}
6056

6157
public static void register() {

src/main/resources/clientcommands.aw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ accessible field net/minecraft/client/OptionInstance value Ljava/lang/Object;
4747
accessible field net/minecraft/client/gui/components/EditBox maxLength I
4848

4949
# Render Queue
50-
accessible field net/minecraft/client/renderer/RenderPipelines MATRICES_COLOR_SNIPPET Lcom/mojang/blaze3d/pipeline/RenderPipeline$Snippet;
50+
accessible field net/minecraft/client/renderer/RenderPipelines LINES_SNIPPET Lcom/mojang/blaze3d/pipeline/RenderPipeline$Snippet;
5151
accessible method net/minecraft/client/renderer/RenderPipelines register (Lcom/mojang/blaze3d/pipeline/RenderPipeline;)Lcom/mojang/blaze3d/pipeline/RenderPipeline;
5252
accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder createCompositeState (Z)Lnet/minecraft/client/renderer/RenderType$CompositeState;
5353
accessible method net/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder setLayeringState (Lnet/minecraft/client/renderer/RenderStateShard$LayeringStateShard;)Lnet/minecraft/client/renderer/RenderType$CompositeState$CompositeStateBuilder;

0 commit comments

Comments
 (0)