mirror of
				https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
				synced 2025-10-31 06:25:56 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| --- a/net/minecraft/world/entity/npc/InventoryCarrier.java
 | |
| +++ b/net/minecraft/world/entity/npc/InventoryCarrier.java
 | |
| @@ -8,6 +8,10 @@
 | |
|  import net.minecraft.world.level.storage.ValueInput;
 | |
|  import net.minecraft.world.level.storage.ValueOutput;
 | |
|  
 | |
| +// CraftBukkit start
 | |
| +import org.bukkit.event.entity.EntityRemoveEvent;
 | |
| +// CraftBukkit end
 | |
| +
 | |
|  public interface InventoryCarrier {
 | |
|  
 | |
|      String TAG_INVENTORY = "Inventory";
 | |
| @@ -25,13 +29,20 @@
 | |
|                  return;
 | |
|              }
 | |
|  
 | |
| +            // CraftBukkit start
 | |
| +            ItemStack remaining = new InventorySubcontainer(inventorysubcontainer).addItem(itemstack);
 | |
| +            if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(entityinsentient, entityitem, remaining.getCount(), false).isCancelled()) {
 | |
| +                return;
 | |
| +            }
 | |
| +            // CraftBukkit end
 | |
| +
 | |
|              entityinsentient.onItemPickup(entityitem);
 | |
|              int i = itemstack.getCount();
 | |
|              ItemStack itemstack1 = inventorysubcontainer.addItem(itemstack);
 | |
|  
 | |
|              entityinsentient.take(entityitem, i - itemstack1.getCount());
 | |
|              if (itemstack1.isEmpty()) {
 | |
| -                entityitem.discard();
 | |
| +                entityitem.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause
 | |
|              } else {
 | |
|                  itemstack.setCount(itemstack1.getCount());
 | |
|              }
 |