From 727f932d056ccf4e7c025c2ec0597a2158bf086a Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 31 May 2018 18:16:26 -0400 Subject: [PATCH] add Escape Reason Drown for EndermanEscapeEvent to detect rain specifically from every other armor ignoring hit --- Spigot-API-Patches/0098-EndermanEscapeEvent.patch | 14 +++++++++----- .../0292-EndermanEscapeEvent.patch | 8 ++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Spigot-API-Patches/0098-EndermanEscapeEvent.patch b/Spigot-API-Patches/0098-EndermanEscapeEvent.patch index 8ff0f7cc2..3f33e9725 100644 --- a/Spigot-API-Patches/0098-EndermanEscapeEvent.patch +++ b/Spigot-API-Patches/0098-EndermanEscapeEvent.patch @@ -1,4 +1,4 @@ -From 56e8465d9383fd6771c00c0ac017b30844a6fb9b Mon Sep 17 00:00:00 2001 +From 16691e65657636278f4e967df7130d011194d5b9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 30 Apr 2018 13:14:30 -0400 Subject: [PATCH] EndermanEscapeEvent @@ -9,10 +9,10 @@ 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 new file mode 100644 -index 00000000..b8de1037 +index 00000000..0d15a8ab --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanEscapeEvent.java -@@ -0,0 +1,78 @@ +@@ -0,0 +1,82 @@ +package com.destroystokyo.paper.event.entity; + +import org.bukkit.entity.Enderman; @@ -88,9 +88,13 @@ index 00000000..b8de1037 + /** + * 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 + } +} -- -2.17.0 +2.17.1 diff --git a/Spigot-Server-Patches/0292-EndermanEscapeEvent.patch b/Spigot-Server-Patches/0292-EndermanEscapeEvent.patch index 7e05841e8..f2a371be8 100644 --- a/Spigot-Server-Patches/0292-EndermanEscapeEvent.patch +++ b/Spigot-Server-Patches/0292-EndermanEscapeEvent.patch @@ -1,4 +1,4 @@ -From 501fbfa880f4f5ff495424d4360d7b601f03e7cc Mon Sep 17 00:00:00 2001 +From adb90c86f6eba145015f676b640e17a119fdf6ca Mon Sep 17 00:00:00 2001 From: Aikar 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..bf32e386c 100644 +index 2f59e7071..e8ea231dc 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java @@ -1,5 +1,6 @@ @@ -54,7 +54,7 @@ index 2f59e7071..bf32e386c 100644 boolean flag = super.damageEntity(damagesource, f); - 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(); } @@ -77,5 +77,5 @@ index 2f59e7071..bf32e386c 100644 } -- -2.17.0 +2.17.1