Skip to content

Commit

Permalink
Vanilla like stackable shulker boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Aug 13, 2023
1 parent c553b0d commit 70da855
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions patches/server/0051-Stackable-ShulkerBoxes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,22 @@ index 47468086c1cae252aa99c55b0065f225357dee62..bca757ea05403fe46f5bf0dfa75561b8
@Override
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
return SHAPE;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index 24d2b8a28bad8f33d5b27197fd80f7bb75926545..fa19bc9f9ac90fb6c0e687c72c253324a312fd51 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -657,9 +657,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
if (itemstack1.isEmpty()) {
// Spigot start - SPIGOT-6693, InventorySubcontainer#setItem
ItemStack leftover = ItemStack.EMPTY; // Paper
- if (!stack.isEmpty() && stack.getCount() > to.getMaxStackSize()) {
+ if (!stack.isEmpty() && (stack.getCount() > to.getMaxStackSize() || stack.getCount() > stack.getMaxStackSize())) { // Leaves - stackable shulker boxes
leftover = stack; // Paper
- stack = stack.split(to.getMaxStackSize());
+ stack = stack.split(Math.min(to.getMaxStackSize(), stack.getMaxStackSize())); // Leaves - stackable shulker boxes
}
// Spigot end
ignoreTileUpdates = true; // Paper
diff --git a/src/main/java/top/leavesmc/leaves/util/ShulkerBoxUtils.java b/src/main/java/top/leavesmc/leaves/util/ShulkerBoxUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..82b4337965663ec8eccbc8c77892e3c49bff87cf
Expand Down

0 comments on commit 70da855

Please sign in to comment.