mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
60 lines
2.3 KiB
Diff
60 lines
2.3 KiB
Diff
From 2e4a8765544b8d74e9b212bfdf180ef923cf8359 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 b594602a..a7bee79b 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
@@ -512,6 +512,12 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
while (iterator.hasNext()) {
|
|
EntityItem entityitem = (EntityItem) iterator.next();
|
|
|
|
+ // Paper Start
|
|
+ if (!entityitem.canMobPickup) {
|
|
+ continue;
|
|
+ }
|
|
+ // Paper End
|
|
+
|
|
if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.t()) {
|
|
this.a(entityitem);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
|
index 1927e8e2..08315599 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
|
@@ -19,6 +19,7 @@ public class EntityItem extends Entity implements HopperPusher {
|
|
private static final DataWatcherObject<ItemStack> c = DataWatcher.a(EntityItem.class, DataWatcherRegistry.f);
|
|
private int age;
|
|
public int pickupDelay;
|
|
+ public boolean canMobPickup = true; // Paper
|
|
private int f;
|
|
private String g;
|
|
private String h;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
|
index a17a537d..1df17f09 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.13.1.windows.2
|
|
|