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 00f24317ff
commit f69fabeb55
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
2 changed files with 14 additions and 14 deletions

View File

@ -1,4 +1,4 @@
From ba5ac2e872e3a9faec221e4d8bae4ee6c689dbbf Mon Sep 17 00:00:00 2001
From 501fbfa880f4f5ff495424d4360d7b601f03e7cc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 30 Apr 2018 13:15:55 -0400
Subject: [PATCH] EndermanEscapeEvent
@ -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
@@ -1,5 +1,6 @@
@ -31,15 +31,15 @@ index 2f59e7071..7b1fb6b7b 100644
@Override
public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
@@ -184,7 +191,7 @@ public class EntityEnderman extends EntityMonster {
@@ -182,7 +189,7 @@ 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();
}
}
@@ -264,7 +271,7 @@ public class EntityEnderman extends EntityMonster {
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {

View File

@ -1,4 +1,4 @@
From e867d5f0aab8446ba423b22e71aa6b35f0aaa328 Mon Sep 17 00:00:00 2001
From c801bfc35cf100dffe42a36980af7d715fa1bafd Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 30 Apr 2018 17:15:26 -0400
Subject: [PATCH] Block Enderpearl Travel Exploit
@ -27,16 +27,16 @@ 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
@@ -250,6 +250,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
if ((this.shooterName == null || this.shooterName.isEmpty()) && this.shooter instanceof EntityHuman) {
this.shooterName = this.shooter.getName();
@@ -271,6 +271,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
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();
}
--
2.17.0