From c476e3abd1786a4aa85a4116e4181aaeb95e58a8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 1 May 2018 17:03:12 -0400 Subject: [PATCH] Fix EndermanEscapeEvent RUNAWAY being cancelled should also keep target This will allow you to keep the enderman attacking the player instead of running away. --- .../Block-Enderpearl-Travel-Exploit.patch | 8 ++++---- Spigot-Server-Patches/EndermanEscapeEvent.patch | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch b/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch index bc629962c2..8155ab10ad 100644 --- a/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch +++ b/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch @@ -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 -index 01c7fcc8b..f7f9d4897 100644 +index 01c7fcc8b..8e6428a0c 100644 --- a/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 { - if ((this.shooterName == null || this.shooterName.isEmpty()) && this.shooter instanceof EntityHuman) { - this.shooterName = this.shooter.getName(); + if (this.shooterName != null && this.shooterName.isEmpty()) { + 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 - nbttagcompound.setString("ownerName", this.shooterName == null ? "" : this.shooterName); + this.shooter = this.getShooter(); } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/EndermanEscapeEvent.patch b/Spigot-Server-Patches/EndermanEscapeEvent.patch index 3237d32c44..89f71cec53 100644 --- a/Spigot-Server-Patches/EndermanEscapeEvent.patch +++ b/Spigot-Server-Patches/EndermanEscapeEvent.patch @@ -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)) {