Fix cancelled lootables (#1510)

This commit is contained in:
BillyGalbreath 2018-09-29 20:57:59 -05:00 committed by Daniel Ennis
parent d9363f2979
commit c81736fd60

View File

@ -1,11 +1,31 @@
From 82a16bea42eb290e7b63fc376477140857a71bf6 Mon Sep 17 00:00:00 2001 From fa57591b3691f5cb5f754fc423ecbcb78eacc41b Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com> From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 8 Sep 2018 18:43:31 -0500 Date: Sat, 8 Sep 2018 18:43:31 -0500
Subject: [PATCH] Allow chests to be placed with NBT data 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 4641113f9..26055924b 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -228,6 +228,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 diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index 9573a4ecdf..7594c16e99 100644 index 9573a4ecd..7594c16e9 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java --- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/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 @@ -305,7 +305,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic