SPIGOT-6315: Cats gifts dont call EntityDropItemEvent

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-01-21 08:31:06 +11:00
parent 78ff16111e
commit f7ff794ec7

View File

@ -18,7 +18,24 @@
this.tame(entityhuman);
this.setWillSit(true);
this.world.broadcastEntityEffect(this, (byte) 7);
@@ -529,7 +529,7 @@
@@ -499,7 +499,15 @@
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
- this.a.world.addEntity(new EntityItem(this.a.world, (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.a.aA * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.a.aA * 0.017453292F), itemstack));
+ // CraftBukkit start
+ EntityItem entityitem = new EntityItem(this.a.world, (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.a.aA * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.a.aA * 0.017453292F), itemstack);
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.a.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
+ entityitem.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ this.a.world.addEntity(entityitem);
+ // CraftBukkit end
}
}
@@ -529,7 +537,7 @@
static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
@Nullable
@ -27,7 +44,7 @@
private final EntityCat d;
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
@@ -564,9 +564,9 @@
@@ -564,9 +572,9 @@
private final EntityCat i;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {