geforkt von Mirrors/Paper
fix StopAttackingIfTargetInvalid behavior
Dieser Commit ist enthalten in:
Ursprung
ca8a47f9e8
Commit
64c6ffb24e
@ -36,13 +36,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
- protected void clearAttackTarget(E entity) {
|
- protected void clearAttackTarget(E entity) {
|
||||||
+ protected void clearAttackTarget(E e0, EntityTargetEvent.TargetReason reason) {
|
+ protected void clearAttackTarget(E entity, EntityTargetEvent.TargetReason reason) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
- LivingEntity old = entity.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
- 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);
|
- EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entity, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||||
+ // Paper start - fix this event
|
+ // Paper start - fix this event
|
||||||
+ //EntityLiving old = e0.getBehaviorController().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
+ //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()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -56,8 +56,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }*/
|
+ }*/
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
- this.onTargetErased.accept(entity);
|
this.onTargetErased.accept(entity);
|
||||||
- entity.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
|
entity.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
|
||||||
+ this.onTargetErased.accept(e0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren