mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-17 18:47:40 +01:00
fix StopAttackingIfTargetInvalid behavior
This commit is contained in:
parent
ca8a47f9e8
commit
64c6ffb24e
1 changed files with 4 additions and 7 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue