-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
paper-server/patches/sources/net/minecraft/world/item/component/BundleContents.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- a/net/minecraft/world/item/component/BundleContents.java | ||
+++ b/net/minecraft/world/item/component/BundleContents.java | ||
@@ -76,6 +_,12 @@ | ||
return !stack.isEmpty() && stack.getItem().canFitInsideContainerItems(); | ||
} | ||
|
||
+ // Paper start - correct bundle inventory action | ||
+ public int getMaxAmountToAdd(final ItemStack stack) { | ||
+ return Mutable.getMaxAmountToAdd(stack, this.weight); | ||
+ } | ||
+ // Paper end - correct bundle inventory action | ||
+ | ||
public int getNumberOfItemsToShow() { | ||
int size = this.size(); | ||
int i = size > 12 ? 11 : 12; | ||
@@ -171,7 +_,13 @@ | ||
} | ||
|
||
public int getMaxAmountToAdd(ItemStack stack) { | ||
- Fraction fraction = Fraction.ONE.subtract(this.weight); | ||
+ // Paper start - correct bundle inventory action | ||
+ // Static overload to easily compute this value without the need for an instance of mutable. | ||
+ return getMaxAmountToAdd(stack, this.weight); | ||
+ } | ||
+ static int getMaxAmountToAdd(final ItemStack stack, final Fraction weight) { | ||
+ Fraction fraction = Fraction.ONE.subtract(weight); | ||
+ // Paper end - correct bundle inventory action | ||
return Math.max(fraction.divideBy(BundleContents.getWeight(stack)).intValue(), 0); | ||
} | ||
|