mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
SPIGOT-5526: Call EntityEnterBlockEvent for bees trying to enter hives
This commit is contained in:
parent
6515ea4957
commit
e653ae7669
1 changed files with 22 additions and 3 deletions
|
@ -1,6 +1,25 @@
|
||||||
--- a/net/minecraft/server/TileEntityBeehive.java
|
--- a/net/minecraft/server/TileEntityBeehive.java
|
||||||
+++ b/net/minecraft/server/TileEntityBeehive.java
|
+++ b/net/minecraft/server/TileEntityBeehive.java
|
||||||
@@ -163,6 +163,7 @@
|
@@ -108,6 +108,18 @@
|
||||||
|
|
||||||
|
public void a(Entity entity, boolean flag, int i) {
|
||||||
|
if (this.bees.size() < 3) {
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ if (this.world != null) {
|
||||||
|
+ org.bukkit.event.entity.EntityEnterBlockEvent event = new org.bukkit.event.entity.EntityEnterBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, getPosition()));
|
||||||
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ if (entity instanceof EntityBee) {
|
||||||
|
+ ((EntityBee) entity).setCannotEnterHiveTicks(400);
|
||||||
|
+ }
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
entity.stopRiding();
|
||||||
|
entity.ejectPassengers();
|
||||||
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
|
@@ -163,6 +175,7 @@
|
||||||
if (!entity.getEntityType().a(TagsEntity.BEEHIVE_INHABITORS)) {
|
if (!entity.getEntityType().a(TagsEntity.BEEHIVE_INHABITORS)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -8,7 +27,7 @@
|
||||||
if (entity instanceof EntityBee) {
|
if (entity instanceof EntityBee) {
|
||||||
EntityBee entitybee = (EntityBee) entity;
|
EntityBee entitybee = (EntityBee) entity;
|
||||||
|
|
||||||
@@ -196,7 +197,7 @@
|
@@ -196,7 +209,7 @@
|
||||||
BlockPosition blockposition2 = this.getPosition();
|
BlockPosition blockposition2 = this.getPosition();
|
||||||
|
|
||||||
this.world.playSound((EntityHuman) null, (double) blockposition2.getX(), (double) blockposition2.getY(), (double) blockposition2.getZ(), SoundEffects.BLOCK_BEEHIVE_EXIT, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
this.world.playSound((EntityHuman) null, (double) blockposition2.getX(), (double) blockposition2.getY(), (double) blockposition2.getZ(), SoundEffects.BLOCK_BEEHIVE_EXIT, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||||
|
@ -17,7 +36,7 @@
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -223,6 +224,11 @@
|
@@ -223,6 +236,11 @@
|
||||||
if (this.a(iblockdata, nbttagcompound, (List) null, tileentitybeehive_releasestatus)) {
|
if (this.a(iblockdata, nbttagcompound, (List) null, tileentitybeehive_releasestatus)) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue