From b20b05e6314b966cc982ed027c38ac5bb0a8eea9 Mon Sep 17 00:00:00 2001 From: Gergely Sarkozi Date: Fri, 23 Apr 2021 15:06:36 +0200 Subject: [PATCH] fix PigZombieAngerEvent cancellation (fixes #5319) (v2) (#5329) --- ...fix-PigZombieAngerEvent-cancellation.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Spigot-Server-Patches/fix-PigZombieAngerEvent-cancellation.patch diff --git a/Spigot-Server-Patches/fix-PigZombieAngerEvent-cancellation.patch b/Spigot-Server-Patches/fix-PigZombieAngerEvent-cancellation.patch new file mode 100644 index 0000000000..3ccb0867cf --- /dev/null +++ b/Spigot-Server-Patches/fix-PigZombieAngerEvent-cancellation.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Trigary +Date: Thu, 18 Mar 2021 21:38:01 +0100 +Subject: [PATCH] fix PigZombieAngerEvent cancellation + + +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java +@@ -0,0 +0,0 @@ public abstract class PathfinderGoal { + + public void c() { this.start(); } public void start() {} // Paper - OBFHELPER + ++ public final void onTaskResetObfHelper() { d(); } // Paper - OBFHELPER + public void d() { + onTaskReset(); // Paper + } +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityPigZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityPigZombie.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityPigZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityPigZombie.java +@@ -0,0 +0,0 @@ public class EntityPigZombie extends EntityZombie implements IEntityAngerable { + private UUID br; + private static final IntRange bs = TimeRange.a(4, 6); + private int bt; ++ private PathfinderGoalHurtByTarget pathfinderGoalHurtByTarget; // Paper + + public EntityPigZombie(EntityTypes entitytypes, World world) { + super(entitytypes, world); +@@ -0,0 +0,0 @@ public class EntityPigZombie extends EntityZombie implements IEntityAngerable { + protected void m() { + this.goalSelector.a(2, new PathfinderGoalZombieAttack(this, 1.0D, false)); + this.goalSelector.a(7, new PathfinderGoalRandomStrollLand(this, 1.0D)); +- this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this).a(new Class[0])); // CraftBukkit - decompile error ++ this.targetSelector.a(1, pathfinderGoalHurtByTarget = new PathfinderGoalHurtByTarget(this).a(new Class[0])); // CraftBukkit - decompile error // Paper - assign field + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::a_)); + this.targetSelector.a(3, new PathfinderGoalUniversalAngerReset<>(this, true)); + } +@@ -0,0 +0,0 @@ public class EntityPigZombie extends EntityZombie implements IEntityAngerable { + this.world.getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + this.setAngerTarget(null); ++ pathfinderGoalHurtByTarget.onTaskResetObfHelper(); // Paper - clear goalTargets to fix cancellation + return; + } + this.setAnger(event.getNewAnger());