aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0966-Fix-destroying-beehive-without-any-players-nearby-th.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0966-Fix-destroying-beehive-without-any-players-nearby-th.patch')
-rw-r--r--patches/server/0966-Fix-destroying-beehive-without-any-players-nearby-th.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/patches/server/0966-Fix-destroying-beehive-without-any-players-nearby-th.patch b/patches/server/0966-Fix-destroying-beehive-without-any-players-nearby-th.patch
new file mode 100644
index 0000000000..b166366059
--- /dev/null
+++ b/patches/server/0966-Fix-destroying-beehive-without-any-players-nearby-th.patch
@@ -0,0 +1,25 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Spottedleaf <[email protected]>
+Date: Mon, 3 Apr 2023 21:14:19 -0700
+Subject: [PATCH] Fix destroying beehive without any players nearby throwing an
+ exception
+
+If the player moves out of range by the time the block is destroyed,
+then the exception would throw and remove the player from the world
+
+diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
+index 01c8394c6e6b65f40db04280458d0191c116b845..8b715a750a0406d1d7b25c2f023dc2fb4d8b70fa 100644
+--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
++++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
+@@ -98,6 +98,11 @@ public class BeehiveBlock extends BaseEntityBlock {
+
+ if (!list.isEmpty()) {
+ List<Player> list1 = world.getEntitiesOfClass(Player.class, (new AABB(pos)).inflate(8.0D, 6.0D, 8.0D));
++ // Paper start - if there are no players nearby, then nextInt() will throw
++ if (list1.isEmpty()) {
++ return;
++ }
++ // Paper end - if there are no players nearby, then nextInt() will throw
+ int i = list1.size();
+ Iterator iterator = list.iterator();
+