From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 5 May 2017 03:57:17 -0500 Subject: [PATCH] Item#canEntityPickup diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java index 3d054cfa5050f4b75eab4a18035655c1bfd9290b..fa0e96fd884a0338b44f68506b1d3ee6c42f17b1 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -670,6 +670,11 @@ public abstract class Mob extends LivingEntity implements Targeting { ItemEntity entityitem = (ItemEntity) iterator.next(); if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) { + // Paper start + if (!entityitem.canMobPickup) { + continue; + } + // Paper end this.pickUpItem(entityitem); } } diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java index 5bb26ca5c81635d27ca59352d5184d8b4300e0b5..6905090f030c86f640e841e94c32ad90acb75d2a 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -54,6 +54,7 @@ public class ItemEntity extends Entity implements TraceableEntity { public UUID target; public final float bobOffs; private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit + public boolean canMobPickup = true; // Paper public ItemEntity(EntityType type, Level world) { super(type, world); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java index fb3738f4c558796f41e3327dd41b8aec68007a8a..5620a0849fda49313c68edfd747fedd09641a3d5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java @@ -63,6 +63,18 @@ public class CraftItem extends CraftEntity implements Item { } } + // Paper start + @Override + public boolean canMobPickup() { + return this.getHandle().canMobPickup; + } + + @Override + public void setCanMobPickup(boolean canMobPickup) { + this.getHandle().canMobPickup = canMobPickup; + } + // Paper end + @Override public void setOwner(UUID uuid) { this.getHandle().setTarget(uuid);