3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2025-01-05 12:51:06 +01:00
Paper/Spigot-Server-Patches/0436-Clear-containers-when-block-place-is-cancelled.patch

27 Zeilen
1.2 KiB
Diff

From 86d1c4ec47db13ba21b98d644aee08f792fc20dd Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
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
@@ -246,6 +246,11 @@ 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
--
2.21.0