SPIGOT-6452: Call EntityPickupItemEvent for villagers

By: Julian van den Berkmortel <julianvdberkmortel@outlook.com>
This commit is contained in:
CraftBukkit/Spigot 2021-05-09 16:57:25 +10:00
parent 3df6aee27f
commit 6f87ada41c

View File

@ -90,7 +90,25 @@
this.fq();
this.die();
} else {
@@ -903,7 +923,7 @@
@@ -791,9 +811,16 @@
return;
}
+ // CraftBukkit start
+ ItemStack itemstack1 = inventorysubcontainer.a(itemstack);
+ if (CraftEventFactory.callEntityPickupItemEvent(this, entityitem, itemstack1.getCount(), false).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
+
this.a(entityitem);
this.receive(entityitem, itemstack.getCount());
- ItemStack itemstack1 = inventorysubcontainer.a(itemstack);
+ // ItemStack itemstack1 = inventorysubcontainer.a(itemstack); // CraftBukkit - moved up
if (itemstack1.isEmpty()) {
entityitem.die();
@@ -903,7 +930,7 @@
if (entityirongolem != null) {
if (entityirongolem.a((GeneratorAccess) worldserver, EnumMobSpawn.MOB_SUMMONED) && entityirongolem.a((IWorldReader) worldserver)) {
@ -99,7 +117,7 @@
return entityirongolem;
}
@@ -981,7 +1001,7 @@
@@ -981,7 +1008,7 @@
@Override
public void entitySleep(BlockPosition blockposition) {
super.entitySleep(blockposition);
@ -108,7 +126,7 @@
this.bg.removeMemory(MemoryModuleType.WALK_TARGET);
this.bg.removeMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
}
@@ -989,7 +1009,7 @@
@@ -989,7 +1016,7 @@
@Override
public void entityWakeup() {
super.entityWakeup();