Files
Purpur/patches/server/0197-ShulkerBox-allow-oversized-stacks.patch
William Blake Galbreath 69c7c31f9a Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
26c37d99d5 create random seeds for features using SecureRandom
589bf2f1bf Upgrade gson to 2.8.8 (Closes #6370)
0a6103597b Get entity default attributes (#6449)
40057019e0 Correctly inflate villager activation bounding box (#6798)
e5f9241d15 Left handed API (#6775)
40ee63496c Add advancement display API (#6175)
9d570042ed Add ItemFactory#getMonsterEgg API (#6772)
55ca459515 rename method to getSpawnEgg
bb397ba74c Add critical damage API (#6275)
f47aeafe00 Add Horse Animation API (#5599)
7a0886180f AT & Mapping fixes (#6809)
5553432644 docs: Update gradle instructions for Java 16 (#6811) [ci skip]
a1f49e4c60 Fix command suggestion leak (#6592)
9472d38f3c Fix method name for Critical damage (#6813)
2021-10-21 10:58:20 -05:00

53 lines
3.3 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/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index ca281c9444051ca1695580c51b6774502e072db8..585e921585529c03756c51550110c796e6f27ea5 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -449,7 +449,7 @@ public class ServerPlayerGameMode {
block.destroy(this.level, pos, iblockdata);
}
- if (this.isCreative()) {
+ if (this.isCreative() || (this.level.purpurConfig.shulkerBoxAllowOversizedStacks && block instanceof net.minecraft.world.level.block.ShulkerBoxBlock)) { // Purpur
// return true; // CraftBukkit
} else {
ItemStack itemstack = this.player.getMainHandItem();
diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
index b9c558060024d380e89116489c7fc12ad88db8ad..0a0a4be15bed899812fcd4af0e311f5fc40d5570 100644
--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
@@ -122,7 +122,7 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof ShulkerBoxBlockEntity) {
ShulkerBoxBlockEntity shulkerBoxBlockEntity = (ShulkerBoxBlockEntity)blockEntity;
- if (!world.isClientSide && player.isCreative() && !shulkerBoxBlockEntity.isEmpty()) {
+ if (world.purpurConfig.shulkerBoxAllowOversizedStacks || (player.isCreative() && !shulkerBoxBlockEntity.isEmpty())) { // Purpur
ItemStack itemStack = getColoredItemStack(this.getColor());
CompoundTag compoundTag = shulkerBoxBlockEntity.saveToTag(new CompoundTag());
if (!compoundTag.isEmpty()) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index b9064a5ffa01ec122830fe70aa2be7abdd1a45a6..d1c9bcd1216abde2179d3812dd9c3f49a529eab9 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -696,6 +696,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() {