PaperMC/patches/server/0509-fix-PigZombieAngerEvent-cancellation.patch

36 lines
2.3 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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
2024-10-23 20:15:25 +02:00
index faaaee79e14adb62e810641ccc8f51428d39883d..03e3cbe73119ca76417d4dd192e1560bdfc373ec 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
2024-06-13 23:42:02 +02:00
@@ -56,6 +56,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
2024-04-24 15:46:45 +02:00
private static final int ALERT_RANGE_Y = 10;
private static final UniformInt ALERT_INTERVAL = TimeUtil.rangeOfSeconds(4, 6);
2021-06-11 14:02:28 +02:00
private int ticksUntilNextAlert;
+ private HurtByTargetGoal pathfinderGoalHurtByTarget; // Paper - fix PigZombieAngerEvent cancellation
2021-06-11 14:02:28 +02:00
public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> type, Level world) {
super(type, world);
2024-06-13 23:42:02 +02:00
@@ -71,7 +72,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
2021-06-11 14:02:28 +02:00
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
2021-06-11 14:02:28 +02:00
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true));
}
2024-06-13 23:42:02 +02:00
@@ -179,6 +180,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
2023-06-08 03:13:54 +02:00
this.level().getCraftServer().getPluginManager().callEvent(event);
2021-06-11 14:02:28 +02:00
if (event.isCancelled()) {
this.setPersistentAngerTarget(null);
+ pathfinderGoalHurtByTarget.stop(); // Paper - fix PigZombieAngerEvent cancellation
2021-06-11 14:02:28 +02:00
return;
}
this.setRemainingPersistentAngerTime(event.getNewAnger());