From 87c17a40cc25d63c2bdb679bd108f751353bbc85 Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Wed, 9 Jul 2025 04:29:58 +0800 Subject: [PATCH] Apply default item pickup delay in throwing item for non-villager entity With Minecraft updates, allay and pligin also have throw item behavior, calling this method. Needs to keep item pickup delay since they are not villager entity, and also be consistent with vanilla --- .../features/0028-Reduce-villager-item-re-pickup.patch | 6 ++++-- .../features/0147-Remove-stream-in-BehaviorUtils.patch | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/leaf-server/minecraft-patches/features/0028-Reduce-villager-item-re-pickup.patch b/leaf-server/minecraft-patches/features/0028-Reduce-villager-item-re-pickup.patch index 90d7049f..05c379d3 100644 --- a/leaf-server/minecraft-patches/features/0028-Reduce-villager-item-re-pickup.patch +++ b/leaf-server/minecraft-patches/features/0028-Reduce-villager-item-re-pickup.patch @@ -18,10 +18,10 @@ Helps 1.8 Farms let hoppers pick it up before Villager due to our hopper changes diff --git a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java -index 2664d72c3b6906d0505df2e63c0e5075eba9461b..e7f74b4f54069ffdf74f029639cbf0756f2db095 100644 +index 2664d72c3b6906d0505df2e63c0e5075eba9461b..cc8f0586fca7b12a95afadb08d51077c74713ce3 100644 --- a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java +++ b/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java -@@ -87,7 +87,17 @@ public class BehaviorUtils { +@@ -87,7 +87,19 @@ public class BehaviorUtils { Vec3 vec3 = offset.subtract(entity.position()); vec3 = vec3.normalize().multiply(speedMultiplier.x, speedMultiplier.y, speedMultiplier.z); itemEntity.setDeltaMovement(vec3); @@ -35,6 +35,8 @@ index 2664d72c3b6906d0505df2e63c0e5075eba9461b..e7f74b4f54069ffdf74f029639cbf075 + } else { + itemEntity.pickupDelay = repickupDelay; + } ++ } else { ++ itemEntity.setDefaultPickUpDelay(); + } + // Gale end - EMC - reduce villager item re-pickup // CraftBukkit start diff --git a/leaf-server/minecraft-patches/features/0147-Remove-stream-in-BehaviorUtils.patch b/leaf-server/minecraft-patches/features/0147-Remove-stream-in-BehaviorUtils.patch index a03455de..c9a02859 100644 --- a/leaf-server/minecraft-patches/features/0147-Remove-stream-in-BehaviorUtils.patch +++ b/leaf-server/minecraft-patches/features/0147-Remove-stream-in-BehaviorUtils.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove stream in BehaviorUtils diff --git a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java -index e7f74b4f54069ffdf74f029639cbf0756f2db095..b5257eefa04e930b45ffd9d46f28e53026ad728f 100644 +index cc8f0586fca7b12a95afadb08d51077c74713ce3..ceddfed85cedbe2ddaea9ef6530688b69f087874 100644 --- a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java +++ b/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java -@@ -110,10 +110,33 @@ public class BehaviorUtils { +@@ -112,10 +112,33 @@ public class BehaviorUtils { public static SectionPos findSectionClosestToVillage(ServerLevel serverLevel, SectionPos sectionPos, int radius) { int i = serverLevel.sectionsToVillage(sectionPos);