9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-archived-patches/removed/1.21.4/mcserver/0058-Fix-MC-110386.patch
2025-06-29 23:39:55 +08:00

55 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Fri, 23 Dec 2022 15:30:58 +0100
Subject: [PATCH] Fix MC-110386
Removed since Gale 1.21.4, fixed in Minecraft 1.21.2 24w33a
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
This patch is based on the following patch:
"Fix mobs attacking themselves"
By: etil2jz <81570777+etil2jz@users.noreply.github.com>
As part of: Mirai (https://github.com/etil2jz/Mirai)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
* Mirai description *
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 edfc77ba9c5c7dc4cfe997faff7a34e9b9e9365e..6c72dd5774eccec68d29e04dfc344adb69840abf 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,11 @@ public class HurtByTargetGoal extends TargetGoal {
}
protected void alertOther(Mob mob, LivingEntity target) {
+ // Gale start - Mirai - fix MC-110386
+ if (mob == target && mob.level().galeConfig().gameplayMechanics.fixes.mc110386) {
+ return;
+ }
+ // Gale end - Mirai - fix MC-110386
mob.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason
}
}
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
index c53cb97b271ca5390b544a1af66182e3c4aefc74..266079aed0610e0fa9e35da81680b7f388a8844a 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
@@ -111,6 +111,11 @@ public class GaleWorldConfiguration extends ConfigurationPart {
public boolean mc121706 = false;
// Gale end - Purpur - fix MC-121706
+ // Gale start - Mirai - fix MC-110386
+ @Setting("mc-110386")
+ public boolean mc110386 = true;
+ // Gale end - Mirai - fix MC-110386
+
}
public double entityWakeUpDurationRatioStandardDeviation = 0.2; // Gale - variable entity wake-up duration