From 9e2be9625af9923dd37c1ac8c58dfb77462d4dc4 Mon Sep 17 00:00:00 2001 From: samolego <34912839+samolego@users.noreply.github.com> Date: Sun, 16 Jul 2023 11:23:23 +0200 Subject: [PATCH] Dirty 1.20.1 container presets don't work atm --- .../clientstorage/fabric_client/config/FabricConfig.java | 1 + .../screen/gui_armour/MAbstractContainerScreen.java | 9 ++++----- gradle.properties | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/config/FabricConfig.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/config/FabricConfig.java index 059ef44..8961e11 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/config/FabricConfig.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/config/FabricConfig.java @@ -42,6 +42,7 @@ public class FabricConfig extends Config { private static Config serverConfig = null; public boolean focusSearchBar = false; public boolean enableItemTransfers = true; + public boolean armorAccess = false; private boolean allowSyncServer = true; public FabricConfig() { diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/MAbstractContainerScreen.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/MAbstractContainerScreen.java index ab3e748..7028bee 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/MAbstractContainerScreen.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/MAbstractContainerScreen.java @@ -39,8 +39,7 @@ public abstract class MAbstractContainerScreen { target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;renderBg(Lnet/minecraft/client/gui/GuiGraphics;FII)V", shift = At.Shift.AFTER)) private void addArmorSlotBg(GuiGraphics graphics, int x, int y, float f, CallbackInfo ci) { - if (!config.enabled || self instanceof InventoryScreen) { - } + if (!config.enabled || self instanceof InventoryScreen || !config.armorAccess) return; // Draw background } @@ -49,7 +48,7 @@ private void addArmorSlotBg(GuiGraphics graphics, int x, int y, float f, Callbac at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;renderLabels(Lnet/minecraft/client/gui/GuiGraphics;II)V")) private void addArmorSlots(GuiGraphics graphics, int x, int y, float f, CallbackInfo ci) { - if (!config.enabled || self instanceof InventoryScreen) return; + if (!config.enabled || self instanceof InventoryScreen || !config.armorAccess) return; // Draw 5 armor slots NonNullList armorSlots = ((IArmorMenu) this.self.getMenu()).cs_getArmorSlots(); for (Slot slot : armorSlots) { @@ -67,7 +66,7 @@ private void addArmorSlots(GuiGraphics graphics, int x, int y, float f, Callback @Inject(method = "hasClickedOutside", at = @At("HEAD"), cancellable = true) private void hasClickedOutside(double clickX, double clickY, int i, int j, int k, CallbackInfoReturnable cir) { - if (!config.enabled || self instanceof InventoryScreen || this.hoveredSlot == null) return; + if (!config.enabled || self instanceof InventoryScreen || this.hoveredSlot == null || !config.armorAccess) return; int startX = this.hoveredSlot.x; int startY = this.hoveredSlot.y; @@ -81,7 +80,7 @@ private void hasClickedOutside(double clickX, double clickY, int i, int j, int k @Inject(method = "findSlot", at = @At("TAIL"), cancellable = true) private void findSlot(double x, double y, CallbackInfoReturnable cir) { - if (!config.enabled || self instanceof InventoryScreen) return; + if (!config.enabled || self instanceof InventoryScreen || !config.armorAccess) return; // Loop through armor slots NonNullList armorSlots = ((IArmorMenu) this.self.getMenu()).cs_getArmorSlots(); diff --git a/gradle.properties b/gradle.properties index fc1871a..62c78bf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,10 +2,10 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.1 +yarn_mappings=1.20.1+build.9 loader_version=0.14.21 #Fabric api -fabric_version=0.83.1+1.20.1 +fabric_version=0.85.0+1.20.1 # Mod Properties mod_version=2.2.2 maven_group=org.samo_lego