From b076d81196c1378797a0d37d050d0fc193590b82 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/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java index 6f5f3f8cd0..04a1218ed9 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -518,6 +518,11 @@ public abstract class EntityInsentient extends EntityLiving { EntityItem entityitem = (EntityItem) iterator.next(); if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.q()) { + // Paper Start + if (!entityitem.canMobPickup) { + continue; + } + // Paper End this.a(entityitem); } } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index eecebafdad..3e70a06397 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -13,6 +13,7 @@ public class EntityItem extends Entity { private static final DataWatcherObject b = DataWatcher.a(EntityItem.class, DataWatcherRegistry.g); private int age; public int pickupDelay; + public boolean canMobPickup = true; // Paper private int e; private UUID f; private UUID g; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java index a17a537d69..1df17f09bb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java @@ -37,6 +37,16 @@ public class CraftItem extends CraftEntity implements Item { item.pickupDelay = Math.min(delay, Short.MAX_VALUE); } + // Paper Start + public boolean canMobPickup() { + return item.canMobPickup; + } + + public void setCanMobPickup(boolean canMobPickup) { + item.canMobPickup = canMobPickup; + } + // Paper End + @Override public String toString() { return "CraftItem"; -- 2.18.0