Fix EndermanEscapeEvent RUNAWAY being cancelled should also keep target

This will allow you to keep the enderman attacking the player instead
of running away.
This commit is contained in:
Aikar
2018-05-01 17:03:12 -04:00
parent c84c87f8b2
commit c476e3abd1
2 changed files with 10 additions and 10 deletions

View File

@@ -8,7 +8,7 @@ Fires an event anytime an enderman intends to teleport away from the player
You may cancel this, enabling ranged attacks to damage the enderman for example.
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 2f59e7071..7b1fb6b7b 100644
index 2f59e7071..bf32e386c 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -0,0 +0,0 @@
@@ -32,14 +32,14 @@ index 2f59e7071..7b1fb6b7b 100644
public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
if (this.world.D() && this.ticksLived >= this.bA + 600) {
float f = this.aw();
if (f > 0.5F && this.world.h(new BlockPosition(this)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
- if (f > 0.5F && this.world.h(new BlockPosition(this)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.world.h(new BlockPosition(this)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
this.setGoalTarget((EntityLiving) null);
- this.dm();
+ if (tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) this.dm(); // Paper
this.dm();
}
}
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {