1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2024-12-23 15:00:30 +01:00
PaperMC/patches/server/0188-EndermanAttackPlayerEvent.patch

29 lines
1.5 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
2024-10-23 00:02:50 +02:00
index d7145b3a19402a03d0af02822ffcb0ef07eaa663..5f1bbb4302013c2c1788db6b64eafba2a11a373a 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
2024-10-23 00:02:50 +02:00
@@ -234,6 +234,14 @@ public class EnderMan extends Monster implements NeutralMob {
2021-06-12 21:30:37 +02:00
}
2023-09-22 00:01:00 +02:00
2024-10-23 00:02:50 +02:00
boolean isBeingStaredBy(Player player) {
2021-06-12 21:30:37 +02:00
+ // Paper start - EndermanAttackPlayerEvent
2024-10-23 00:02:50 +02:00
+ boolean shouldAttack = isBeingStaredBy0(player);
2021-06-12 21:30:37 +02:00
+ 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();
+ }
2024-10-23 00:02:50 +02:00
+ private boolean isBeingStaredBy0(Player player) {
+ // Paper end - EndermanAttackPlayerEvent
return this.isLookingAtMe(player, 0.025D, true, false, LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM, new DoubleSupplier[]{this::getEyeY});
}
2023-09-22 00:01:00 +02:00