Paper/patches/server/0958-Fix-destroying-beehive-without-any-players-nearby-th.patch
Jake Potrebic a73ed9572e
Updated Upstream (CraftBukkit/Spigot) (#9598)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
b76ceb4f5 PR-1235: Move EntityType return to base Entity class
e795d7490 SPIGOT-7458: Exception when Entity CommandSender executes Vanilla command
46c7fc3b1 SPIGOT-7452: Player#openSign cannot edit
d91e5aa0b SPIGOT-7447: Rewrite --forceUpgrade to minimise diff and properly handle CraftBukkit world layout
921ae06d6 Revert "SPIGOT-7447: Fix --forceUpgrade"

Spigot Changes:
94e187b5 Rebuild patches
3bce7935 SPIGOT-7091: Update bungeecord-chat
2023-08-13 16:32:51 -07:00

26 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
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();