mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-03 14:11:27 +01:00
SPIGOT-6483: Fix cancelling EntityPickupEvent for villagers
By: md_5 <git@md-5.net>
This commit is contained in:
parent
14af2c0a70
commit
2784d9c66a
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/world/InventorySubcontainer.java
|
--- a/net/minecraft/world/InventorySubcontainer.java
|
||||||
+++ b/net/minecraft/world/InventorySubcontainer.java
|
+++ b/net/minecraft/world/InventorySubcontainer.java
|
||||||
@@ -13,13 +13,64 @@
|
@@ -13,13 +13,69 @@
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
@ -54,6 +54,11 @@
|
|||||||
+ public Location getLocation() {
|
+ public Location getLocation() {
|
||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ public InventorySubcontainer(InventorySubcontainer original) {
|
||||||
|
+ this.a = original.a;
|
||||||
|
+ this.items = NonNullList.a(ItemStack.b, original.items.toArray(ItemStack[]::new));
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
public InventorySubcontainer(int i) {
|
public InventorySubcontainer(int i) {
|
||||||
+ this(i, null);
|
+ this(i, null);
|
||||||
|
@ -90,24 +90,20 @@
|
|||||||
this.fq();
|
this.fq();
|
||||||
this.die();
|
this.die();
|
||||||
} else {
|
} else {
|
||||||
@@ -791,9 +811,16 @@
|
@@ -791,6 +811,13 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ ItemStack itemstack1 = inventorysubcontainer.a(itemstack);
|
+ ItemStack remaining = new InventorySubcontainer(inventorysubcontainer).a(itemstack);
|
||||||
+ if (CraftEventFactory.callEntityPickupItemEvent(this, entityitem, itemstack1.getCount(), false).isCancelled()) {
|
+ if (CraftEventFactory.callEntityPickupItemEvent(this, entityitem, remaining.getCount(), false).isCancelled()) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
this.a(entityitem);
|
this.a(entityitem);
|
||||||
this.receive(entityitem, itemstack.getCount());
|
this.receive(entityitem, itemstack.getCount());
|
||||||
- ItemStack itemstack1 = inventorysubcontainer.a(itemstack);
|
ItemStack itemstack1 = inventorysubcontainer.a(itemstack);
|
||||||
+ // ItemStack itemstack1 = inventorysubcontainer.a(itemstack); // CraftBukkit - moved up
|
|
||||||
|
|
||||||
if (itemstack1.isEmpty()) {
|
|
||||||
entityitem.die();
|
|
||||||
@@ -903,7 +930,7 @@
|
@@ -903,7 +930,7 @@
|
||||||
|
|
||||||
if (entityirongolem != null) {
|
if (entityirongolem != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user