Skip to content

Commit

Permalink
try fixing clipboard depth rendering (introduces new bugs)
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabeHunger54 committed Dec 19, 2024
1 parent e7152b0 commit c3fd255
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public final class ClipboardReadOnlyRenderer {
private static final ResourceLocation X_TEXTURE = BCUtil.modLoc("x");

public static void render(PoseStack pose, MultiBufferSource bufferSource, ClipboardContent data, int width, int height) {
pose.pushPose();
blit(pose, BACKGROUND, 0, 0, 0, 0, width, height, 256, 256);
pose.translate(0, 0, -0.01);
drawText(pose, bufferSource, data.title(), 29, 2, 72, 8);
ClipboardContent.Page page = data.pages().get(data.active());
for (int i = 0; i < ClipboardContent.MAX_LINES; i++) {
Expand All @@ -41,6 +43,7 @@ public static void render(PoseStack pose, MultiBufferSource bufferSource, Clipbo
}
drawText(pose, bufferSource, page.lines().get(i), 17, 15 * i + 16, 109, 8);
}
pose.popPose();
}

private static void drawText(PoseStack pose, MultiBufferSource bufferSource, String text, float x, float y, int width, int height) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.github.minecraftschurlimods.bibliocraft.client.ClipboardReadOnlyRenderer;
import com.github.minecraftschurlimods.bibliocraft.content.clipboard.ClipboardBlockEntity;
import com.github.minecraftschurlimods.bibliocraft.util.ClientUtil;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.renderer.MultiBufferSource;
Expand All @@ -11,6 +12,7 @@
public class ClipboardBER implements BlockEntityRenderer<ClipboardBlockEntity> {
@Override
public void render(ClipboardBlockEntity blockEntity, float partialTick, PoseStack stack, MultiBufferSource buffer, int light, int overlay) {
RenderSystem.enableDepthTest();
stack.pushPose();
ClientUtil.setupCenteredBER(stack, blockEntity);
stack.mulPose(Axis.XP.rotationDegrees(180));
Expand All @@ -20,5 +22,6 @@ public void render(ClipboardBlockEntity blockEntity, float partialTick, PoseStac
stack.scale(scale, scale, 0);
ClipboardReadOnlyRenderer.render(stack, buffer, blockEntity.getContent(), 128, 148);
stack.popPose();
RenderSystem.disableDepthTest();
}
}

0 comments on commit c3fd255

Please sign in to comment.