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
|
2024-04-25 23:21:18 +02:00
|
|
|
index 0e88a2212435ff70b5ee661de3977df2b456b29b..2f33036a78a120898b18301bae1585c65fdb69dc 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
|
2024-04-25 23:21:18 +02:00
|
|
|
@@ -715,6 +715,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
|
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())) {
|
2024-01-22 19:01:10 +01:00
|
|
|
+ // Paper start - Item#canEntityPickup
|
2021-06-11 14:02:28 +02:00
|
|
|
+ if (!entityitem.canMobPickup) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
2024-01-22 19:01:10 +01:00
|
|
|
+ // Paper end - Item#canEntityPickup
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2024-04-24 03:25:14 +02:00
|
|
|
index 16e3bdf6a2789a0828fc9d879b441fa4bd12d428..707fe72003a254a84ceef8a0572fff52997a4129 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
|
2024-04-24 03:25:14 +02:00
|
|
|
@@ -59,6 +59,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
|
2024-01-22 19:01:10 +01:00
|
|
|
+ public boolean canMobPickup = true; // Paper - Item#canEntityPickup
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
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
|
2024-01-19 22:13:42 +01:00
|
|
|
index fb3738f4c558796f41e3327dd41b8aec68007a8a..5620a0849fda49313c68edfd747fedd09641a3d5 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-10-22 21:12:00 +02:00
|
|
|
@@ -63,6 +63,18 @@ public class CraftItem extends CraftEntity implements Item {
|
2022-03-13 08:47:54 +01:00
|
|
|
}
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper start
|
2021-06-12 12:26:21 +02:00
|
|
|
+ @Override
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public boolean canMobPickup() {
|
2023-10-22 21:12:00 +02:00
|
|
|
+ return this.getHandle().canMobPickup;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
2021-06-12 12:26:21 +02:00
|
|
|
+ @Override
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public void setCanMobPickup(boolean canMobPickup) {
|
2023-10-22 21:12:00 +02:00
|
|
|
+ this.getHandle().canMobPickup = canMobPickup;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper end
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public void setOwner(UUID uuid) {
|
2023-10-22 21:12:00 +02:00
|
|
|
this.getHandle().setTarget(uuid);
|