From 1dfd7910e3d1af1edacd238781a3967c38d1ca73 Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Sun, 6 Oct 2024 10:08:17 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fixed=20stashing=20logic?= =?UTF-8?q?=20to=20be=20able=20to=20stash=20oversized=20stacks=20(larger?= =?UTF-8?q?=20than=20usual=20max=20stack=20size)=20with=20right=20click=20?= =?UTF-8?q?on=20them=20again?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../sophisticatedbackpacks/backpack/BackpackItem.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index a26e82d1..15ef52b7 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.20.10 +mod_version=3.20.11 sonar_project_key=sophisticatedbackpacks:SophisticatedBackpacks github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedBackpacks diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java index facedd72..3812a323 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java @@ -420,8 +420,14 @@ public boolean overrideStackedOnOther(ItemStack storageStack, Slot slot, ClickAc ItemStack stashResult = stash(storageStack, stackToStash, true); if (stashResult.getCount() < stackToStash.getCount()) { int countToTake = stackToStash.getCount() - stashResult.getCount(); - ItemStack takeResult = slot.safeTake(countToTake, countToTake, player); - stash(storageStack, takeResult, false); + while (countToTake > 0) { + ItemStack takeResult = slot.safeTake(countToTake, countToTake, player); + if (takeResult.isEmpty()) { + break; + } + stash(storageStack, takeResult, false); + countToTake -= takeResult.getCount(); + } return true; }