Skip to content

Commit

Permalink
Revert changes to PocketItemRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
SquidDev committed Feb 13, 2025
1 parent 922a499 commit 6801a49
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@ private PocketItemRenderer() {

@Override
protected void renderItem(PoseStack transform, MultiBufferSource bufferSource, ItemStack stack, int light) {
// Setup various transformations. Note that these are partially adapted from the corresponding method
// in ItemRenderer
transform.pushPose();
transform.mulPose(Axis.YP.rotationDegrees(180f));
transform.mulPose(Axis.ZP.rotationDegrees(180f));
transform.scale(0.5f, 0.5f, 0.5f);

render(transform, bufferSource, stack, light);

transform.popPose();
}

public static void render(PoseStack transform, MultiBufferSource bufferSource, ItemStack stack, int light) {
var computer = ClientPocketComputers.get(stack);
var terminal = computer == null ? null : computer.getTerminal();

Expand All @@ -61,6 +48,13 @@ public static void render(PoseStack transform, MultiBufferSource bufferSource, I
var width = termWidth * FONT_WIDTH + MARGIN * 2;
var height = termHeight * FONT_HEIGHT + MARGIN * 2;

// Setup various transformations. Note that these are partially adapted from the corresponding method
// in ItemRenderer
transform.pushPose();
transform.mulPose(Axis.YP.rotationDegrees(180f));
transform.mulPose(Axis.ZP.rotationDegrees(180f));
transform.scale(0.5f, 0.5f, 0.5f);

var scale = 0.75f / Math.max(width + BORDER * 2, height + BORDER * 2 + LIGHT_HEIGHT);
transform.scale(scale, scale, -1.0f);
transform.translate(-0.5 * width, -0.5 * height, 0);
Expand All @@ -83,6 +77,8 @@ public static void render(PoseStack transform, MultiBufferSource bufferSource, I
} else {
FixedWidthFontRenderer.drawTerminal(quadEmitter, MARGIN, MARGIN, terminal, MARGIN, MARGIN, MARGIN, MARGIN);
}

transform.popPose();
}

private static void renderFrame(Matrix4f transform, MultiBufferSource render, ComputerFamily family, int colour, int light, int width, int height) {
Expand Down

0 comments on commit 6801a49

Please sign in to comment.