From 195f071e3da0229688323a7c39309254ddb0d828 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 5 Aug 2018 10:18:01 +1000 Subject: [PATCH] SPIGOT-4219: Event for PigZombies angering. --- nms-patches/EntityPigZombie.patch | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/nms-patches/EntityPigZombie.patch b/nms-patches/EntityPigZombie.patch index 96303f5cde..0ebbc60173 100644 --- a/nms-patches/EntityPigZombie.patch +++ b/nms-patches/EntityPigZombie.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityPigZombie.java +++ b/net/minecraft/server/EntityPigZombie.java -@@ -113,11 +113,15 @@ +@@ -113,16 +113,27 @@ } else { Entity entity = damagesource.getEntity(); @@ -18,3 +18,16 @@ } } + private void a(Entity entity) { +- this.angerLevel = 400 + this.random.nextInt(400); ++ // 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(), 400 + this.random.nextInt(400)); ++ this.world.getServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ return; ++ } ++ this.angerLevel = event.getNewAnger(); ++ // CraftBukkit end + this.soundDelay = this.random.nextInt(40); + if (entity instanceof EntityLiving) { + this.a((EntityLiving) entity);