2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
Allow chests to be placed with NBT (#1425)
This restores vanilla behavior of allowing placed chests to retain any Block Entity Tag data.
Upstream added filtering to chests, breaking vanilla behavior, and preventing use of loot table chests as a reward mechanism.
Upon review, we can find no security risk in allowing players to place a chest with NBT data, as Spawn Eggs, Minecarts, command blocks etc all have their own checks.
Additionally, survival mode players, non op players can not create these items anyways. If a player has Creative or Op, they already have high levels of access.
Plus, Chests aren't the only inventory that could have free form items, so this filter was insufficient anyways.
2018-09-09 18:53:23 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
|
|
index de171e18fbc6cc5ee06e75f4a3c60fd4c710d8bb..5da20483ed352ac6d9695287f840ed643a2bf302 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
|
|
@@ -298,6 +298,7 @@ public final class ItemStack {
|
2018-09-30 03:57:59 +02:00
|
|
|
enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement
|
|
|
|
// PAIL: Remove this when MC-99075 fixed
|
|
|
|
placeEvent.getPlayer().updateInventory();
|
2019-04-06 16:23:05 +02:00
|
|
|
+ world.capturedTileEntities.clear(); // Paper - clear out tile entities as chests and such will pop loot
|
2018-09-30 03:57:59 +02:00
|
|
|
// revert back all captured blocks
|
|
|
|
for (BlockState blockstate : blocks) {
|
|
|
|
blockstate.update(true, false);
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
|
|
|
|
index aafd1f7c6c811f9eb2796d865e327f374be9b461..d4f019e98fbadfadee981ae8e7a5f121ba8fe1e8 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
|
|
|
|
@@ -326,7 +326,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic
|
Allow chests to be placed with NBT (#1425)
This restores vanilla behavior of allowing placed chests to retain any Block Entity Tag data.
Upstream added filtering to chests, breaking vanilla behavior, and preventing use of loot table chests as a reward mechanism.
Upon review, we can find no security risk in allowing players to place a chest with NBT data, as Spawn Eggs, Minecarts, command blocks etc all have their own checks.
Additionally, survival mode players, non op players can not create these items anyways. If a player has Creative or Op, they already have high levels of access.
Plus, Chests aren't the only inventory that could have free form items, so this filter was insufficient anyways.
2018-09-09 18:53:23 +02:00
|
|
|
// CraftBukkit start
|
|
|
|
@Override
|
|
|
|
public boolean isFilteredNBT() {
|
|
|
|
- return true;
|
|
|
|
+ return false; // Paper
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
}
|