summaryrefslogtreecommitdiffstats
path: root/nms-patches/PathfinderGoalBreed.patch
blob: 3f74b1ac3441228975004b9af963685833666271 (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/PathfinderGoalBreed.java
+++ b/net/minecraft/server/PathfinderGoalBreed.java
@@ -69,6 +69,11 @@
         EntityAgeable entityageable = this.animal.createChild(this.partner);
 
         if (entityageable != null) {
+            // CraftBukkit start - set persistence for tame animals
+            if (entityageable instanceof EntityTameableAnimal && ((EntityTameableAnimal) entityageable).isTamed()) {
+                entityageable.persistent = true;
+            }
+            // CraftBukkit end
             EntityHuman entityhuman = this.animal.getBreedCause();
 
             if (entityhuman == null && this.partner.getBreedCause() != null) {
@@ -88,7 +93,7 @@
             this.partner.resetLove();
             entityageable.setAgeRaw(-24000);
             entityageable.setPositionRotation(this.animal.locX, this.animal.locY, this.animal.locZ, 0.0F, 0.0F);
-            this.a.addEntity(entityageable);
+            this.a.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
             Random random = this.animal.getRandom();
 
             for (int i = 0; i < 7; ++i) {