Files
Purpur/patches/server/0217-ShulkerBox-allow-oversized-stacks.patch
2021-06-02 20:32:18 -05:00

53 lines
3.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <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 7302554063ac7b5dedaff895cba33b70234008e6..151da6c134f908d9037fddc5b54e71b069680e56 100644
--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
@@ -440,7 +440,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() {