summaryrefslogtreecommitdiffstats
path: root/nms-patches/PathfinderGoalMakeLove.patch
blob: 4ef924b9d757618e870eb18a1ddab47db1d48052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- a/net/minecraft/server/PathfinderGoalMakeLove.java
+++ b/net/minecraft/server/PathfinderGoalMakeLove.java
@@ -80,6 +80,11 @@
 
     private void i() {
         EntityVillager entityvillager = this.a.b((EntityAgeable) this.b);
+        // CraftBukkit start - call EntityBreedEvent
+        if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityvillager, this.a, this.b, null, null, 0).isCancelled()) {
+            return;
+        }
+        // CraftBukkit end
 
         this.b.setAgeRaw(6000);
         this.a.setAgeRaw(6000);
@@ -87,7 +92,7 @@
         this.a.v(false);
         entityvillager.setAgeRaw(-24000);
         entityvillager.setPositionRotation(this.a.locX, this.a.locY, this.a.locZ, 0.0F, 0.0F);
-        this.c.addEntity(entityvillager);
+        this.c.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
         this.c.broadcastEntityEffect(entityvillager, (byte) 12);
     }
 }