mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 19:28:03 +01:00
EndermanAttackPlayerEvent
Allow control over whether or not an enderman aggros a player. This allows you to override/extend the pumpkin/stare logic.
This commit is contained in:
parent
952a6d631c
commit
40e2712d61
1 changed files with 20 additions and 5 deletions
|
@ -48,7 +48,22 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -241,7 +262,7 @@
|
||||
@@ -212,6 +233,14 @@
|
||||
}
|
||||
|
||||
boolean isBeingStaredBy(Player player) {
|
||||
+ // Paper start - EndermanAttackPlayerEvent
|
||||
+ final boolean shouldAttack = isBeingStaredBy0(player);
|
||||
+ final 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 isBeingStaredBy0(Player player) {
|
||||
+ // Paper end - EndermanAttackPlayerEvent
|
||||
return !LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM.test(player) ? false : this.isLookingAtMe(player, 0.025D, true, false, new double[]{this.getEyeY()});
|
||||
}
|
||||
|
||||
@@ -241,7 +270,7 @@
|
||||
if (world.isDay() && this.tickCount >= this.targetChangeTime + 600) {
|
||||
float f = this.getLightLevelDependentMagicValue();
|
||||
|
||||
|
@ -57,7 +72,7 @@
|
|||
this.setTarget((LivingEntity) null);
|
||||
this.teleport();
|
||||
}
|
||||
@@ -367,11 +388,13 @@
|
||||
@@ -367,11 +396,13 @@
|
||||
} else {
|
||||
flag1 = flag && this.hurtWithCleanWater(world, source, (ThrownPotion) source.getDirectEntity(), amount);
|
||||
|
||||
|
@ -71,7 +86,7 @@
|
|||
|
||||
return flag1;
|
||||
}
|
||||
@@ -465,9 +488,11 @@
|
||||
@@ -465,9 +496,11 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
|
||||
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
|
@ -83,7 +98,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -506,9 +531,11 @@
|
||||
@@ -506,9 +539,11 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
||||
|
||||
if (iblockdata.is(BlockTags.ENDERMAN_HOLDABLE) && flag) {
|
||||
|
@ -95,7 +110,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -592,7 +619,7 @@
|
||||
@@ -592,7 +627,7 @@
|
||||
} else {
|
||||
if (this.target != null && !this.enderman.isPassenger()) {
|
||||
if (this.enderman.isBeingStaredBy((Player) this.target)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue