13
0
geforkt von Mirrors/Paper
Paper/patches/unapplied/server/0200-EndermanAttackPlayerEvent.patch

31 Zeilen
1.6 KiB
Diff

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
index aa7762037c3bcbbb3e51325b2ba91d5ad6db0ab0..13ba764d51f941c2b0d1d2af88ffd0c1fc3982c0 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
2023-09-22 00:01:00 +02:00
@@ -236,7 +236,15 @@ public class EnderMan extends Monster implements NeutralMob {
2023-06-07 21:54:11 +02:00
this.readPersistentAngerSaveData(this.level(), nbt);
2021-06-12 21:30:37 +02:00
}
2023-09-22 00:01:00 +02:00
2021-06-12 21:30:37 +02:00
- 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
2021-06-12 21:30:37 +02:00
ItemStack itemstack = (ItemStack) player.getInventory().armor.get(3);
2023-09-22 00:01:00 +02:00
2021-06-12 21:30:37 +02:00
if (itemstack.is(Blocks.CARVED_PUMPKIN.asItem())) {