From b5eb2f57cedffe7ff3d0fc540fecc7d006729721 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 21 Jan 2021 08:31:06 +1100 Subject: [PATCH] SPIGOT-6315: Cats gifts dont call EntityDropItemEvent --- nms-patches/EntityCat.patch | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/nms-patches/EntityCat.patch b/nms-patches/EntityCat.patch index 79210fcfb..112e785bb 100644 --- a/nms-patches/EntityCat.patch +++ b/nms-patches/EntityCat.patch @@ -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 oclass, float f, double d0, double d1) {