Files
Purpur/patches/server-unmapped/0214-ShulkerBox-allow-oversized-stacks.patch
William Blake Galbreath 444a2c6650 progress
2021-06-19 19:42:43 -05:00

53 lines
3.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
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/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
index e80d80b230cde5ca9278691313f556147229013b..b3cdff511a72edeecb73e1f508f0cd7f62a57673 100644
--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
@@ -407,7 +407,7 @@ public class PlayerInteractManager {
block.postBreak(this.world, blockposition, iblockdata);
}
- if (this.isCreative()) {
+ if (this.isCreative() || (world.purpurConfig.shulkerBoxAllowOversizedStacks && block instanceof net.minecraft.world.level.block.BlockShulkerBox)) { // Purpur
// return true; // CraftBukkit
} else {
ItemStack itemstack = this.player.getItemInMainHand();
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..af935a03d3677314cd367686d65e89b615af3f4f 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() {