Skip to content

Commit

Permalink
Merge pull request #1171 from P3pp3rF1y/1.21.x-dev
Browse files Browse the repository at this point in the history
fix: 🐛 Fixed stashing logic to be able to stash oversized stacks (lar…
  • Loading branch information
P3pp3rF1y authored Oct 6, 2024
2 parents a9da82d + 3235deb commit 5fbe7cc
Show file tree
Hide file tree
Showing 2 changed files with 9 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=sophisticatedbackpacks
mod_name=Sophisticated Backpacks
mod_license=GNU General Public License v3.0
mod_version=3.20.16
mod_version=3.20.17
mod_group_id=sophisticatedbackpacks
mod_authors=P3pp3rF1y, Ridanisaurus
mod_description=Fancy and functional backpacks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,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;
}

Expand Down

0 comments on commit 5fbe7cc

Please sign in to comment.