mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
43 lines
1.9 KiB
Diff
43 lines
1.9 KiB
Diff
--- a/net/minecraft/server/EntityPigZombie.java
|
|
+++ b/net/minecraft/server/EntityPigZombie.java
|
|
@@ -134,16 +134,27 @@
|
|
} else {
|
|
Entity entity = damagesource.getEntity();
|
|
|
|
- if (entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) {
|
|
+ // CraftBukkit start
|
|
+ boolean result = super.damageEntity(damagesource, f);
|
|
+
|
|
+ if (result && entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) {
|
|
this.i((EntityLiving) entity);
|
|
}
|
|
|
|
- return super.damageEntity(damagesource, f);
|
|
+ return result;
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|
|
private boolean i(EntityLiving entityliving) {
|
|
- this.angerLevel = this.ez();
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entityliving == null) ? null : entityliving.getBukkitEntity(), this.ez());
|
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
+ if (event.isCancelled()) {
|
|
+ return false;
|
|
+ }
|
|
+ this.angerLevel = event.getNewAnger();
|
|
+ // CraftBukkit end
|
|
this.soundDelay = this.random.nextInt(40);
|
|
this.setLastDamager(entityliving);
|
|
return true;
|
|
@@ -209,7 +220,7 @@
|
|
@Override
|
|
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
|
if (entityinsentient instanceof EntityPigZombie && this.e.hasLineOfSight(entityliving) && ((EntityPigZombie) entityinsentient).i(entityliving)) {
|
|
- entityinsentient.setGoalTarget(entityliving);
|
|
+ entityinsentient.setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit
|
|
}
|
|
|
|
}
|