mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 09:21:57 +01:00
Clear containers on cancelled place events
It is possible for a container to be brought into the world pre-filled in place event (thanks NBT!). When the blockplacevent(s) are cancelled their blockstate is updated in OBC. This triggers them to drop their inventories. Rather than screwing with the update method which is used elsewhere, we can simply clear any inventories once we are told that a plugin intends to cancel the interaction. Fixes GH-1831
This commit is contained in:
parent
0891f63203
commit
84f63e360a
1 changed files with 24 additions and 0 deletions
|
@ -0,0 +1,24 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Sat, 6 Apr 2019 00:30:32 -0400
|
||||
Subject: [PATCH] Clear containers when block place is cancelled
|
||||
|
||||
Fixes GH-1831
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
index d8ebcf0a3..0ef928a2b 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
for (Map.Entry<BlockPosition, TileEntity> e : world.capturedTileEntities.entrySet()) {
|
||||
if (e.getValue() instanceof TileEntityLootable) {
|
||||
((TileEntityLootable) e.getValue()).setLootTable(null);
|
||||
+
|
||||
+ // Clear containers before updating their blockstate below - Fixes GH-1831
|
||||
+ if (e.getValue() instanceof TileEntityContainer) {
|
||||
+ ((TileEntityContainer) e.getValue()).clear();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
--
|
Loading…
Reference in a new issue