13
0
geforkt von Mirrors/Paper

fix StopAttackingIfTargetInvalid behavior

Dieser Commit ist enthalten in:
Jason Penilla 2021-06-15 16:54:59 -07:00
Ursprung ca8a47f9e8
Commit 64c6ffb24e

Datei anzeigen

@ -36,13 +36,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- protected void clearAttackTarget(E entity) {
+ protected void clearAttackTarget(E e0, EntityTargetEvent.TargetReason reason) {
+ protected void clearAttackTarget(E entity, EntityTargetEvent.TargetReason reason) {
// CraftBukkit start
- LivingEntity old = entity.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
- EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entity, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
+ // Paper start - fix this event
+ //EntityLiving old = e0.getBehaviorController().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, null, reason);
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entity, null, reason);
if (event.isCancelled()) {
return;
}
@ -56,8 +56,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }*/
+ // Paper end
// CraftBukkit end
- this.onTargetErased.accept(entity);
- entity.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
+ this.onTargetErased.accept(e0);
}
}
this.onTargetErased.accept(entity);
entity.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);