aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches-Unmapped/0148-Item-canEntityPickup.patch
blob: 3aa1baa985eed167123dd52d421434db7575fd0e (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
From 0000000000000000000000000000000000000000 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/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
index 6ee5e1b0bb34ba490a130fbcbdb7a2706c5ecf86..c22b5f8fcdd4aa7dac242f634ef73edcd8745fc6 100644
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
@@ -607,6 +607,11 @@ public abstract class EntityInsentient extends EntityLiving {
                 EntityItem entityitem = (EntityItem) iterator.next();
 
                 if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p() && this.i(entityitem.getItemStack())) {
+                    // Paper Start
+                    if (!entityitem.canMobPickup) {
+                        continue;
+                    }
+                    // Paper End
                     this.b(entityitem);
                 }
             }
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
index 38b91b450c6bdc25efaed495ce26d909a52531bf..c486c07a358c0b444e1a1372b6d0fa2901840eac 100644
--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java
+++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
@@ -47,6 +47,7 @@ public class EntityItem extends Entity {
     private UUID owner;
     public final float b;
     private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
+    public boolean canMobPickup = true; // Paper
 
     public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
         super(entitytypes, world);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index f333dd2726f554a3137a3a78d162905f4ed1435e..5988cdd18b7e4bfca0075fd2356cfe9c4e673954 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -49,6 +49,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 void setOwner(UUID uuid) {
         item.setOwner(uuid);