From 1a5d29ec80508226df942746e6629d1f276c57be Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Mon, 21 Dec 2020 18:36:37 +0200 Subject: (Hackily) Fix bug with REI overlapping with LibGui screens --- .../cottonmc/cotton/gui/client/CottonInventoryScreen.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java index 6ae53d0..370bb68 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java @@ -97,8 +97,12 @@ public class CottonInventoryScreen extends Handl clearPeers(); basePanel.validate(description); - backgroundWidth = basePanel.getWidth(); - backgroundHeight = basePanel.getHeight(); + // This is needed for REI; otherwise it'll overlap. + // 8 = the padding of BackgroundPainter.VANILLA + int padding = 2 * 8; // TODO: This is awful and bad and should be removed ASAP + + backgroundWidth = basePanel.getWidth() + padding; + backgroundHeight = basePanel.getHeight() + padding; //DEBUG if (backgroundWidth<16) backgroundWidth=300; @@ -106,8 +110,8 @@ public class CottonInventoryScreen extends Handl } if (!description.isFullscreen()) { - x = (width / 2) - (backgroundWidth / 2); - y = (height / 2) - (backgroundHeight / 2); + x = (screenWidth / 2) - (backgroundWidth / 2); + y = (screenHeight / 2) - (backgroundHeight / 2); titleX = 0; titleY = 0; } else { -- cgit From 110a4db9f8c0530b8778e7290962b453e03b0bc1 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Mon, 21 Dec 2020 20:45:07 +0200 Subject: Fix large slot focus border position --- .../java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java b/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java index 4789271..f00bf80 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java @@ -56,8 +56,8 @@ public interface BackgroundPainter { ScreenDrawing.drawBeveledPanel((x * 18) + left - 4, (y * 18) + top - 4, 26, 26, lo, bg, hi); if (slot.getFocusedSlot() == index) { - int sx = (x * 18) + left - 3; - int sy = (y * 18) + top - 3; + int sx = (x * 18) + left - 4; + int sy = (y * 18) + top - 4; ScreenDrawing.coloredRect(sx, sy, 26, 1, 0xFF_FFFFA0); ScreenDrawing.coloredRect(sx, sy + 1, 1, 26 - 1, 0xFF_FFFFA0); ScreenDrawing.coloredRect(sx + 26 - 1, sy + 1, 1, 26 - 1, 0xFF_FFFFA0); -- cgit