Skip to content

Commit

Permalink
Fix Stackable ShulkerBoxes (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Sep 16, 2024
1 parent 615efda commit 56d306c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion patches/server/0040-Stackable-ShulkerBoxes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ index 607f1a9802eb0ff4865af4c53f302128a6e6fe02..929a9bee808e8216dacb74dc58dbeee6
ItemStack itemstack1 = other.getItem();

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 eb11482f48c9f330b7fa62a278fd6f07d3a642e1..8631f3a5ce5aa24f195d5031dad6d289e4389314 100644
index eb11482f48c9f330b7fa62a278fd6f07d3a642e1..62b4aeabbde9561cd7e78fe14b751bd377ba129a 100644
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
@@ -111,7 +111,7 @@ public class Inventory implements Container, Nameable {
Expand All @@ -146,6 +146,22 @@ index eb11482f48c9f330b7fa62a278fd6f07d3a642e1..8631f3a5ce5aa24f195d5031dad6d289
}

// CraftBukkit start - Watch method above! :D
@@ -122,13 +122,13 @@ public class Inventory implements Container, Nameable {
if (itemstack1.isEmpty()) return itemstack.getCount();

if (this.hasRemainingSpaceForItem(itemstack1, itemstack)) {
- remains -= (itemstack1.getMaxStackSize() < this.getMaxStackSize() ? itemstack1.getMaxStackSize() : this.getMaxStackSize()) - itemstack1.getCount();
+ remains -= (org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack1) < this.getMaxStackSize() ? org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack1) : this.getMaxStackSize()) - itemstack1.getCount(); // Leaves
}
if (remains <= 0) return itemstack.getCount();
}
ItemStack offhandItemStack = this.getItem(this.items.size() + this.armor.size());
if (this.hasRemainingSpaceForItem(offhandItemStack, itemstack)) {
- remains -= (offhandItemStack.getMaxStackSize() < this.getMaxStackSize() ? offhandItemStack.getMaxStackSize() : this.getMaxStackSize()) - offhandItemStack.getCount();
+ remains -= (org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(offhandItemStack) < this.getMaxStackSize() ? org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(offhandItemStack) : this.getMaxStackSize()) - offhandItemStack.getCount(); // Leaves
}
if (remains <= 0) return itemstack.getCount();

@@ -279,7 +279,9 @@ public class Inventory implements Container, Nameable {
this.setItem(slot, itemstack1);
}
Expand Down

0 comments on commit 56d306c

Please sign in to comment.