Skip to content

Commit

Permalink
Preven JEI/REI/EMI from rendering in the keyboard screen
Browse files Browse the repository at this point in the history
  • Loading branch information
SirEndii committed Sep 30, 2024
1 parent e8f70d7 commit 1b147a3
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,23 @@ public KeyboardScreen(KeyboardContainer screenContainer, Inventory inv, Componen
}

@Override
public void render(@NotNull PoseStack matrixStack, int x, int y, float partialTicks) {
public void render(@NotNull PoseStack poseStack, int x, int y, float partialTicks) {
Minecraft minecraft = Minecraft.getInstance();
float scale = 2f;
int screenWidth = minecraft.getWindow().getGuiScaledWidth();
int screenHeight = minecraft.getWindow().getGuiScaledHeight();
// Make the text a bit smaller on small screens
if (screenWidth <= 1080)
scale = 1f;

matrixStack.scale(scale, scale, 1);
poseStack.scale(scale, scale, 1);
String text = "Press ESC to close the Keyboard Screen.";
float textX = (screenWidth / 2f - minecraft.font.width(text) * scale / 2f) / scale;
minecraft.font.drawShadow(matrixStack, text, textX, 1, 0xFFFFFF);
minecraft.font.drawShadow(poseStack, text, textX, 1, 0xFFFFFF);

// Prevents JEI/REI/EMI from rendering. Maybe not the best way, but it works for now.
poseStack.scale(4f, 4f, 1);
minecraft.font.draw(poseStack, "", screenWidth, screenHeight, 0xFFFFFF);
}

@Override
Expand Down

0 comments on commit 1b147a3

Please sign in to comment.