aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0539-fix-PigZombieAngerEvent-cancellation.patch
blob: 8b29ccdead82df399cd31c1c4944ae17d55d2f3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
Date: Thu, 18 Mar 2021 21:38:01 +0100
Subject: [PATCH] fix PigZombieAngerEvent cancellation


diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
index 7e703bf1ca3cf824b06b6be731b866cd407aaff1..fbabbd0808304f5d0d12f987d00c9e43a89fb1c9 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
@@ -57,6 +57,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
     private int ticksUntilNextAlert;
     private static final float ZOMBIFIED_PIGLIN_EYE_HEIGHT = 1.79F;
     private static final float ZOMBIFIED_PIGLIN_BABY_EYE_HEIGHT_ADJUSTMENT = 0.82F;
+    private HurtByTargetGoal pathfinderGoalHurtByTarget; // Paper - fix PigZombieAngerEvent cancellation
 
     public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> type, Level world) {
         super(type, world);
@@ -72,7 +73,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
     protected void addBehaviourGoals() {
         this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0D, false));
         this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D));
-        this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers());
+        this.targetSelector.addGoal(1, pathfinderGoalHurtByTarget = (new HurtByTargetGoal(this, new Class[0])).setAlertOthers()); // Paper - fix PigZombieAngerEvent cancellation
         this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
         this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true));
     }
@@ -180,6 +181,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
         this.level().getCraftServer().getPluginManager().callEvent(event);
         if (event.isCancelled()) {
             this.setPersistentAngerTarget(null);
+            pathfinderGoalHurtByTarget.stop(); // Paper - fix PigZombieAngerEvent cancellation
             return;
         }
         this.setRemainingPersistentAngerTime(event.getNewAnger());