From d67f71f3f4963f2e9ac871e3877782ad25a876c9 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Fri, 21 Jun 2024 07:37:52 +1000 Subject: [PATCH] SPIGOT-7788: The healing power of friendship advancement is never granted By: md_5 --- .../entity/ai/behavior/BehaviorAttackTargetForget.patch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.patch b/paper-server/nms-patches/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.patch index 24aed4d7eb..68f2b43b4c 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.patch @@ -13,7 +13,7 @@ public class BehaviorAttackTargetForget { private static final int TIMEOUT_TO_GET_WITHIN_ATTACK_RANGE = 200; -@@ -41,6 +47,18 @@ +@@ -41,6 +47,17 @@ if (entityinsentient.canAttack(entityliving) && (!flag || !isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level() == entityinsentient.level() && !predicate.test(entityliving)) { return true; } else { @@ -23,11 +23,10 @@ + if (event.isCancelled()) { + return false; + } -+ if (event.getTarget() == null) { -+ memoryaccessor.erase(); ++ if (event.getTarget() != null) { ++ entityinsentient.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle()); + return true; + } -+ entityliving = ((CraftLivingEntity) event.getTarget()).getHandle(); + // CraftBukkit end biconsumer.accept(entityinsentient, entityliving); memoryaccessor.erase();