From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers Date: Tue, 29 Nov 2022 16:42:48 +0100 Subject: [PATCH] Fix MC-121706 License: MIT (https://opensource.org/licenses/MIT) Gale - https://galemc.org This patch is based on the following patch: "MC-121706 - Fix mobs not looking up and down when strafing" By: Krakenied As part of: Purpur (https://github.com/PurpurMC/Purpur) Licensed under: MIT (https://opensource.org/licenses/MIT) * Purpur copyright * MIT License Copyright (c) 2019-2022 PurpurMC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java index 515c1f671cb2c3a7cc23053aedf404bbbe77af3e..df002c7277a718dc156d2d5271fa4768b97f8d86 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java @@ -103,7 +103,10 @@ public class RangedBowAttackGoal extends Go this.strafingTime = 0; } - if (this.strafingTime > -1) { + // Gale start - Purpur - fix MC-121706 + boolean hasStrafingTime = this.strafingTime > -1; + if (hasStrafingTime) { + // Gale end - Purpur - fix MC-121706 if (d > (double)(this.attackRadiusSqr * 0.75F)) { this.strafingBackwards = false; } else if (d < (double)(this.attackRadiusSqr * 0.25F)) { @@ -116,7 +119,10 @@ public class RangedBowAttackGoal extends Go } this.mob.lookAt(livingEntity, 30.0F, 30.0F); - } else { + // Gale start - Purpur - fix MC-121706 + } + if (!hasStrafingTime || this.mob.level().galeConfig().gameplayMechanics.fixes.mc121706) { + // Gale end - Purpur - fix MC-121706 this.mob.getLookControl().setLookAt(livingEntity, 30.0F, 30.0F); } diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java index 3fa354ceef3ec5ab9bca3f13f23aca586dfe09c4..c53cb97b271ca5390b544a1af66182e3c4aefc74 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java @@ -106,6 +106,11 @@ public class GaleWorldConfiguration extends ConfigurationPart { public boolean mc238526 = false; // Gale end - Purpur - fix MC-238526 + // Gale start - Purpur - fix MC-121706 + @Setting("mc-121706") + public boolean mc121706 = false; + // Gale end - Purpur - fix MC-121706 + } public double entityWakeUpDurationRatioStandardDeviation = 0.2; // Gale - variable entity wake-up duration