From b0c6dfe1ae6fd5907379ba180851f94f45a8a2da Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 11 Jul 2020 09:45:00 +1000 Subject: [PATCH] SPIGOT-5976: Bees do not exit naturally spawned hives --- nms-patches/TileEntityBeehive.patch | 33 ++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/nms-patches/TileEntityBeehive.patch b/nms-patches/TileEntityBeehive.patch index 7e6170b5ea..eb6ed011a3 100644 --- a/nms-patches/TileEntityBeehive.patch +++ b/nms-patches/TileEntityBeehive.patch @@ -80,15 +80,38 @@ return false; } else { BlockPosition blockposition = this.getPosition(); -@@ -157,6 +182,7 @@ +@@ -157,6 +182,18 @@ if (!entity.getEntityType().a((Tag) TagsEntity.BEEHIVE_INHABITORS)) { return false; } else { ++ // CraftBukkit start ++ if (entity instanceof EntityBee) { ++ float f = entity.getWidth(); ++ double d0 = flag ? 0.0D : 0.55D + (double) (f / 2.0F); ++ double d1 = (double) blockposition.getX() + 0.5D + d0 * (double) enumdirection.getAdjacentX(); ++ double d2 = (double) blockposition.getY() + 0.5D - (double) (entity.getHeight() / 2.0F); ++ double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getAdjacentZ(); ++ ++ entity.setPositionRotation(d1, d2, d3, entity.yaw, entity.pitch); ++ } + if (!this.world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BEEHIVE)) return false; // CraftBukkit - SpawnReason, moved from below ++ // CraftBukkit end if (entity instanceof EntityBee) { EntityBee entitybee = (EntityBee) entity; -@@ -196,7 +222,7 @@ +@@ -186,6 +223,7 @@ + list.add(entitybee); + } + ++ /* // CraftBukkit start + float f = entity.getWidth(); + double d0 = flag ? 0.0D : 0.55D + (double) (f / 2.0F); + double d1 = (double) blockposition.getX() + 0.5D + d0 * (double) enumdirection.getAdjacentX(); +@@ -193,10 +231,11 @@ + double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getAdjacentZ(); + + entity.setPositionRotation(d1, d2, d3, entity.yaw, entity.pitch); ++ */ // CraftBukkit end } this.world.playSound((EntityHuman) null, blockposition, SoundEffects.BLOCK_BEEHIVE_EXIT, SoundCategory.BLOCKS, 1.0F, 1.0F); @@ -97,7 +120,7 @@ } } else { return false; -@@ -235,6 +261,11 @@ +@@ -235,6 +274,11 @@ if (this.releaseBee(iblockdata, tileentitybeehive_hivebee, (List) null, tileentitybeehive_releasestatus)) { iterator.remove(); } @@ -109,7 +132,7 @@ } } -@@ -276,6 +307,11 @@ +@@ -276,6 +320,11 @@ this.flowerPos = GameProfileSerializer.b(nbttagcompound.getCompound("FlowerPos")); } @@ -121,7 +144,7 @@ } @Override -@@ -285,6 +321,7 @@ +@@ -285,6 +334,7 @@ if (this.x()) { nbttagcompound.set("FlowerPos", GameProfileSerializer.a(this.flowerPos)); }