13
0
geforkt von Mirrors/Paper

add Escape Reason Drown for EndermanEscapeEvent

to detect rain specifically from every other armor ignoring hit
Dieser Commit ist enthalten in:
Aikar 2018-05-31 18:16:26 -04:00
Ursprung 9c32d79355
Commit cb9b5bfa82
2 geänderte Dateien mit 8 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -9,7 +9,7 @@ You may cancel this, enabling ranged attacks to damage the enderman for example.
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java
new file mode 100644 new file mode 100644
index 00000000..b8de1037 index 00000000..0d15a8ab
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
@ -88,7 +88,11 @@ index 00000000..b8de1037
+ /** + /**
+ * The enderman has teleported away due to the player staring at it during combat + * The enderman has teleported away due to the player staring at it during combat
+ */ + */
+ STARE + STARE,
+ /**
+ * Specific case for CRITICAL_HIT where the enderman is taking rain damage
+ */
+ DROWN
+ } + }
+} +}
-- --

Datei anzeigen

@ -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..bf32e386c 100644 index 2f59e7071..e8ea231dc 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 @@
@ -54,7 +54,7 @@ index 2f59e7071..bf32e386c 100644
boolean flag = super.damageEntity(damagesource, f); boolean flag = super.damageEntity(damagesource, f);
- if (damagesource.ignoresArmor() && this.random.nextInt(10) != 0) { - if (damagesource.ignoresArmor() && this.random.nextInt(10) != 0) {
+ if (damagesource.ignoresArmor() && this.random.nextInt(10) != 0 && tryEscape(EndermanEscapeEvent.Reason.CRITICAL_HIT)) { // Paper + if (damagesource.ignoresArmor() && this.random.nextInt(10) != 0 && tryEscape(damagesource == DamageSource.DROWN ? EndermanEscapeEvent.Reason.DROWN : EndermanEscapeEvent.Reason.CRITICAL_HIT)) { // Paper
this.dm(); this.dm();
} }