mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
SPIGOT-4219: Event for PigZombies angering.
This commit is contained in:
parent
5e3082c7d8
commit
195f071e3d
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/server/EntityPigZombie.java
|
--- a/net/minecraft/server/EntityPigZombie.java
|
||||||
+++ b/net/minecraft/server/EntityPigZombie.java
|
+++ b/net/minecraft/server/EntityPigZombie.java
|
||||||
@@ -113,11 +113,15 @@
|
@@ -113,16 +113,27 @@
|
||||||
} else {
|
} else {
|
||||||
Entity entity = damagesource.getEntity();
|
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user