Paper/Remapped-Spigot-Server-Patches/0678-MC-29274-Fix-Wither-hostility-towards-players.patch
2021-06-11 13:56:17 +02:00

34 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TheShermanTanker <tanksherman27@gmail.com>
Date: Thu, 1 Oct 2020 01:11:03 +0800
Subject: [PATCH] MC-29274: Fix Wither hostility towards players
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index bbb1d0ed9e76f414dc7d73b4f7786891425f55cd..eb367b8feda8219a97a547c3ef6ab82d278d2f25 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -805,4 +805,10 @@ public class PaperWorldConfig {
private void setUpdatePathfindingOnBlockUpdate() {
updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate);
}
+
+ public boolean fixWitherTargetingBug = false;
+ private void witherSettings() {
+ fixWitherTargetingBug = getBoolean("fix-wither-targeting-bug", false);
+ log("Withers properly target players: " + fixWitherTargetingBug);
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index fd91c80cd6337b5fa41d6060ecdb44b8fa68a16a..b364b442d4cb1f3351850140b85c62c30c888bed 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -102,6 +102,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F));
this.goalSelector.addGoal(7, new RandomLookAroundGoal(this));
this.targetSelector.addGoal(1, new HurtByTargetGoal(this, new Class[0]));
+ if(this.level.paperConfig.fixWitherTargetingBug) this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 0, false, false, null)); // Paper - Fix MC-29274
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Mob.class, 0, false, false, WitherBoss.LIVING_ENTITY_SELECTOR));
}