From e3e1468b4b28ad4334938edc90f13a266a081374 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Mon, 10 May 2021 03:33:39 -0400 Subject: [PATCH] Add the ability to clear entities from block storage (#5598) --- ...Add-EntityBlockStorage-clearEntities.patch | 22 +++++++++++ ...Add-EntityBlockStorage-clearEntities.patch | 37 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 Spigot-API-Patches/Add-EntityBlockStorage-clearEntities.patch create mode 100644 Spigot-Server-Patches/Add-EntityBlockStorage-clearEntities.patch diff --git a/Spigot-API-Patches/Add-EntityBlockStorage-clearEntities.patch b/Spigot-API-Patches/Add-EntityBlockStorage-clearEntities.patch new file mode 100644 index 0000000000..89b53d6e3d --- /dev/null +++ b/Spigot-API-Patches/Add-EntityBlockStorage-clearEntities.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Mon, 5 Apr 2021 18:12:06 -0400 +Subject: [PATCH] Add EntityBlockStorage#clearEntities() + + +diff --git a/src/main/java/org/bukkit/block/EntityBlockStorage.java b/src/main/java/org/bukkit/block/EntityBlockStorage.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/block/EntityBlockStorage.java ++++ b/src/main/java/org/bukkit/block/EntityBlockStorage.java +@@ -0,0 +0,0 @@ public interface EntityBlockStorage extends TileState { + * @param entity Entity to add to the block + */ + void addEntity(@NotNull T entity); ++ ++ // Paper start - Add EntityBlockStorage clearEntities ++ /** ++ * Clear all currently stored entities in the block. ++ */ ++ void clearEntities(); ++ // Paper end + } diff --git a/Spigot-Server-Patches/Add-EntityBlockStorage-clearEntities.patch b/Spigot-Server-Patches/Add-EntityBlockStorage-clearEntities.patch new file mode 100644 index 0000000000..eba70612e7 --- /dev/null +++ b/Spigot-Server-Patches/Add-EntityBlockStorage-clearEntities.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Mon, 5 Apr 2021 18:12:29 -0400 +Subject: [PATCH] Add EntityBlockStorage#clearEntities() + + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java +@@ -0,0 +0,0 @@ public class TileEntityBeehive extends TileEntity implements ITickable { + return this.bees.size(); + } + ++ // Paper start - Add EntityBlockStorage clearEntities ++ public void clearBees() { ++ this.bees.clear(); ++ } ++ // Paper end + public static int a(IBlockData iblockdata) { + return (Integer) iblockdata.get(BlockBeehive.b); + } +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java +@@ -0,0 +0,0 @@ public class CraftBeehive extends CraftBlockEntityState imple + + getSnapshot().addBee(((CraftBee) entity).getHandle(), false); + } ++ // Paper start - Add EntityBlockStorage clearEntities ++ @Override ++ public void clearEntities() { ++ getSnapshot().clearBees(); ++ } ++ // Paper end + }