SPIGOT-6093: Can't change ItemStack in EntityPickupItemEvent

By: Shane Bee <shanebolenback@me.com>
This commit is contained in:
CraftBukkit/Spigot
2020-08-21 18:46:42 +10:00
parent 9262b0c735
commit 886d2e1504
3 changed files with 20 additions and 13 deletions

View File

@@ -11,16 +11,17 @@
return list;
}
@@ -401,7 +401,7 @@
@@ -401,7 +401,8 @@
protected void b(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItemStack();
- if (this.canPickup(itemstack)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, itemstack.getCount() - 1, !this.canPickup(itemstack)).isCancelled()) { // CraftBukkit - call EntityPickupItemEvent
+ itemstack = entityitem.getItemStack(); // CraftBukkit - update ItemStack from event
int i = itemstack.getCount();
if (i > 1) {
@@ -923,6 +923,11 @@
@@ -923,6 +924,11 @@
int i = (Integer) iblockdata.get(BlockSweetBerryBush.a);
iblockdata.set(BlockSweetBerryBush.a, 1);
@@ -32,7 +33,7 @@
int j = 1 + EntityFox.this.world.random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getEquipment(EnumItemSlot.MAINHAND);
@@ -962,7 +967,7 @@
@@ -962,7 +968,7 @@
private int f;
public r() {
@@ -41,7 +42,7 @@
this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK));
}
@@ -1014,7 +1019,7 @@
@@ -1014,7 +1020,7 @@
private int c;
public t() {
@@ -50,7 +51,7 @@
this.c = EntityFox.this.random.nextInt(140);
this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK, PathfinderGoal.Type.JUMP));
}
@@ -1125,7 +1130,7 @@
@@ -1125,7 +1131,7 @@
private EntityLiving k;
private int l;
@@ -59,7 +60,7 @@
super(EntityFox.this, oclass, 10, flag, flag1, predicate);
}
@@ -1205,6 +1210,14 @@
@@ -1205,6 +1211,14 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.b(entityplayer1.getUniqueID());
}
@@ -74,7 +75,7 @@
if (entityplayer2 != null) {
entityplayer2.a(StatisticList.ANIMALS_BRED);
@@ -1217,10 +1230,14 @@
@@ -1217,10 +1231,14 @@
this.partner.resetLove();
entityfox.setAgeRaw(-24000);
entityfox.setPositionRotation(this.animal.locX(), this.animal.locY(), this.animal.locZ(), 0.0F, 0.0F);