diff --git a/gradle.properties b/gradle.properties index a699f83f..fd84b704 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.daemon=false mod_id=sophisticatedbackpacks mod_group_id=sophisticatedbackpacks -mod_version=3.19.3 +mod_version=3.19.4 sonar_project_key=sophisticatedbackpacks:SophisticatedBackpacks github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedBackpacks diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/KeybindHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/KeybindHandler.java index 2f40fa6d..7e52ad36 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/KeybindHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/KeybindHandler.java @@ -199,16 +199,9 @@ private static boolean sendBackpackOpenOrCloseMessage() { return true; } } - if (screen instanceof BackpackScreen) { - if (slot != null && slot.getItem().getItem() instanceof BackpackItem) { - if (slot.getItem().getCount() == 1) { - SBPPacketHandler.INSTANCE.sendToServer(new BackpackOpenMessage(slot.index)); - return true; - } - } else { - SBPPacketHandler.INSTANCE.sendToServer(new BackpackCloseMessage()); - return true; - } + if (screen instanceof BackpackScreen && slot != null && slot.getItem().getItem() instanceof BackpackItem && slot.getItem().getCount() == 1) { + SBPPacketHandler.INSTANCE.sendToServer(new BackpackOpenMessage(slot.index)); + return true; } } return false; diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackScreen.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackScreen.java index fd371718..ccb9166a 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackScreen.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackScreen.java @@ -24,9 +24,13 @@ public BackpackScreen(BackpackContainer screenContainer, Inventory inv, Componen @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { if (keyCode == 256 || KeybindHandler.BACKPACK_OPEN_KEYBIND.isActiveAndMatches(InputConstants.getKey(keyCode, scanCode))) { - if (getMenu().isFirstLevelStorage() && getMenu().getBackpackContext().wasOpenFromInventory() && (keyCode == 256 || mouseNotOverBackpack())) { - getMinecraft().player.closeContainer(); - getMinecraft().setScreen(new InventoryScreen(getMinecraft().player)); + if (getMenu().isFirstLevelStorage() && (keyCode == 256 || mouseNotOverBackpack())) { + if (getMenu().getBackpackContext().wasOpenFromInventory()) { + getMinecraft().player.closeContainer(); + getMinecraft().setScreen(new InventoryScreen(getMinecraft().player)); + } else { + onClose(); + } return true; } else if (!getMenu().isFirstLevelStorage()) { SBPPacketHandler.INSTANCE.sendToServer(new BackpackOpenMessage());