9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00

Fix Stackable ShulkerBoxes (#329)

This commit is contained in:
violetc
2024-09-17 00:23:09 +08:00
parent 615efda225
commit 56d306cb91

View File

@@ -134,7 +134,7 @@ index 607f1a9802eb0ff4865af4c53f302128a6e6fe02..929a9bee808e8216dacb74dc58dbeee6
ItemStack itemstack1 = other.getItem(); 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 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 --- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
+++ b/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 { @@ -111,7 +111,7 @@ public class Inventory implements Container, Nameable {
@@ -146,6 +146,22 @@ index eb11482f48c9f330b7fa62a278fd6f07d3a642e1..8631f3a5ce5aa24f195d5031dad6d289
} }
// CraftBukkit start - Watch method above! :D // 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 { @@ -279,7 +279,9 @@ public class Inventory implements Container, Nameable {
this.setItem(slot, itemstack1); this.setItem(slot, itemstack1);
} }