Paper/nms-patches/EntityPigZombie.patch

34 Zeilen
1.4 KiB
Diff

--- a/net/minecraft/server/EntityPigZombie.java
+++ b/net/minecraft/server/EntityPigZombie.java
2019-06-21 12:00:00 +02:00
@@ -134,16 +134,27 @@
} else {
Entity entity = damagesource.getEntity();
2019-06-21 12:00:00 +02:00
- if (entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) {
+ // CraftBukkit start
+ boolean result = super.damageEntity(damagesource, f);
+
2019-06-21 12:00:00 +02:00
+ if (result && entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) {
this.a(entity);
}
- return super.damageEntity(damagesource, f);
+ return result;
+ // CraftBukkit end
}
}
2019-06-21 12:00:00 +02:00
private boolean a(Entity entity) {
- this.angerLevel = this.ef();
+ // CraftBukkit start
2019-06-21 12:00:00 +02:00
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), this.ef());
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
2019-06-21 12:00:00 +02:00
+ return false;
+ }
+ this.angerLevel = event.getNewAnger();
+ // CraftBukkit end
this.soundDelay = this.random.nextInt(40);
if (entity instanceof EntityLiving) {
2018-10-22 21:00:00 +02:00
this.setLastDamager((EntityLiving) entity);