SPIGOT-7788: The healing power of friendship advancement is never granted

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2024-06-21 07:37:52 +10:00
parent 2f1800fa2e
commit d67f71f3f4

View file

@ -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();