mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-23 08:49:18 +00:00
[ci-skip] finish patches
This commit is contained in:
21
patches/server/0026-Fix-mobs-attacking-themselves.patch
Normal file
21
patches/server/0026-Fix-mobs-attacking-themselves.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: etil2jz <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Fri, 29 Apr 2022 12:08:22 +0200
|
||||
Subject: [PATCH] Fix mobs attacking themselves
|
||||
|
||||
If an entity is provoked by a second one using commands,
|
||||
the second will join in the fight against itself,
|
||||
causing it to attack itself repeatedly. See https://bugs.mojang.com/browse/MC-110386.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
index 39ea15c7577af186d93d4ad9a48034d746a86fc8..1de734820a5a4b1580c123a8e4a2513d52c42a4b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
@@ -114,6 +114,7 @@ public class HurtByTargetGoal extends TargetGoal {
|
||||
}
|
||||
|
||||
protected void alertOther(Mob mob, LivingEntity target) {
|
||||
+ if (mob == target) return; // DivineMC - avoid entities with suicidal thoughts /s
|
||||
mob.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user