Paper/Spigot-Server-Patches/0151-Item-canEntityPickup.patch
Aikar 57dd397155
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
b999860d SPIGOT-2304: Add LootGenerateEvent

CraftBukkit Changes:
77fd87e4 SPIGOT-2304: Implement LootGenerateEvent
a1a705ee SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent
41712edd SPIGOT-5707: PersistentDataHolder not Persistent on API dropped Item
2020-05-01 18:03:57 -04:00

59 lines
2.3 KiB
Diff

From e06f91d4710249f1c61283faa5d93f5495654e20 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 1732c1ae95..b5816dc89e 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -521,6 +521,11 @@ public abstract class EntityInsentient extends EntityLiving {
EntityItem entityitem = (EntityItem) iterator.next();
if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p()) {
+ // 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 208dad2a34..97c6a8b6bd 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -20,6 +20,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 cc593fbc99..3f552b5905 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -48,6 +48,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.26.2