diff --git a/patches/server/0220-ShulkerBox-allow-oversized-stacks.patch b/patches/server/0220-ShulkerBox-allow-oversized-stacks.patch new file mode 100644 index 000000000..c03721494 --- /dev/null +++ b/patches/server/0220-ShulkerBox-allow-oversized-stacks.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Thu, 27 May 2021 04:04:23 -0500 +Subject: [PATCH] ShulkerBox allow oversized stacks + +This fixes PaperMC/Paper#4748 where breaking a shulkerbox in survival mode +with oversized itemstacks would cause a "chunk ban". This fixes it by always +creating an itemstack using the TileEntity's NBT data (how it handles it for +creative players) instead of routing it through the LootableBuilder. + +diff --git a/src/main/java/net/minecraft/world/level/block/BlockShulkerBox.java b/src/main/java/net/minecraft/world/level/block/BlockShulkerBox.java +index 2c1c6562efe8cdc079b4e353144d20c1e46355c5..1083060cc3e0168d362851c34a2f38bf93c6a5fe 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockShulkerBox.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockShulkerBox.java +@@ -110,7 +110,7 @@ public class BlockShulkerBox extends BlockTileEntity { + if (tileentity instanceof TileEntityShulkerBox) { + TileEntityShulkerBox tileentityshulkerbox = (TileEntityShulkerBox) tileentity; + +- if (!world.isClientSide && entityhuman.isCreative() && !tileentityshulkerbox.isEmpty()) { ++ if (!world.isClientSide && (world.purpurConfig.shulkerBoxAllowOversizedStacks || entityhuman.isCreative()) && !tileentityshulkerbox.isEmpty()) { + ItemStack itemstack = b(this.c()); + NBTTagCompound nbttagcompound = tileentityshulkerbox.e(new NBTTagCompound()); + +diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +index cda80cf8d2556defd1453b473aca76bf7c014794..0afe0d9c0b9d4c7abc6f65938d8fd147df52f880 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +@@ -630,6 +630,11 @@ public class PurpurWorldConfig { + } + } + ++ public boolean shulkerBoxAllowOversizedStacks = false; ++ private void shulkerBoxSettings() { ++ shulkerBoxAllowOversizedStacks = getBoolean("blocks.shulker_box.allow-oversized-stacks", shulkerBoxAllowOversizedStacks); ++ } ++ + public boolean signAllowColors = false; + public boolean signRightClickEdit = false; + private void signSettings() {