Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 19:10:09 +01:00
Add the ability to clear entities from block storage (#5598)
Dieser Commit ist enthalten in:
Ursprung
f50171f3bb
Commit
b3cc88799f
22
Spigot-API-Patches/0295-Add-EntityBlockStorage-clearEntities.patch
Normale Datei
22
Spigot-API-Patches/0295-Add-EntityBlockStorage-clearEntities.patch
Normale Datei
@ -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 f3f8d765d5d487aa14edf0b88c32608fb804c331..739911cda33b373f99df627a3a378b37d7d461aa 100644
|
||||||
|
--- a/src/main/java/org/bukkit/block/EntityBlockStorage.java
|
||||||
|
+++ b/src/main/java/org/bukkit/block/EntityBlockStorage.java
|
||||||
|
@@ -53,4 +53,11 @@ public interface EntityBlockStorage<T extends Entity> 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
|
||||||
|
}
|
@ -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 3cbcbb028b864f1d14e004628bbc0829f71ab476..80083a6666a28372946cf0e68ded44d075357f7d 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
|
||||||
|
@@ -120,6 +120,11 @@ 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 af691b28b38e388617d241008c2e9d403bc5c15d..9f4fb1ff9c945799d10d6905c8b73376e4133d23 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java
|
||||||
|
@@ -83,4 +83,10 @@ public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> imple
|
||||||
|
|
||||||
|
getSnapshot().addBee(((CraftBee) entity).getHandle(), false);
|
||||||
|
}
|
||||||
|
+ // Paper start - Add EntityBlockStorage clearEntities
|
||||||
|
+ @Override
|
||||||
|
+ public void clearEntities() {
|
||||||
|
+ getSnapshot().clearBees();
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren