Paper/patches/server/0200-EndermanAttackPlayerEvent.patch
Jason bc127ea819
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6222)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
eec4aab0 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent
205213c6 SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron

CraftBukkit Changes:
b8c522d5 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent
f04a77dc SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron
d1dbcebc SPIGOT-6653: Canceling snow bucket placement removes snow from bucket
4f34a67b #891: Fix scheduler task ID overflow and duplication issues

Spigot Changes:
d03d7f12 BUILDTOOLS-604: Rebuild patches
2021-07-18 09:41:53 +02:00

31 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 62717899cafaf5452e5bd5e665ecae38f3bd6a2b..72e5e1edaa047d491daeef8ece3638dad30e32ca 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -220,7 +220,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
ItemStack itemstack = (ItemStack) player.getInventory().armor.get(3);
if (itemstack.is(Blocks.CARVED_PUMPKIN.asItem())) {