mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 12:20:11 +00:00
Add EnderManAngerEvent to make it possible to prevent endermen getting angry at a player based on more then their helmet. (#8406)
This commit is contained in:
1 parent
796cb29904
commit
1e6845669c
3 files changed
+53
-2
No files matched your search
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Minecraft Forge - Forge Development LLC
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.world.entity.monster.EnderMan;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
/**
|
||||
* This event is fired on the forge bus before an Enderman detects that a player is looking at them.
|
||||
* It will not be fired if the detection is already prevented by {@link IForgeItem#isEnderMask}
|
||||
* <p>
|
||||
* This event is {@link Cancelable}.
|
||||
* If this event is canceled, the Enderman will not target the player.
|
||||
* <p>
|
||||
* This event does not have a {@link Result}.
|
||||
*/
|
||||
@Cancelable
|
||||
public class EnderManAngerEvent extends LivingEvent
|
||||
{
|
||||
private final Player player;
|
||||
|
||||
public EnderManAngerEvent(EnderMan enderman, Player player)
|
||||
{
|
||||
super(enderman);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* The player that is being checked.
|
||||
*/
|
||||
public Player getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnderMan getEntity()
|
||||
{
|
||||
return (EnderMan) super.getEntity();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user