diff options
Diffstat (limited to 'patches/server/0189-EndermanAttackPlayerEvent.patch')
-rw-r--r-- | patches/server/0189-EndermanAttackPlayerEvent.patch | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/patches/server/0189-EndermanAttackPlayerEvent.patch b/patches/server/0189-EndermanAttackPlayerEvent.patch new file mode 100644 index 0000000000..a4e97fbce3 --- /dev/null +++ b/patches/server/0189-EndermanAttackPlayerEvent.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Tue, 1 May 2018 20:18:54 -0400 +Subject: [PATCH] EndermanAttackPlayerEvent + +Allow control over whether or not an enderman aggros a player. + +This allows you to override/extend the pumpkin/stare logic. + +diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +index 51e9988685b1a9a3d4d2effec63560b0ae9e8d3a..70888dd25b6a1d1ab7702d73a64a47eebafe76fe 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +@@ -233,7 +233,15 @@ public class EnderMan extends Monster implements NeutralMob { + this.readPersistentAngerSaveData(this.level(), nbt); + } + +- boolean isLookingAtMe(Player player) { ++ // Paper start - EndermanAttackPlayerEvent ++ private boolean isLookingAtMe(Player player) { ++ boolean shouldAttack = isLookingAtMe_check(player); ++ com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) player.getBukkitEntity()); ++ event.setCancelled(!shouldAttack); ++ return event.callEvent(); ++ } ++ private boolean isLookingAtMe_check(Player player) { ++ // Paper end - EndermanAttackPlayerEvent + ItemStack itemstack = (ItemStack) player.getInventory().armor.get(3); + + if (itemstack.is(Blocks.CARVED_PUMPKIN.asItem())) { |