mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 18:31:29 +01:00
45 lines
2.2 KiB
Diff
45 lines
2.2 KiB
Diff
--- a/net/minecraft/server/PathfinderGoalBreed.java
|
|
+++ b/net/minecraft/server/PathfinderGoalBreed.java
|
|
@@ -75,11 +75,23 @@
|
|
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) {
|
|
entityhuman = this.partner.getBreedCause();
|
|
}
|
|
+ // CraftBukkit start - call EntityBreedEvent
|
|
+ int experience = this.animal.getRandom().nextInt(7) + 1;
|
|
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityageable, animal, partner, entityhuman, this.animal.breedItem, experience);
|
|
+ if (entityBreedEvent.isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
|
|
if (entityhuman != null) {
|
|
entityhuman.b(StatisticList.C);
|
|
@@ -94,7 +106,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) {
|
|
@@ -109,7 +121,7 @@
|
|
}
|
|
|
|
if (this.a.getGameRules().getBoolean("doMobLoot")) {
|
|
- this.a.addEntity(new EntityExperienceOrb(this.a, this.animal.locX, this.animal.locY, this.animal.locZ, random.nextInt(7) + 1));
|
|
+ this.a.addEntity(new EntityExperienceOrb(this.a, this.animal.locX, this.animal.locY, this.animal.locZ, entityBreedEvent.getExperience())); // CraftBukkit - use event experience
|
|
}
|
|
|
|
}
|