summaryrefslogtreecommitdiffhomepage
path: root/patches/server/0138-Item-canEntityPickup.patch
blob: 35734d93540bfeff50d862b3eca5ef7f7527b15a (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
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/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index eee466e718f52329f8200ff830f5f1e44cda3e7e..dad26405e90c7a784266a336ff1b0aa58b961261 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -665,6 +665,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 9ffcccef6266e1a61cfae36cbc205b8178a732de..62288f9152a6fb2c272c7e84649af06b24032542 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -51,6 +51,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<? extends ItemEntity> 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 d08869c92f15a63f857d88e506f744f5ff9eb15e..5f36b0fd12ccd0e7ec9a7f61c56f08307844935f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -66,6 +66,18 @@ public class CraftItem extends CraftEntity implements Item {
         }
     }
 
+    // Paper Start
+    @Override
+    public boolean canMobPickup() {
+        return item.canMobPickup;
+    }
+
+    @Override
+    public void setCanMobPickup(boolean canMobPickup) {
+        item.canMobPickup = canMobPickup;
+    }
+    // Paper End
+
     @Override
     public void setOwner(UUID uuid) {
         this.item.setTarget(uuid);