summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityCreature.patch
blob: 7813c9983508032cb27bbe274909db15172f4e01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- a/net/minecraft/server/EntityCreature.java
+++ b/net/minecraft/server/EntityCreature.java
@@ -2,6 +2,10 @@
 
 import java.util.UUID;
 
+// CraftBukkit start
+import org.bukkit.event.entity.EntityUnleashEvent;
+// CraftBukkit end
+
 public abstract class EntityCreature extends EntityInsentient {
 
     public static final UUID bv = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
@@ -68,6 +72,7 @@
 
             if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
                 if (f > 10.0F) {
+                    this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
                     this.unleash(true, true);
                 }
 
@@ -76,6 +81,7 @@
 
             this.q(f);
             if (f > 10.0F) {
+                this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
                 this.unleash(true, true);
                 this.goalSelector.c(1);
             } else if (f > 6.0F) {