mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 23:57:43 +01:00
parent
ec78d78ee8
commit
1ca53dcefe
2 changed files with 93 additions and 0 deletions
34
Spigot-API-Patches/0051-Item-canEntityPickup.patch
Normal file
34
Spigot-API-Patches/0051-Item-canEntityPickup.patch
Normal file
|
@ -0,0 +1,34 @@
|
|||
From e704dc9588b52864b7a812d19cb31db68e34a155 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 5 May 2017 03:57:08 -0500
|
||||
Subject: [PATCH] Item#canEntityPickup
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java
|
||||
index 90260b7e..7163f8b0 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Item.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Item.java
|
||||
@@ -34,4 +34,20 @@ public interface Item extends Entity {
|
||||
* @param delay New delay
|
||||
*/
|
||||
public void setPickupDelay(int delay);
|
||||
+
|
||||
+ // Paper Start
|
||||
+ /**
|
||||
+ * Gets if non-player entities can pick this Item up
|
||||
+ *
|
||||
+ * @return True if non-player entities can pickup
|
||||
+ */
|
||||
+ public boolean canMobPickup();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if non-player entities can pick this Item up
|
||||
+ *
|
||||
+ * @param canMobPickup True to allow non-player entity pickup
|
||||
+ */
|
||||
+ public void setCanMobPickup(boolean canMobPickup);
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
||||
2.11.0
|
||||
|
59
Spigot-Server-Patches/0211-Item-canEntityPickup.patch
Normal file
59
Spigot-Server-Patches/0211-Item-canEntityPickup.patch
Normal file
|
@ -0,0 +1,59 @@
|
|||
From 57a1a544e630803a6471f7ce122d23edf24c6f43 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 1d26555d..3179e627 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -508,6 +508,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 95ca1b8e..207b6f0b 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..6bacf204 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.11.0
|
||||
|
Loading…
Reference in a new issue