Paper/patches/server/0198-EndermanAttackPlayerEvent.patch

31 lines
1.6 KiB
Diff
Raw Normal View History

2021-06-12 21:30:37 +02:00
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
2023-03-14 19:59:51 +01:00
index 54088f183e218e10d48e07f3f66b2fdb892a1035..908ef284f17296c72009a5803dfefff13664fb1c 100644
2021-06-12 21:30:37 +02:00
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
2022-12-07 19:52:24 +01:00
@@ -230,7 +230,15 @@ public class EnderMan extends Monster implements NeutralMob {
2021-06-12 21:30:37 +02:00
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())) {