mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
fix PigZombieAngerEvent cancellation
This commit is contained in:
parent
12f070c05a
commit
83afbd0e3b
1 changed files with 20 additions and 2 deletions
|
@ -1,6 +1,23 @@
|
||||||
--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||||
+++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
+++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||||
@@ -149,7 +149,7 @@
|
@@ -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);
|
||||||
|
@@ -71,7 +72,7 @@
|
||||||
|
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 - 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));
|
||||||
|
}
|
||||||
|
@@ -149,7 +150,7 @@
|
||||||
}).filter((entitypigzombie) -> {
|
}).filter((entitypigzombie) -> {
|
||||||
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
|
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
|
||||||
}).forEach((entitypigzombie) -> {
|
}).forEach((entitypigzombie) -> {
|
||||||
|
@ -9,7 +26,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,22 +158,31 @@
|
@@ -158,22 +159,32 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,6 +57,7 @@
|
||||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ this.setPersistentAngerTarget(null);
|
+ this.setPersistentAngerTarget(null);
|
||||||
|
+ pathfinderGoalHurtByTarget.stop(); // Paper - fix PigZombieAngerEvent cancellation
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ this.setRemainingPersistentAngerTime(event.getNewAnger());
|
+ this.setRemainingPersistentAngerTime(event.getNewAnger());
|
||||||
|
|
Loading…
Reference in a new issue