9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-29 19:49:09 +00:00
Files
Gale/patches/server/0079-Fix-MC-110386.patch
2023-08-09 20:17:44 +02:00

53 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
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 80ef4b6649da3049f21624926fa38595d76c5da5..7ce47abc44e0dfe8ff90afeb25b14d8d98e6b1cc 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 98355899e6307bc9471e2af247e8f3286a86e6dc..1a5d249268fc09a5117193d0f351676e9a083e16 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
@@ -292,6 +292,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 boolean tryRespawnEnderDragonAfterEndCrystalPlace = true; // Gale - Pufferfish - make ender dragon respawn attempt after placing end crystals configurable