2021-06-11 12:02:28 +00:00
|
|
|
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
|
2022-09-12 11:31:45 +00:00
|
|
|
index 0b056e65b2efe0f96a6beecfc41709bfa18983ca..6d0d194aaababd91a26dffc07f547d60eadd098e 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
2022-09-12 11:31:45 +00:00
|
|
|
@@ -635,6 +635,11 @@ public abstract class Mob extends LivingEntity {
|
2021-06-11 12:02:28 +00:00
|
|
|
ItemEntity entityitem = (ItemEntity) iterator.next();
|
|
|
|
|
2021-06-12 10:26:21 +00:00
|
|
|
if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) {
|
2021-06-11 12:02:28 +00:00
|
|
|
+ // 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
|
2022-07-27 19:49:24 +00:00
|
|
|
index a938d75e229ce77973182c9dd25c995a16ef17f6..581725ab12f6bea1216dbf62d5cf3923d4340844 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
2021-11-23 13:22:49 +00:00
|
|
|
@@ -52,6 +52,7 @@ public class ItemEntity extends Entity {
|
2021-06-11 12:02:28 +00:00
|
|
|
private UUID owner;
|
|
|
|
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
|
2022-03-13 07:47:54 +00:00
|
|
|
index 4ca76a7530f8679567d887cdf1491d110e7465ec..30c954efba587d69ff55df509339f03e7d5a476e 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
2022-03-13 07:47:54 +00:00
|
|
|
@@ -66,6 +66,18 @@ public class CraftItem extends CraftEntity implements Item {
|
|
|
|
}
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper Start
|
2021-06-12 10:26:21 +00:00
|
|
|
+ @Override
|
2021-06-11 12:02:28 +00:00
|
|
|
+ public boolean canMobPickup() {
|
|
|
|
+ return item.canMobPickup;
|
|
|
|
+ }
|
|
|
|
+
|
2021-06-12 10:26:21 +00:00
|
|
|
+ @Override
|
2021-06-11 12:02:28 +00:00
|
|
|
+ public void setCanMobPickup(boolean canMobPickup) {
|
|
|
|
+ item.canMobPickup = canMobPickup;
|
|
|
|
+ }
|
|
|
|
+ // Paper End
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public void setOwner(UUID uuid) {
|
2021-06-12 10:26:21 +00:00
|
|
|
this.item.setOwner(uuid);
|