From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar 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 ba45d14724c29d227800e76c6a906e60ab6844d6..e9b28c7fea402cb15cfeefe6cd02e3056e54796d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java @@ -233,6 +233,14 @@ public class EnderMan extends Monster implements NeutralMob { } boolean isBeingStaredBy(Player player) { + // Paper start - EndermanAttackPlayerEvent + final boolean shouldAttack = isBeingStaredBy0(player); + final 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 isBeingStaredBy0(Player player) { + // Paper end - EndermanAttackPlayerEvent return !LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM.test(player) ? false : this.isLookingAtMe(player, 0.025D, true, false, new double[]{this.getEyeY()}); }