From 107537b1c878052932d3e5c096a9c6f2043e9168 Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Sat, 11 Jan 2025 23:50:44 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fixed=20stashing=20to=20s?= =?UTF-8?q?hulker=20box=20to=20not=20work=20in=20creative=20screen=20becau?= =?UTF-8?q?se=20in=20this=20screen=20there's=20no=20serverside=20processin?= =?UTF-8?q?g=20and=20thus=20items=20actually=20don't=20get=20moved=20to=20?= =?UTF-8?q?backpack=20storage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../sophisticatedstorage/item/ShulkerBoxItem.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index cd389a536..c6710530d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version_range=[4,) mod_id=sophisticatedstorage mod_name=Sophisticated Storage mod_license=GNU General Public License v3.0 -mod_version=1.1.3 +mod_version=1.1.4 mod_group_id=sophisticatedstorage mod_authors=P3pp3rF1y, Ridanisaurus mod_description=Fancy and functional storage containers. diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedstorage/item/ShulkerBoxItem.java b/src/main/java/net/p3pp3rf1y/sophisticatedstorage/item/ShulkerBoxItem.java index 91aa329b8..ea21ba164 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedstorage/item/ShulkerBoxItem.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedstorage/item/ShulkerBoxItem.java @@ -2,6 +2,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; import net.minecraft.core.HolderLookup; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.SlotAccess; @@ -116,7 +117,7 @@ public int getNumberOfUpgradeSlots(HolderLookup.Provider registries, ItemStack s @Override public boolean overrideStackedOnOther(ItemStack storageStack, Slot slot, ClickAction action, Player player) { - if (storageStack.getCount() > 1 || !slot.mayPickup(player) || slot.getItem().isEmpty() || action != ClickAction.SECONDARY) { + if (hasCreativeScreenContainerOpen(player) || storageStack.getCount() > 1 || !slot.mayPickup(player) || slot.getItem().isEmpty() || action != ClickAction.SECONDARY) { return super.overrideStackedOnOther(storageStack, slot, action, player); } @@ -134,7 +135,7 @@ public boolean overrideStackedOnOther(ItemStack storageStack, Slot slot, ClickAc @Override public boolean overrideOtherStackedOnMe(ItemStack storageStack, ItemStack otherStack, Slot slot, ClickAction action, Player player, SlotAccess carriedAccess) { - if (storageStack.getCount() > 1 || !slot.mayPlace(storageStack) || action != ClickAction.SECONDARY) { + if (hasCreativeScreenContainerOpen(player) || storageStack.getCount() > 1 || !slot.mayPlace(storageStack) || action != ClickAction.SECONDARY) { return super.overrideOtherStackedOnMe(storageStack, otherStack, slot, action, player, carriedAccess); } @@ -148,4 +149,7 @@ public boolean overrideOtherStackedOnMe(ItemStack storageStack, ItemStack otherS return super.overrideOtherStackedOnMe(storageStack, otherStack, slot, action, player, carriedAccess); } + private boolean hasCreativeScreenContainerOpen(Player player) { + return player.level().isClientSide() && player.containerMenu instanceof CreativeModeInventoryScreen.ItemPickerMenu; + } }