2021-06-11 14:02:28 +02: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
|
2023-09-21 22:35:39 +02:00
|
|
|
index 873a96693110982600d3e7979489fb00f3cd7941..645ee527b9e7e7edbf3320eae6e441bea84f58f9 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
2023-09-21 22:35:39 +02:00
|
|
|
@@ -669,6 +669,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
2021-06-11 14:02:28 +02:00
|
|
|
ItemEntity entityitem = (ItemEntity) iterator.next();
|
|
|
|
|
2021-06-12 12:26:21 +02:00
|
|
|
if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) {
|
2021-06-11 14:02:28 +02: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
|
2023-09-23 04:06:03 +02:00
|
|
|
index 11dad6b6c6cf922417ab54a1db13d809c10c999e..adb8ac976397322f0b4122fd9469dd5191f207f7 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
2023-07-04 10:22:56 +02:00
|
|
|
@@ -52,6 +52,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
2023-03-14 19:36:39 +01:00
|
|
|
public UUID target;
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2023-08-14 01:32:51 +02:00
|
|
|
index 4fbbc3c76d49c31aadd957ad3a30d479f6c99c15..66e69cb13e2d82acc0a2398625766a49bc701a09 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
2023-08-14 01:32:51 +02:00
|
|
|
@@ -65,6 +65,18 @@ public class CraftItem extends CraftEntity implements Item {
|
2022-03-13 08:47:54 +01:00
|
|
|
}
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper Start
|
2021-06-12 12:26:21 +02:00
|
|
|
+ @Override
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public boolean canMobPickup() {
|
|
|
|
+ return item.canMobPickup;
|
|
|
|
+ }
|
|
|
|
+
|
2021-06-12 12:26:21 +02:00
|
|
|
+ @Override
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public void setCanMobPickup(boolean canMobPickup) {
|
|
|
|
+ item.canMobPickup = canMobPickup;
|
|
|
|
+ }
|
|
|
|
+ // Paper End
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public void setOwner(UUID uuid) {
|
2023-03-14 19:36:39 +01:00
|
|
|
this.item.setTarget(uuid);
|