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

@ -27,15 +27,15 @@ index cc1914d8c..606c0bed8 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 01c7fcc8b..f7f9d4897 100644 index 01c7fcc8b..8e6428a0c 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java --- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -0,0 +0,0 @@ public abstract class EntityProjectile extends Entity implements IProjectile { @@ -0,0 +0,0 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
if ((this.shooterName == null || this.shooterName.isEmpty()) && this.shooter instanceof EntityHuman) { if (this.shooterName != null && this.shooterName.isEmpty()) {
this.shooterName = this.shooter.getName(); this.shooterName = null;
} }
+ if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooterName = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit + if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooterName = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
nbttagcompound.setString("ownerName", this.shooterName == null ? "" : this.shooterName); this.shooter = this.getShooter();
} }
-- --

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. 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 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 --- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -0,0 +0,0 @@ @@ -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) { public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setGoalTarget(entityliving, reason, fireEvent)) { if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster { @@ -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.setGoalTarget((EntityLiving) null);
- this.dm(); this.dm();
+ if (tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) this.dm(); // Paper
} }
}
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster { @@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
public boolean damageEntity(DamageSource damagesource, float f) { public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) { if (this.isInvulnerable(damagesource)) {