Skip to content

Commit

Permalink
fix: šŸ› Fixed stashing to shulker box to not work in creative screen bā€¦
Browse files Browse the repository at this point in the history
ā€¦ecause in this screen there's no serverside processing and thus items actually don't get moved to backpack storage
  • Loading branch information
P3pp3rF1y committed Jan 12, 2025
1 parent 56dd9df commit 107537b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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;
}
}

0 comments on commit 107537b

Please sign in to comment.