Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
31 Zeilen
1.6 KiB
Diff
31 Zeilen
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 1dea327e8df8651940f204bb96f56a8f6294aaed..bf5b7b996c9141c7cef9c281323115bd593dc777 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
|
@@ -236,7 +236,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())) {
|