Paper/patches/server/0599-fix-PigZombieAngerEvent-cancellation.patch
Jake Potrebic 9147456fc9
Updated Upstream (CraftBukkit/Spigot) (#8815)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
ab8ace685 SPIGOT-7236: Bone meal doesn't increase use statistic
7dcb59b8e Avoid switch on material in previous commit

Spigot Changes:
19641c75 SPIGOT-7235: World.Spigot#strikeLightningEffect doesn't do anything
2023-01-27 12:52:04 -08:00

36 lines
2.2 KiB
Diff

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 9620449fb938ad0029b1d126431f15a2994fe332..b75945807b425609394c343da56c316a769f0a29 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
@@ -56,6 +56,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
public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> type, Level world) {
super(type, world);
@@ -76,7 +77,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 - assign field
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true));
}
@@ -184,6 +185,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
this.level.getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
this.setPersistentAngerTarget(null);
+ pathfinderGoalHurtByTarget.stop(); // Paper - clear goalTargets to fix cancellation
return;
}
this.setRemainingPersistentAngerTime(event.getNewAnger());