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 11, 2025
1 parent d75400e commit e6dad77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.daemon=false

mod_id=sophisticatedstorage
mod_group_id=sophisticatedstorage
mod_version=1.1.3
mod_version=1.1.4
sonar_project_key=sophisticatedstorage:SophisticatedStorage
github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedStorage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
Expand Down Expand Up @@ -179,7 +180,7 @@ public int getNumberOfUpgradeSlotsOrDefault(ItemStack shulkerBoxStack) {

@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 @@ -197,7 +198,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 @@ -210,4 +211,8 @@ 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 e6dad77

Please sign in to comment.