--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
@@ -14,6 +14,7 @@
 import net.minecraft.world.Difficulty;
 import net.minecraft.world.DifficultyInstance;
 import net.minecraft.world.damagesource.DamageSource;
+import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.EntityDimensions;
 import net.minecraft.world.entity.EntitySelector;
 import net.minecraft.world.entity.EntityType;
@@ -42,11 +43,10 @@
 import net.minecraft.world.phys.AABB;
 
 public class ZombifiedPiglin extends Zombie implements NeutralMob {
+
     private static final EntityDimensions BABY_DIMENSIONS = EntityType.ZOMBIFIED_PIGLIN.getDimensions().scale(0.5F).withEyeHeight(0.97F);
     private static final ResourceLocation SPEED_MODIFIER_ATTACKING_ID = ResourceLocation.withDefaultNamespace("attacking");
-    private static final AttributeModifier SPEED_MODIFIER_ATTACKING = new AttributeModifier(
-        SPEED_MODIFIER_ATTACKING_ID, 0.05, AttributeModifier.Operation.ADD_VALUE
-    );
+    private static final AttributeModifier SPEED_MODIFIER_ATTACKING = new AttributeModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING_ID, 0.05D, AttributeModifier.Operation.ADD_VALUE);
     private static final UniformInt FIRST_ANGER_SOUND_DELAY = TimeUtil.rangeOfSeconds(0, 1);
     private int playFirstAngerSoundIn;
     private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(20, 39);
@@ -56,6 +56,7 @@
     private static final int ALERT_RANGE_Y = 10;
     private static final UniformInt ALERT_INTERVAL = TimeUtil.rangeOfSeconds(4, 6);
     private int ticksUntilNextAlert;
+    private HurtByTargetGoal pathfinderGoalHurtByTarget; // Paper - fix PigZombieAngerEvent cancellation
 
     public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> type, Level world) {
         super(type, world);
@@ -69,23 +70,20 @@
 
     @Override
     protected void addBehaviourGoals() {
-        this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0, false));
-        this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
-        this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
+        this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0D, false));
+        this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D));
+        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));
     }
 
     public static AttributeSupplier.Builder createAttributes() {
-        return Zombie.createAttributes()
-            .add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.0)
-            .add(Attributes.MOVEMENT_SPEED, 0.23F)
-            .add(Attributes.ATTACK_DAMAGE, 5.0);
+        return Zombie.createAttributes().add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.0D).add(Attributes.MOVEMENT_SPEED, 0.23000000417232513D).add(Attributes.ATTACK_DAMAGE, 5.0D);
     }
 
     @Override
     public EntityDimensions getDefaultDimensions(Pose pose) {
-        return this.isBaby() ? BABY_DIMENSIONS : super.getDefaultDimensions(pose);
+        return this.isBaby() ? ZombifiedPiglin.BABY_DIMENSIONS : super.getDefaultDimensions(pose);
     }
 
     @Override
@@ -95,18 +93,19 @@
 
     @Override
     protected void customServerAiStep() {
-        AttributeInstance attributeInstance = this.getAttribute(Attributes.MOVEMENT_SPEED);
+        AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
+
         if (this.isAngry()) {
-            if (!this.isBaby() && !attributeInstance.hasModifier(SPEED_MODIFIER_ATTACKING_ID)) {
-                attributeInstance.addTransientModifier(SPEED_MODIFIER_ATTACKING);
+            if (!this.isBaby() && !attributemodifiable.hasModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING_ID)) {
+                attributemodifiable.addTransientModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING);
             }
 
             this.maybePlayFirstAngerSound();
-        } else if (attributeInstance.hasModifier(SPEED_MODIFIER_ATTACKING_ID)) {
-            attributeInstance.removeModifier(SPEED_MODIFIER_ATTACKING_ID);
+        } else if (attributemodifiable.hasModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING_ID)) {
+            attributemodifiable.removeModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING_ID);
         }
 
-        this.updatePersistentAnger((ServerLevel)this.level(), true);
+        this.updatePersistentAnger((ServerLevel) this.level(), true);
         if (this.getTarget() != null) {
             this.maybeAlertOthers();
         }
@@ -120,35 +119,39 @@
 
     private void maybePlayFirstAngerSound() {
         if (this.playFirstAngerSoundIn > 0) {
-            this.playFirstAngerSoundIn--;
+            --this.playFirstAngerSoundIn;
             if (this.playFirstAngerSoundIn == 0) {
                 this.playAngerSound();
             }
         }
+
     }
 
     private void maybeAlertOthers() {
         if (this.ticksUntilNextAlert > 0) {
-            this.ticksUntilNextAlert--;
+            --this.ticksUntilNextAlert;
         } else {
             if (this.getSensing().hasLineOfSight(this.getTarget())) {
                 this.alertOthers();
             }
 
-            this.ticksUntilNextAlert = ALERT_INTERVAL.sample(this.random);
+            this.ticksUntilNextAlert = ZombifiedPiglin.ALERT_INTERVAL.sample(this.random);
         }
     }
 
     private void alertOthers() {
-        double d = this.getAttributeValue(Attributes.FOLLOW_RANGE);
-        AABB aABB = AABB.unitCubeFromLowerCorner(this.position()).inflate(d, 10.0, d);
-        this.level()
-            .getEntitiesOfClass(ZombifiedPiglin.class, aABB, EntitySelector.NO_SPECTATORS)
-            .stream()
-            .filter(zombifiedPiglin -> zombifiedPiglin != this)
-            .filter(zombifiedPiglin -> zombifiedPiglin.getTarget() == null)
-            .filter(zombifiedPiglin -> !zombifiedPiglin.isAlliedTo(this.getTarget()))
-            .forEach(zombifiedPiglin -> zombifiedPiglin.setTarget(this.getTarget()));
+        double d0 = this.getAttributeValue(Attributes.FOLLOW_RANGE);
+        AABB axisalignedbb = AABB.unitCubeFromLowerCorner(this.position()).inflate(d0, 10.0D, d0);
+
+        this.level().getEntitiesOfClass(ZombifiedPiglin.class, axisalignedbb, EntitySelector.NO_SPECTATORS).stream().filter((entitypigzombie) -> {
+            return entitypigzombie != this;
+        }).filter((entitypigzombie) -> {
+            return entitypigzombie.getTarget() == null;
+        }).filter((entitypigzombie) -> {
+            return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
+        }).forEach((entitypigzombie) -> {
+            entitypigzombie.setTarget(this.getTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit
+        });
     }
 
     private void playAngerSound() {
@@ -156,27 +159,35 @@
     }
 
     @Override
-    public void setTarget(@Nullable LivingEntity target) {
-        if (this.getTarget() == null && target != null) {
-            this.playFirstAngerSoundIn = FIRST_ANGER_SOUND_DELAY.sample(this.random);
-            this.ticksUntilNextAlert = ALERT_INTERVAL.sample(this.random);
+    public boolean setTarget(@Nullable LivingEntity entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { // CraftBukkit - signature
+        if (this.getTarget() == null && entityliving != null) {
+            this.playFirstAngerSoundIn = ZombifiedPiglin.FIRST_ANGER_SOUND_DELAY.sample(this.random);
+            this.ticksUntilNextAlert = ZombifiedPiglin.ALERT_INTERVAL.sample(this.random);
         }
 
-        if (target instanceof Player) {
-            this.setLastHurtByPlayer((Player)target);
+        if (entityliving instanceof Player) {
+            this.setLastHurtByPlayer((Player) entityliving);
         }
 
-        super.setTarget(target);
+        return super.setTarget(entityliving, reason, fireEvent); // CraftBukkit
     }
 
     @Override
     public void startPersistentAngerTimer() {
-        this.setRemainingPersistentAngerTime(PERSISTENT_ANGER_TIME.sample(this.random));
+        // CraftBukkit start
+        Entity entity = ((ServerLevel) this.level()).getEntity(this.getPersistentAngerTarget());
+        org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), ZombifiedPiglin.PERSISTENT_ANGER_TIME.sample(this.random));
+        this.level().getCraftServer().getPluginManager().callEvent(event);
+        if (event.isCancelled()) {
+            this.setPersistentAngerTarget(null);
+            pathfinderGoalHurtByTarget.stop(); // Paper - fix PigZombieAngerEvent cancellation
+            return;
+        }
+        this.setRemainingPersistentAngerTime(event.getNewAnger());
+        // CraftBukkit end
     }
 
-    public static boolean checkZombifiedPiglinSpawnRules(
-        EntityType<ZombifiedPiglin> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random
-    ) {
+    public static boolean checkZombifiedPiglinSpawnRules(EntityType<ZombifiedPiglin> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
         return world.getDifficulty() != Difficulty.PEACEFUL && !world.getBlockState(pos.below()).is(Blocks.NETHER_WART_BLOCK);
     }
 
@@ -234,7 +245,7 @@
 
     @Override
     protected void randomizeReinforcementsChance() {
-        this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(0.0);
+        this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(0.0D);
     }
 
     @Nullable
