aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-10-18 20:19:39 +0200
committerLinnea Gräf <nea@nea.moe>2024-10-18 20:19:39 +0200
commit850d42dbcacda72b81a3cc00e3e79a7b8614a987 (patch)
treeb79f5df5d477bab38960c423c1db28ff1220363a
parent2c9335df2ef33b55226efd981cf64483a62f04be (diff)
downloadFirmament-850d42dbcacda72b81a3cc00e3e79a7b8614a987.tar.gz
Firmament-850d42dbcacda72b81a3cc00e3e79a7b8614a987.tar.bz2
Firmament-850d42dbcacda72b81a3cc00e3e79a7b8614a987.zip
Fix edit backpacks in /firm storage sometimes not resizing the screen properly
-rw-r--r--src/main/java/moe/nea/firmament/mixins/customgui/PatchHandledScreen.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/customgui/PatchHandledScreen.java b/src/main/java/moe/nea/firmament/mixins/customgui/PatchHandledScreen.java
index 61fdcf8..deac0a4 100644
--- a/src/main/java/moe/nea/firmament/mixins/customgui/PatchHandledScreen.java
+++ b/src/main/java/moe/nea/firmament/mixins/customgui/PatchHandledScreen.java
@@ -34,10 +34,18 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
protected int x;
@Shadow
protected int y;
+ @Shadow
+ protected int backgroundHeight;
+ @Shadow
+ protected int backgroundWidth;
@Unique
public CustomGui override;
@Unique
public boolean hasRememberedSlots = false;
+ @Unique
+ private int originalBackgroundWidth;
+ @Unique
+ private int originalBackgroundHeight;
protected PatchHandledScreen(Text title) {
super(title);
@@ -51,6 +59,14 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
@Override
public void setCustomGui_Firmament(@Nullable CustomGui gui) {
+ if (this.override != null) {
+ backgroundHeight = originalBackgroundHeight;
+ backgroundWidth = originalBackgroundWidth;
+ }
+ if (gui != null) {
+ originalBackgroundHeight = backgroundHeight;
+ originalBackgroundWidth = backgroundWidth;
+ }
this.override = gui;
}