PaperMC/patches/server/0242-Allow-chests-to-be-placed-with-NBT-data.patch

32 lines
1.9 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 8 Sep 2018 18:43:31 -0500
Subject: [PATCH] Allow chests to be placed with NBT data
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
2024-10-23 13:13:00 +02:00
index 957c112b4145fda5078a6f8f1689935fa0290806..f00b756fe5dad616323e3b11e35e27353f347042 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
2024-10-23 13:13:00 +02:00
@@ -496,6 +496,7 @@ public final class ItemStack implements DataComponentHolder {
enuminteractionresult = InteractionResult.FAIL; // cancel placement
// PAIL: Remove this when MC-99075 fixed
placeEvent.getPlayer().updateInventory();
+ world.capturedTileEntities.clear(); // Paper - Allow chests to be placed with NBT data; clear out block entities as chests and such will pop loot
2024-10-23 13:13:00 +02:00
// revert back all captured blocks
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
for (BlockState blockstate : blocks) {
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
2024-10-23 13:13:00 +02:00
index a3cdb4af2b7a3c7f884c8af2cba0d3d5e1c184a6..8847617f6a23e6d2fe9bf7444a2072dc53f741b8 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
2024-04-24 04:46:06 +02:00
@@ -238,7 +238,7 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
2021-06-11 14:02:28 +02:00
// CraftBukkit start
@Override
public boolean onlyOpCanSetNbt() {
- return true;
+ return false; // Paper - Allow chests to be placed with NBT data
2021-06-11 14:02:28 +02:00
}
// CraftBukkit end
}