Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/EntityPigZombie.patch
2019-06-21 20:00:00 +10:00

34 Zeilen
1.4 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.a(entity);
}
- return super.damageEntity(damagesource, f);
+ return result;
+ // CraftBukkit end
}
}
private boolean a(Entity entity) {
- this.angerLevel = this.ef();
+ // CraftBukkit start
+ 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()) {
+ return false;
+ }
+ this.angerLevel = event.getNewAnger();
+ // CraftBukkit end
this.soundDelay = this.random.nextInt(40);
if (entity instanceof EntityLiving) {
this.setLastDamager((EntityLiving) entity);