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
|
2022-03-01 04:25:13 +01:00
|
|
|
index 31595c3a225c14f7cab4ab1b50c9905f8dae09a3..6fe49abb9d9a273787828e72061e16a7b053e50a 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
|
2021-11-24 21:43:28 +01:00
|
|
|
@@ -52,6 +52,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
|
2021-06-15 04:59:31 +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
|
|
|
|
|
|
|
|
public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> type, Level world) {
|
|
|
|
super(type, world);
|
2021-11-24 21:43:28 +01:00
|
|
|
@@ -72,7 +73,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));
|
2021-11-24 21:43:28 +01:00
|
|
|
- this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers());
|
|
|
|
+ this.targetSelector.addGoal(1, pathfinderGoalHurtByTarget = (new HurtByTargetGoal(this, new Class[0])).setAlertOthers()); // Paper - assign field
|
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));
|
|
|
|
}
|
2021-11-24 21:43:28 +01:00
|
|
|
@@ -175,6 +176,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
|
2021-06-11 14:02:28 +02:00
|
|
|
this.level.getCraftServer().getPluginManager().callEvent(event);
|
|
|
|
if (event.isCancelled()) {
|
|
|
|
this.setPersistentAngerTarget(null);
|
2021-06-15 04:59:31 +02:00
|
|
|
+ pathfinderGoalHurtByTarget.stop(); // Paper - clear goalTargets to fix cancellation
|
2021-06-11 14:02:28 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.setRemainingPersistentAngerTime(event.getNewAnger());
|