mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
48 lines
2.9 KiB
Diff
48 lines
2.9 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/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<? extends EntityPigZombie> 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());
|