3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0209-Item-canEntityPickup.patch
Zach Brown 6f2009754d
Stop explicitly blocking Vanilla Method Profiler
At the time this was re-added, there was concern around how the JIT
would handle the system property that enabled it.

This shouldn't be a problem, and as such we no longer need to block
access to it.

The Vanilla Method Profiler will not provide much to most users however
there is no harm in providing it as an option. For most users, the
recommended and supported method for determining performance issues with
Paper will continue to be Timings.
2018-03-31 14:55:42 -04:00

60 Zeilen
2.3 KiB
Diff

From b03021584a918c0fd7ad5ae659da9f53a2ea21dd 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 5ea9f309..89e87836 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -514,6 +514,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 6593fc63..99dbb139 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -22,6 +22,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.14.3