Paper/patches/server/0662-fix-PigZombieAngerEvent-cancellation.patch
Jason bc127ea819
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6222)
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

Bukkit Changes:
eec4aab0 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent
205213c6 SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron

CraftBukkit Changes:
b8c522d5 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent
f04a77dc SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron
d1dbcebc SPIGOT-6653: Canceling snow bucket placement removes snow from bucket
4f34a67b #891: Fix scheduler task ID overflow and duplication issues

Spigot Changes:
d03d7f12 BUILDTOOLS-604: Rebuild patches
2021-07-18 09:41:53 +02:00

36 lines
2.3 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 214a17f00eec7a59c89ab5799491c7a7315eb72f..025d53ab0787d596f4c486b15d286b9547838e16 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
@@ -51,6 +51,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
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
public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> type, Level world) {
super(type, world);
@@ -71,7 +72,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).setAlertOthers(new Class[0])); // CraftBukkit - decompile error
+ this.targetSelector.addGoal(1, pathfinderGoalHurtByTarget = new HurtByTargetGoal(this).setAlertOthers(new Class[0])); // CraftBukkit - decompile error // 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));
}
@@ -174,6 +175,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());