aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0178-Item-canEntityPickup.patch
blob: 032db698481b1f19d01b90fd76fb97721d42f286 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From 1853596fcd97ca2e82211602010b3c14e08ffbf7 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 c530824596..98e214cdd6 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -530,6 +530,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 9b854d64fb..39a804b7cb 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);
     public int age; // PAIL
     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 55d6bacf77..6036592f76 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -45,6 +45,16 @@ public class CraftItem extends CraftEntity implements Item {
         item.age = 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.21.0