PaperMC/Spigot-Server-Patches/0347-Allow-chests-to-be-placed-with-NBT-data.patch
Aikar be067fea11
PlayerDeathEvent#getItemsToKeep
Exposes a mutable array on items a player should keep on death.

This allows a cleaner method to implement "Keep certain items on death"
than how plugins currently do it in that it never removes them in first
place, so its safe if the player logs out/server is shutdown before respawn.

Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
2019-03-28 01:12:38 -04:00

42 lines
1.8 KiB
Diff

From 5137342b191814dba8b79fd8c1286a5dacfd191f 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/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index f34ac392e..d8ebcf0a3 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -241,6 +241,15 @@ public final class ItemStack {
enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement
// PAIL: Remove this when MC-99075 fixed
placeEvent.getPlayer().updateInventory();
+
+ // Paper start
+ for (Map.Entry<BlockPosition, TileEntity> e : world.capturedTileEntities.entrySet()) {
+ if (e.getValue() instanceof TileEntityLootable) {
+ ((TileEntityLootable) e.getValue()).setLootTable(null);
+ }
+ }
+ // Paper end
+
// revert back all captured blocks
for (BlockState blockstate : blocks) {
blockstate.update(true, false);
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index c46b761cc..2e0f782f6 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -305,7 +305,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic
// CraftBukkit start
@Override
public boolean isFilteredNBT() {
- return true;
+ return false; // Paper
}
// CraftBukkit end
}
--
2.21.0