aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorgranny <[email protected]>2024-03-03 10:37:00 -0800
committerGitHub <[email protected]>2024-03-03 10:37:00 -0800
commit54a23403daea965e88a026b301f310d2154ed8b0 (patch)
treef06e3887ed372ef98c660e531e8eefd44a226ccd
parent850b736e1442587230bbba241f99eb0cee193cd9 (diff)
downloadPaper-54a23403daea965e88a026b301f310d2154ed8b0.tar.gz
Paper-54a23403daea965e88a026b301f310d2154ed8b0.zip
check if itemstack is stackable first (#10285)
-rw-r--r--LICENSE.md1
-rw-r--r--patches/server/1048-check-if-itemstack-is-stackable-first.patch19
2 files changed, 20 insertions, 0 deletions
diff --git a/LICENSE.md b/LICENSE.md
index ae1df51b88..4cb1460c2e 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -63,4 +63,5 @@ Ollie <[email protected]>
Oliwier Miodun <[email protected]>
aerulion <[email protected]>
Lukas Planz <[email protected]>
```
diff --git a/patches/server/1048-check-if-itemstack-is-stackable-first.patch b/patches/server/1048-check-if-itemstack-is-stackable-first.patch
new file mode 100644
index 0000000000..3655bb3a13
--- /dev/null
+++ b/patches/server/1048-check-if-itemstack-is-stackable-first.patch
@@ -0,0 +1,19 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: granny <[email protected]>
+Date: Sat, 24 Feb 2024 19:33:01 -0800
+Subject: [PATCH] check if itemstack is stackable first
+
+
+diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
+index 309acf7bd07e38043aa81e0e686edba1136bd04c..96c898086f35fd83f9b1ce7e3fe53d31b2fa4c31 100644
+--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
++++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
+@@ -114,7 +114,7 @@ public class Inventory implements Container, Nameable {
+ }
+
+ private boolean hasRemainingSpaceForItem(ItemStack existingStack, ItemStack stack) {
+- return !existingStack.isEmpty() && ItemStack.isSameItemSameTags(existingStack, stack) && existingStack.isStackable() && existingStack.getCount() < existingStack.getMaxStackSize() && existingStack.getCount() < this.getMaxStackSize();
++ return !existingStack.isEmpty() && existingStack.isStackable() && existingStack.getCount() < existingStack.getMaxStackSize() && existingStack.getCount() < this.getMaxStackSize() && ItemStack.isSameItemSameTags(existingStack, stack); // Paper - check if itemstack is stackable first
+ }
+
+ // CraftBukkit start - Watch method above! :D