SPIGOT-5976: Bees do not exit naturally spawned hives

This commit is contained in:
md_5 2020-07-11 09:45:00 +10:00
parent 93cfb195ca
commit b0c6dfe1ae
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
1 changed files with 28 additions and 5 deletions

View File

@ -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));
}