Paper/Spigot-Server-Patches/0185-Item-canEntityPickup.patch
Aikar 3a70bed5f4
Updated Upstream (Bukkit/CraftBukkit) for LootTable API
I have tested that the Replenishing Feature still works as expected.
Lootable API's that now have Bukkit equivalents are now deprecated.

Bukkit Changes:
f0f33981 SPIGOT-1936: LootTable API

CraftBukkit Changes:
c0df4b82 SPIGOT-1936: LootTable API
2018-08-12 13:11:13 -04:00

59 lines
2.3 KiB
Diff

From 9af9c41e54019184086ba7889e8abfe7e5ef2fef Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
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 0cfda190bc..bca2aa8298 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -517,6 +517,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 4af09f5cdb..f2a4476c5c 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<ItemStack> 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